From 47540a6eaaab997a326513cdc51fc9bfc9265666 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Mon, 20 Nov 2023 17:43:19 +0700 Subject: [PATCH 001/159] Add contract API --- .../contracts/permissionless-node-registry.go | 23 +- stader-lib/contracts/sd-utility.go | 3303 +++++++++++++++++ stader-lib/contracts/stader-config.go | 168 +- 3 files changed, 3492 insertions(+), 2 deletions(-) create mode 100644 stader-lib/contracts/sd-utility.go diff --git a/stader-lib/contracts/permissionless-node-registry.go b/stader-lib/contracts/permissionless-node-registry.go index 05bec58bd..68169e67f 100644 --- a/stader-lib/contracts/permissionless-node-registry.go +++ b/stader-lib/contracts/permissionless-node-registry.go @@ -43,7 +43,7 @@ type Validator struct { // PermissionlessNodeRegistryMetaData contains all meta data concerning the PermissionlessNodeRegistry contract. var PermissionlessNodeRegistryMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CallerNotExistingRewardAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotManager\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotNewRewardAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotOperator\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotStaderContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CooldownNotComplete\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DuplicatePoolIDOrPoolNotAdded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InSufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidBondEthValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidKeyCount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidStartAndEndIndex\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MisMatchingInputKeysSize\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoChangeInState\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotEnoughSDCollateral\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorAlreadyOnBoardedInProtocol\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorIsDeactivate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorNotOnBoarded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PageNumberIsZero\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PubkeyAlreadyExist\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooManyVerifiedKeysReported\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooManyWithdrawnKeysReported\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UNEXPECTED_STATUS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"maxKeyLimitReached\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"AddedValidatorKey\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalActiveValidatorCount\",\"type\":\"uint256\"}],\"name\":\"DecreasedTotalActiveValidatorCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalActiveValidatorCount\",\"type\":\"uint256\"}],\"name\":\"IncreasedTotalActiveValidatorCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"nodeRewardAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"optInForSocializingPool\",\"type\":\"bool\"}],\"name\":\"OnboardedOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardAddress\",\"type\":\"address\"}],\"name\":\"OperatorRewardAddressUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardAddress\",\"type\":\"address\"}],\"name\":\"RewardAddressProposed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferredCollateralToPool\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"batchKeyDepositLimit\",\"type\":\"uint256\"}],\"name\":\"UpdatedInputKeyCountLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"maxNonTerminalKeyPerOperator\",\"type\":\"uint64\"}],\"name\":\"UpdatedMaxNonTerminalKeyPerOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextQueuedValidatorIndex\",\"type\":\"uint256\"}],\"name\":\"UpdatedNextQueuedValidatorIndex\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"operatorName\",\"type\":\"string\"}],\"name\":\"UpdatedOperatorName\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"optedForSocializingPool\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"block\",\"type\":\"uint256\"}],\"name\":\"UpdatedSocializingPoolState\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"}],\"name\":\"UpdatedValidatorDepositBlock\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"verifiedKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"UpdatedVerifiedKeyBatchSize\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"withdrawnKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"UpdatedWithdrawnKeyBatchSize\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorMarkedAsFrontRunned\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorMarkedReadyToDeposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorStatusMarkedAsInvalidSignature\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorWithdrawn\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"COLLATERAL_ETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FRONT_RUN_PENALTY\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"POOL_ID\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_pubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_preDepositSignature\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_depositSignature\",\"type\":\"bytes[]\"}],\"name\":\"addValidatorKeys\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_optInForSocializingPool\",\"type\":\"bool\"}],\"name\":\"changeSocializingPoolState\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"feeRecipientAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operatorAddress\",\"type\":\"address\"}],\"name\":\"confirmRewardAddressChange\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_pageNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pageSize\",\"type\":\"uint256\"}],\"name\":\"getAllActiveValidators\",\"outputs\":[{\"components\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"preDepositSignature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"depositSignature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"withdrawVaultAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawnBlock\",\"type\":\"uint256\"}],\"internalType\":\"structValidator[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_pageNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pageSize\",\"type\":\"uint256\"}],\"name\":\"getAllNodeELVaultAddress\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCollateralETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"}],\"name\":\"getOperatorRewardAddress\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"}],\"name\":\"getOperatorTotalKeys\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_totalKeys\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_nodeOperator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_startIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_endIndex\",\"type\":\"uint256\"}],\"name\":\"getOperatorTotalNonTerminalKeys\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"}],\"name\":\"getSocializingPoolStateChangeBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalActiveValidatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalQueuedValidatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_pageNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pageSize\",\"type\":\"uint256\"}],\"name\":\"getValidatorsByOperator\",\"outputs\":[{\"components\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"preDepositSignature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"depositSignature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"withdrawVaultAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawnBlock\",\"type\":\"uint256\"}],\"internalType\":\"structValidator[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"name\":\"increaseTotalActiveValidatorCount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"inputKeyCountLimit\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operAddr\",\"type\":\"address\"}],\"name\":\"isExistingOperator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_pubkey\",\"type\":\"bytes\"}],\"name\":\"isExistingPubkey\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_readyToDepositPubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_frontRunPubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_invalidSignaturePubkey\",\"type\":\"bytes[]\"}],\"name\":\"markValidatorReadyToDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxNonTerminalKeyPerOperator\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextOperatorId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextQueuedValidatorIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextValidatorId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"nodeELRewardVaultByOperatorId\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_optInForSocializingPool\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"_operatorName\",\"type\":\"string\"},{\"internalType\":\"addresspayable\",\"name\":\"_operatorRewardAddress\",\"type\":\"address\"}],\"name\":\"onboardNodeOperator\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"feeRecipientAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"operatorIDByAddress\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"operatorStructById\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"optedForSocializingPool\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"operatorName\",\"type\":\"string\"},{\"internalType\":\"addresspayable\",\"name\":\"operatorRewardAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operatorAddress\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operatorAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newRewardAddress\",\"type\":\"address\"}],\"name\":\"proposeRewardAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"proposedRewardAddressByOperatorId\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"queuedValidators\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"socializingPoolStateChangeBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"staderConfig\",\"outputs\":[{\"internalType\":\"contractIStaderConfig\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalActiveValidatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"transferCollateralToPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_validatorId\",\"type\":\"uint256\"}],\"name\":\"updateDepositStatusAndBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_inputKeyCountLimit\",\"type\":\"uint16\"}],\"name\":\"updateInputKeyCountLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"_maxNonTerminalKeyPerOperator\",\"type\":\"uint64\"}],\"name\":\"updateMaxNonTerminalKeyPerOperator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_nextQueuedValidatorIndex\",\"type\":\"uint256\"}],\"name\":\"updateNextQueuedValidatorIndex\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_operatorName\",\"type\":\"string\"}],\"name\":\"updateOperatorName\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_verifiedKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"updateVerifiedKeysBatchSize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"validatorIdByPubkey\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"validatorIdsByOperatorId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorQueueSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"validatorRegistry\",\"outputs\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"preDepositSignature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"depositSignature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"withdrawVaultAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawnBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"verifiedKeyBatchSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_pubkeys\",\"type\":\"bytes[]\"}],\"name\":\"withdrawnValidators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CallerNotExistingRewardAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotManager\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotNewRewardAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotOperator\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotStaderContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CooldownNotComplete\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DuplicatePoolIDOrPoolNotAdded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InSufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidBondEthValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidKeyCount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidStartAndEndIndex\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MisMatchingInputKeysSize\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoChangeInState\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotEnoughSDCollateral\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorAlreadyOnBoardedInProtocol\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorIsDeactivate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorNotOnBoarded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PageNumberIsZero\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PubkeyAlreadyExist\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooManyVerifiedKeysReported\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooManyWithdrawnKeysReported\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UNEXPECTED_STATUS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"maxKeyLimitReached\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"AddedValidatorKey\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalActiveValidatorCount\",\"type\":\"uint256\"}],\"name\":\"DecreasedTotalActiveValidatorCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalActiveValidatorCount\",\"type\":\"uint256\"}],\"name\":\"IncreasedTotalActiveValidatorCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"nodeRewardAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"optInForSocializingPool\",\"type\":\"bool\"}],\"name\":\"OnboardedOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardAddress\",\"type\":\"address\"}],\"name\":\"OperatorRewardAddressUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardAddress\",\"type\":\"address\"}],\"name\":\"RewardAddressProposed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferredCollateralToPool\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"batchKeyDepositLimit\",\"type\":\"uint256\"}],\"name\":\"UpdatedInputKeyCountLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"maxNonTerminalKeyPerOperator\",\"type\":\"uint64\"}],\"name\":\"UpdatedMaxNonTerminalKeyPerOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextQueuedValidatorIndex\",\"type\":\"uint256\"}],\"name\":\"UpdatedNextQueuedValidatorIndex\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"operatorName\",\"type\":\"string\"}],\"name\":\"UpdatedOperatorName\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"optedForSocializingPool\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"block\",\"type\":\"uint256\"}],\"name\":\"UpdatedSocializingPoolState\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"}],\"name\":\"UpdatedValidatorDepositBlock\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"verifiedKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"UpdatedVerifiedKeyBatchSize\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"withdrawnKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"UpdatedWithdrawnKeyBatchSize\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorMarkedAsFrontRunned\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorMarkedReadyToDeposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorStatusMarkedAsInvalidSignature\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorWithdrawn\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"COLLATERAL_ETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FRONT_RUN_PENALTY\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"POOL_ID\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_pubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_preDepositSignature\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_depositSignature\",\"type\":\"bytes[]\"}],\"name\":\"addValidatorKeys\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amountOfSDToUtilize\",\"type\":\"uint256\"},{\"internalType\":\"bytes[]\",\"name\":\"_pubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_preDepositSignature\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_depositSignature\",\"type\":\"bytes[]\"}],\"name\":\"addValidatorKeysWithUtilizeSD\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_optInForSocializingPool\",\"type\":\"bool\"}],\"name\":\"changeSocializingPoolState\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"feeRecipientAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operatorAddress\",\"type\":\"address\"}],\"name\":\"confirmRewardAddressChange\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_pageNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pageSize\",\"type\":\"uint256\"}],\"name\":\"getAllActiveValidators\",\"outputs\":[{\"components\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"preDepositSignature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"depositSignature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"withdrawVaultAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawnBlock\",\"type\":\"uint256\"}],\"internalType\":\"structValidator[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_pageNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pageSize\",\"type\":\"uint256\"}],\"name\":\"getAllNodeELVaultAddress\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCollateralETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"}],\"name\":\"getOperatorRewardAddress\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"}],\"name\":\"getOperatorTotalKeys\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_totalKeys\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_nodeOperator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_startIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_endIndex\",\"type\":\"uint256\"}],\"name\":\"getOperatorTotalNonTerminalKeys\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"}],\"name\":\"getSocializingPoolStateChangeBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalActiveValidatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalQueuedValidatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_pageNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pageSize\",\"type\":\"uint256\"}],\"name\":\"getValidatorsByOperator\",\"outputs\":[{\"components\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"preDepositSignature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"depositSignature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"withdrawVaultAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawnBlock\",\"type\":\"uint256\"}],\"internalType\":\"structValidator[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"name\":\"increaseTotalActiveValidatorCount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"inputKeyCountLimit\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operAddr\",\"type\":\"address\"}],\"name\":\"isExistingOperator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_pubkey\",\"type\":\"bytes\"}],\"name\":\"isExistingPubkey\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_readyToDepositPubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_frontRunPubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_invalidSignaturePubkey\",\"type\":\"bytes[]\"}],\"name\":\"markValidatorReadyToDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxNonTerminalKeyPerOperator\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextOperatorId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextQueuedValidatorIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextValidatorId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"nodeELRewardVaultByOperatorId\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_optInForSocializingPool\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"_operatorName\",\"type\":\"string\"},{\"internalType\":\"addresspayable\",\"name\":\"_operatorRewardAddress\",\"type\":\"address\"}],\"name\":\"onboardNodeOperator\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"feeRecipientAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"operatorIDByAddress\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"operatorStructById\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"optedForSocializingPool\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"operatorName\",\"type\":\"string\"},{\"internalType\":\"addresspayable\",\"name\":\"operatorRewardAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operatorAddress\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operatorAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newRewardAddress\",\"type\":\"address\"}],\"name\":\"proposeRewardAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"proposedRewardAddressByOperatorId\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"queuedValidators\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"socializingPoolStateChangeBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"staderConfig\",\"outputs\":[{\"internalType\":\"contractIStaderConfig\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalActiveValidatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"transferCollateralToPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_validatorId\",\"type\":\"uint256\"}],\"name\":\"updateDepositStatusAndBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_inputKeyCountLimit\",\"type\":\"uint16\"}],\"name\":\"updateInputKeyCountLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"_maxNonTerminalKeyPerOperator\",\"type\":\"uint64\"}],\"name\":\"updateMaxNonTerminalKeyPerOperator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_nextQueuedValidatorIndex\",\"type\":\"uint256\"}],\"name\":\"updateNextQueuedValidatorIndex\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_operatorName\",\"type\":\"string\"}],\"name\":\"updateOperatorName\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_verifiedKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"updateVerifiedKeysBatchSize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"validatorIdByPubkey\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"validatorIdsByOperatorId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorQueueSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"validatorRegistry\",\"outputs\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"preDepositSignature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"depositSignature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"withdrawVaultAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawnBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"verifiedKeyBatchSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_pubkeys\",\"type\":\"bytes[]\"}],\"name\":\"withdrawnValidators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // PermissionlessNodeRegistryABI is the input ABI used to generate the binding from. @@ -1464,6 +1464,27 @@ func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryTransactorSession) return _PermissionlessNodeRegistry.Contract.AddValidatorKeys(&_PermissionlessNodeRegistry.TransactOpts, _pubkey, _preDepositSignature, _depositSignature) } +// AddValidatorKeysWithUtilizeSD is a paid mutator transaction binding the contract method 0x60cb299d. +// +// Solidity: function addValidatorKeysWithUtilizeSD(uint256 _amountOfSDToUtilize, bytes[] _pubkey, bytes[] _preDepositSignature, bytes[] _depositSignature) payable returns() +func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryTransactor) AddValidatorKeysWithUtilizeSD(opts *bind.TransactOpts, _amountOfSDToUtilize *big.Int, _pubkey [][]byte, _preDepositSignature [][]byte, _depositSignature [][]byte) (*types.Transaction, error) { + return _PermissionlessNodeRegistry.contract.Transact(opts, "addValidatorKeysWithUtilizeSD", _amountOfSDToUtilize, _pubkey, _preDepositSignature, _depositSignature) +} + +// AddValidatorKeysWithUtilizeSD is a paid mutator transaction binding the contract method 0x60cb299d. +// +// Solidity: function addValidatorKeysWithUtilizeSD(uint256 _amountOfSDToUtilize, bytes[] _pubkey, bytes[] _preDepositSignature, bytes[] _depositSignature) payable returns() +func (_PermissionlessNodeRegistry *PermissionlessNodeRegistrySession) AddValidatorKeysWithUtilizeSD(_amountOfSDToUtilize *big.Int, _pubkey [][]byte, _preDepositSignature [][]byte, _depositSignature [][]byte) (*types.Transaction, error) { + return _PermissionlessNodeRegistry.Contract.AddValidatorKeysWithUtilizeSD(&_PermissionlessNodeRegistry.TransactOpts, _amountOfSDToUtilize, _pubkey, _preDepositSignature, _depositSignature) +} + +// AddValidatorKeysWithUtilizeSD is a paid mutator transaction binding the contract method 0x60cb299d. +// +// Solidity: function addValidatorKeysWithUtilizeSD(uint256 _amountOfSDToUtilize, bytes[] _pubkey, bytes[] _preDepositSignature, bytes[] _depositSignature) payable returns() +func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryTransactorSession) AddValidatorKeysWithUtilizeSD(_amountOfSDToUtilize *big.Int, _pubkey [][]byte, _preDepositSignature [][]byte, _depositSignature [][]byte) (*types.Transaction, error) { + return _PermissionlessNodeRegistry.Contract.AddValidatorKeysWithUtilizeSD(&_PermissionlessNodeRegistry.TransactOpts, _amountOfSDToUtilize, _pubkey, _preDepositSignature, _depositSignature) +} + // ChangeSocializingPoolState is a paid mutator transaction binding the contract method 0xf90b0838. // // Solidity: function changeSocializingPoolState(bool _optInForSocializingPool) returns(address feeRecipientAddress) diff --git a/stader-lib/contracts/sd-utility.go b/stader-lib/contracts/sd-utility.go new file mode 100644 index 000000000..51cbdb05e --- /dev/null +++ b/stader-lib/contracts/sd-utility.go @@ -0,0 +1,3303 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package contracts + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// SDUtilityPoolMetaData contains all meta data concerning the SDUtilityPool contract. +var SDUtilityPoolMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[],\"name\":\"AccrualBlockNumberNotLatest\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotAuthorizedToRedeem\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotFindRequestId\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientPoolBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAmountOfWithdraw\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxLimitOnWithdrawRequestCountReached\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"RequestIdNotFinalized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDUtilizeLimitReached\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UndelegationPeriodNotPassed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAccumulated\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalProtocolFee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalUtilizedSD\",\"type\":\"uint256\"}],\"name\":\"AccruedFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXToMint\",\"type\":\"uint256\"}],\"name\":\"Delegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestIdToFinalize\",\"type\":\"uint256\"}],\"name\":\"FinalizedWithdrawRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"protocolFeeFactor\",\"type\":\"uint256\"}],\"name\":\"ProtocolFeeFactorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXAmount\",\"type\":\"uint256\"}],\"name\":\"Redeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"Repaid\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdToTransfer\",\"type\":\"uint256\"}],\"name\":\"RequestRedeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"SDUtilized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"finalizationBatchLimit\",\"type\":\"uint256\"}],\"name\":\"UpdatedFinalizationBatchLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxETHWorthOfSDPerValidator\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxETHWorthOfSDPerValidator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxNonRedeemedDelegatorRequestCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minBlockDelayToFinalizeRequest\",\"type\":\"uint256\"}],\"name\":\"UpdatedMinBlockDelayToFinalizeRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"undelegationPeriodInBlocks\",\"type\":\"uint256\"}],\"name\":\"UpdatedUndelegationPeriodInBlocks\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizationRatePerBlock\",\"type\":\"uint256\"}],\"name\":\"UtilizationRatePerBlockUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"slashSDAmount\",\"type\":\"uint256\"}],\"name\":\"UtilizerSDSlashingHandled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmountToWithdraw\",\"type\":\"uint256\"}],\"name\":\"WithdrawRequestReceived\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"accrueFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cTokenTotalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"delegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"delegatorCTokenBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"delegatorWithdrawRequests\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountOfCToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdExpected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdFinalized\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finalizeDelegatorWithdrawalRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDelegationRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_delegator\",\"type\":\"address\"}],\"name\":\"getDelegatorLatestSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLatestExchangeRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPoolAvailableSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"getRequestIdsByDelegator\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_utilizer\",\"type\":\"address\"}],\"name\":\"getUtilizerLatestBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_utilizer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_slashSDAmount\",\"type\":\"uint256\"}],\"name\":\"handleUtilizerSDSlashing\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"liquidationCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxApproveSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"poolUtilization\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repay\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repayOnBehalf\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"requestIdsByDelegatorAddress\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"cTokenAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdrawWithSDAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"utilize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonTerminalKeyCount\",\"type\":\"uint256\"}],\"name\":\"utilizeWhileAddingKeys\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"utilizerData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"principal\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"utilizeIndex\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", +} + +// SDUtilityPoolABI is the input ABI used to generate the binding from. +// Deprecated: Use SDUtilityPoolMetaData.ABI instead. +var SDUtilityPoolABI = SDUtilityPoolMetaData.ABI + +// SDUtilityPool is an auto generated Go binding around an Ethereum contract. +type SDUtilityPool struct { + SDUtilityPoolCaller // Read-only binding to the contract + SDUtilityPoolTransactor // Write-only binding to the contract + SDUtilityPoolFilterer // Log filterer for contract events +} + +// SDUtilityPoolCaller is an auto generated read-only Go binding around an Ethereum contract. +type SDUtilityPoolCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// SDUtilityPoolTransactor is an auto generated write-only Go binding around an Ethereum contract. +type SDUtilityPoolTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// SDUtilityPoolFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type SDUtilityPoolFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// SDUtilityPoolSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type SDUtilityPoolSession struct { + Contract *SDUtilityPool // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// SDUtilityPoolCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type SDUtilityPoolCallerSession struct { + Contract *SDUtilityPoolCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// SDUtilityPoolTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type SDUtilityPoolTransactorSession struct { + Contract *SDUtilityPoolTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// SDUtilityPoolRaw is an auto generated low-level Go binding around an Ethereum contract. +type SDUtilityPoolRaw struct { + Contract *SDUtilityPool // Generic contract binding to access the raw methods on +} + +// SDUtilityPoolCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type SDUtilityPoolCallerRaw struct { + Contract *SDUtilityPoolCaller // Generic read-only contract binding to access the raw methods on +} + +// SDUtilityPoolTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type SDUtilityPoolTransactorRaw struct { + Contract *SDUtilityPoolTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewSDUtilityPool creates a new instance of SDUtilityPool, bound to a specific deployed contract. +func NewSDUtilityPool(address common.Address, backend bind.ContractBackend) (*SDUtilityPool, error) { + contract, err := bindSDUtilityPool(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &SDUtilityPool{SDUtilityPoolCaller: SDUtilityPoolCaller{contract: contract}, SDUtilityPoolTransactor: SDUtilityPoolTransactor{contract: contract}, SDUtilityPoolFilterer: SDUtilityPoolFilterer{contract: contract}}, nil +} + +// NewSDUtilityPoolCaller creates a new read-only instance of SDUtilityPool, bound to a specific deployed contract. +func NewSDUtilityPoolCaller(address common.Address, caller bind.ContractCaller) (*SDUtilityPoolCaller, error) { + contract, err := bindSDUtilityPool(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &SDUtilityPoolCaller{contract: contract}, nil +} + +// NewSDUtilityPoolTransactor creates a new write-only instance of SDUtilityPool, bound to a specific deployed contract. +func NewSDUtilityPoolTransactor(address common.Address, transactor bind.ContractTransactor) (*SDUtilityPoolTransactor, error) { + contract, err := bindSDUtilityPool(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &SDUtilityPoolTransactor{contract: contract}, nil +} + +// NewSDUtilityPoolFilterer creates a new log filterer instance of SDUtilityPool, bound to a specific deployed contract. +func NewSDUtilityPoolFilterer(address common.Address, filterer bind.ContractFilterer) (*SDUtilityPoolFilterer, error) { + contract, err := bindSDUtilityPool(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &SDUtilityPoolFilterer{contract: contract}, nil +} + +// bindSDUtilityPool binds a generic wrapper to an already deployed contract. +func bindSDUtilityPool(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := SDUtilityPoolMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_SDUtilityPool *SDUtilityPoolRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _SDUtilityPool.Contract.SDUtilityPoolCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_SDUtilityPool *SDUtilityPoolRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.Contract.SDUtilityPoolTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_SDUtilityPool *SDUtilityPoolRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _SDUtilityPool.Contract.SDUtilityPoolTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_SDUtilityPool *SDUtilityPoolCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _SDUtilityPool.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_SDUtilityPool *SDUtilityPoolTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_SDUtilityPool *SDUtilityPoolTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _SDUtilityPool.Contract.contract.Transact(opts, method, params...) +} + +// CTokenTotalSupply is a free data retrieval call binding the contract method 0x37a4adf7. +// +// Solidity: function cTokenTotalSupply() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) CTokenTotalSupply(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "cTokenTotalSupply") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// CTokenTotalSupply is a free data retrieval call binding the contract method 0x37a4adf7. +// +// Solidity: function cTokenTotalSupply() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) CTokenTotalSupply() (*big.Int, error) { + return _SDUtilityPool.Contract.CTokenTotalSupply(&_SDUtilityPool.CallOpts) +} + +// CTokenTotalSupply is a free data retrieval call binding the contract method 0x37a4adf7. +// +// Solidity: function cTokenTotalSupply() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) CTokenTotalSupply() (*big.Int, error) { + return _SDUtilityPool.Contract.CTokenTotalSupply(&_SDUtilityPool.CallOpts) +} + +// DelegatorCTokenBalance is a free data retrieval call binding the contract method 0xabf9db02. +// +// Solidity: function delegatorCTokenBalance(address ) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) DelegatorCTokenBalance(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "delegatorCTokenBalance", arg0) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// DelegatorCTokenBalance is a free data retrieval call binding the contract method 0xabf9db02. +// +// Solidity: function delegatorCTokenBalance(address ) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) DelegatorCTokenBalance(arg0 common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.DelegatorCTokenBalance(&_SDUtilityPool.CallOpts, arg0) +} + +// DelegatorCTokenBalance is a free data retrieval call binding the contract method 0xabf9db02. +// +// Solidity: function delegatorCTokenBalance(address ) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) DelegatorCTokenBalance(arg0 common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.DelegatorCTokenBalance(&_SDUtilityPool.CallOpts, arg0) +} + +// DelegatorWithdrawRequests is a free data retrieval call binding the contract method 0xe41b55d9. +// +// Solidity: function delegatorWithdrawRequests(uint256 ) view returns(address owner, uint256 amountOfCToken, uint256 sdExpected, uint256 sdFinalized, uint256 requestBlock) +func (_SDUtilityPool *SDUtilityPoolCaller) DelegatorWithdrawRequests(opts *bind.CallOpts, arg0 *big.Int) (struct { + Owner common.Address + AmountOfCToken *big.Int + SdExpected *big.Int + SdFinalized *big.Int + RequestBlock *big.Int +}, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "delegatorWithdrawRequests", arg0) + + outstruct := new(struct { + Owner common.Address + AmountOfCToken *big.Int + SdExpected *big.Int + SdFinalized *big.Int + RequestBlock *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.Owner = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + outstruct.AmountOfCToken = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.SdExpected = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + outstruct.SdFinalized = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) + outstruct.RequestBlock = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int) + + return *outstruct, err + +} + +// DelegatorWithdrawRequests is a free data retrieval call binding the contract method 0xe41b55d9. +// +// Solidity: function delegatorWithdrawRequests(uint256 ) view returns(address owner, uint256 amountOfCToken, uint256 sdExpected, uint256 sdFinalized, uint256 requestBlock) +func (_SDUtilityPool *SDUtilityPoolSession) DelegatorWithdrawRequests(arg0 *big.Int) (struct { + Owner common.Address + AmountOfCToken *big.Int + SdExpected *big.Int + SdFinalized *big.Int + RequestBlock *big.Int +}, error) { + return _SDUtilityPool.Contract.DelegatorWithdrawRequests(&_SDUtilityPool.CallOpts, arg0) +} + +// DelegatorWithdrawRequests is a free data retrieval call binding the contract method 0xe41b55d9. +// +// Solidity: function delegatorWithdrawRequests(uint256 ) view returns(address owner, uint256 amountOfCToken, uint256 sdExpected, uint256 sdFinalized, uint256 requestBlock) +func (_SDUtilityPool *SDUtilityPoolCallerSession) DelegatorWithdrawRequests(arg0 *big.Int) (struct { + Owner common.Address + AmountOfCToken *big.Int + SdExpected *big.Int + SdFinalized *big.Int + RequestBlock *big.Int +}, error) { + return _SDUtilityPool.Contract.DelegatorWithdrawRequests(&_SDUtilityPool.CallOpts, arg0) +} + +// ExchangeRateStored is a free data retrieval call binding the contract method 0x182df0f5. +// +// Solidity: function exchangeRateStored() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) ExchangeRateStored(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "exchangeRateStored") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// ExchangeRateStored is a free data retrieval call binding the contract method 0x182df0f5. +// +// Solidity: function exchangeRateStored() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) ExchangeRateStored() (*big.Int, error) { + return _SDUtilityPool.Contract.ExchangeRateStored(&_SDUtilityPool.CallOpts) +} + +// ExchangeRateStored is a free data retrieval call binding the contract method 0x182df0f5. +// +// Solidity: function exchangeRateStored() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) ExchangeRateStored() (*big.Int, error) { + return _SDUtilityPool.Contract.ExchangeRateStored(&_SDUtilityPool.CallOpts) +} + +// GetDelegationRate is a free data retrieval call binding the contract method 0x0c7e5c23. +// +// Solidity: function getDelegationRate() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) GetDelegationRate(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "getDelegationRate") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetDelegationRate is a free data retrieval call binding the contract method 0x0c7e5c23. +// +// Solidity: function getDelegationRate() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) GetDelegationRate() (*big.Int, error) { + return _SDUtilityPool.Contract.GetDelegationRate(&_SDUtilityPool.CallOpts) +} + +// GetDelegationRate is a free data retrieval call binding the contract method 0x0c7e5c23. +// +// Solidity: function getDelegationRate() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetDelegationRate() (*big.Int, error) { + return _SDUtilityPool.Contract.GetDelegationRate(&_SDUtilityPool.CallOpts) +} + +// GetDelegatorLatestSDBalance is a free data retrieval call binding the contract method 0x22291528. +// +// Solidity: function getDelegatorLatestSDBalance(address _delegator) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) GetDelegatorLatestSDBalance(opts *bind.CallOpts, _delegator common.Address) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "getDelegatorLatestSDBalance", _delegator) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetDelegatorLatestSDBalance is a free data retrieval call binding the contract method 0x22291528. +// +// Solidity: function getDelegatorLatestSDBalance(address _delegator) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) GetDelegatorLatestSDBalance(_delegator common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.GetDelegatorLatestSDBalance(&_SDUtilityPool.CallOpts, _delegator) +} + +// GetDelegatorLatestSDBalance is a free data retrieval call binding the contract method 0x22291528. +// +// Solidity: function getDelegatorLatestSDBalance(address _delegator) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetDelegatorLatestSDBalance(_delegator common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.GetDelegatorLatestSDBalance(&_SDUtilityPool.CallOpts, _delegator) +} + +// GetLatestExchangeRate is a free data retrieval call binding the contract method 0x34d093f6. +// +// Solidity: function getLatestExchangeRate() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) GetLatestExchangeRate(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "getLatestExchangeRate") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetLatestExchangeRate is a free data retrieval call binding the contract method 0x34d093f6. +// +// Solidity: function getLatestExchangeRate() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) GetLatestExchangeRate() (*big.Int, error) { + return _SDUtilityPool.Contract.GetLatestExchangeRate(&_SDUtilityPool.CallOpts) +} + +// GetLatestExchangeRate is a free data retrieval call binding the contract method 0x34d093f6. +// +// Solidity: function getLatestExchangeRate() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetLatestExchangeRate() (*big.Int, error) { + return _SDUtilityPool.Contract.GetLatestExchangeRate(&_SDUtilityPool.CallOpts) +} + +// GetPoolAvailableSDBalance is a free data retrieval call binding the contract method 0xda695857. +// +// Solidity: function getPoolAvailableSDBalance() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) GetPoolAvailableSDBalance(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "getPoolAvailableSDBalance") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetPoolAvailableSDBalance is a free data retrieval call binding the contract method 0xda695857. +// +// Solidity: function getPoolAvailableSDBalance() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) GetPoolAvailableSDBalance() (*big.Int, error) { + return _SDUtilityPool.Contract.GetPoolAvailableSDBalance(&_SDUtilityPool.CallOpts) +} + +// GetPoolAvailableSDBalance is a free data retrieval call binding the contract method 0xda695857. +// +// Solidity: function getPoolAvailableSDBalance() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetPoolAvailableSDBalance() (*big.Int, error) { + return _SDUtilityPool.Contract.GetPoolAvailableSDBalance(&_SDUtilityPool.CallOpts) +} + +// GetRequestIdsByDelegator is a free data retrieval call binding the contract method 0x99775f40. +// +// Solidity: function getRequestIdsByDelegator(address _owner) view returns(uint256[]) +func (_SDUtilityPool *SDUtilityPoolCaller) GetRequestIdsByDelegator(opts *bind.CallOpts, _owner common.Address) ([]*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "getRequestIdsByDelegator", _owner) + + if err != nil { + return *new([]*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new([]*big.Int)).(*[]*big.Int) + + return out0, err + +} + +// GetRequestIdsByDelegator is a free data retrieval call binding the contract method 0x99775f40. +// +// Solidity: function getRequestIdsByDelegator(address _owner) view returns(uint256[]) +func (_SDUtilityPool *SDUtilityPoolSession) GetRequestIdsByDelegator(_owner common.Address) ([]*big.Int, error) { + return _SDUtilityPool.Contract.GetRequestIdsByDelegator(&_SDUtilityPool.CallOpts, _owner) +} + +// GetRequestIdsByDelegator is a free data retrieval call binding the contract method 0x99775f40. +// +// Solidity: function getRequestIdsByDelegator(address _owner) view returns(uint256[]) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetRequestIdsByDelegator(_owner common.Address) ([]*big.Int, error) { + return _SDUtilityPool.Contract.GetRequestIdsByDelegator(&_SDUtilityPool.CallOpts, _owner) +} + +// GetUtilizerLatestBalance is a free data retrieval call binding the contract method 0x36978412. +// +// Solidity: function getUtilizerLatestBalance(address _utilizer) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) GetUtilizerLatestBalance(opts *bind.CallOpts, _utilizer common.Address) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "getUtilizerLatestBalance", _utilizer) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetUtilizerLatestBalance is a free data retrieval call binding the contract method 0x36978412. +// +// Solidity: function getUtilizerLatestBalance(address _utilizer) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) GetUtilizerLatestBalance(_utilizer common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.GetUtilizerLatestBalance(&_SDUtilityPool.CallOpts, _utilizer) +} + +// GetUtilizerLatestBalance is a free data retrieval call binding the contract method 0x36978412. +// +// Solidity: function getUtilizerLatestBalance(address _utilizer) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetUtilizerLatestBalance(_utilizer common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.GetUtilizerLatestBalance(&_SDUtilityPool.CallOpts, _utilizer) +} + +// PoolUtilization is a free data retrieval call binding the contract method 0x9a3263ee. +// +// Solidity: function poolUtilization() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) PoolUtilization(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "poolUtilization") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// PoolUtilization is a free data retrieval call binding the contract method 0x9a3263ee. +// +// Solidity: function poolUtilization() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) PoolUtilization() (*big.Int, error) { + return _SDUtilityPool.Contract.PoolUtilization(&_SDUtilityPool.CallOpts) +} + +// PoolUtilization is a free data retrieval call binding the contract method 0x9a3263ee. +// +// Solidity: function poolUtilization() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) PoolUtilization() (*big.Int, error) { + return _SDUtilityPool.Contract.PoolUtilization(&_SDUtilityPool.CallOpts) +} + +// RequestIdsByDelegatorAddress is a free data retrieval call binding the contract method 0x7844e3af. +// +// Solidity: function requestIdsByDelegatorAddress(address , uint256 ) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) RequestIdsByDelegatorAddress(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "requestIdsByDelegatorAddress", arg0, arg1) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// RequestIdsByDelegatorAddress is a free data retrieval call binding the contract method 0x7844e3af. +// +// Solidity: function requestIdsByDelegatorAddress(address , uint256 ) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) RequestIdsByDelegatorAddress(arg0 common.Address, arg1 *big.Int) (*big.Int, error) { + return _SDUtilityPool.Contract.RequestIdsByDelegatorAddress(&_SDUtilityPool.CallOpts, arg0, arg1) +} + +// RequestIdsByDelegatorAddress is a free data retrieval call binding the contract method 0x7844e3af. +// +// Solidity: function requestIdsByDelegatorAddress(address , uint256 ) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) RequestIdsByDelegatorAddress(arg0 common.Address, arg1 *big.Int) (*big.Int, error) { + return _SDUtilityPool.Contract.RequestIdsByDelegatorAddress(&_SDUtilityPool.CallOpts, arg0, arg1) +} + +// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. +// +// Solidity: function utilizerBalanceStored(address account) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) UtilizerBalanceStored(opts *bind.CallOpts, account common.Address) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "utilizerBalanceStored", account) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. +// +// Solidity: function utilizerBalanceStored(address account) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) UtilizerBalanceStored(account common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.UtilizerBalanceStored(&_SDUtilityPool.CallOpts, account) +} + +// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. +// +// Solidity: function utilizerBalanceStored(address account) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizerBalanceStored(account common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.UtilizerBalanceStored(&_SDUtilityPool.CallOpts, account) +} + +// UtilizerData is a free data retrieval call binding the contract method 0x9e070088. +// +// Solidity: function utilizerData(address ) view returns(uint256 principal, uint256 utilizeIndex) +func (_SDUtilityPool *SDUtilityPoolCaller) UtilizerData(opts *bind.CallOpts, arg0 common.Address) (struct { + Principal *big.Int + UtilizeIndex *big.Int +}, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "utilizerData", arg0) + + outstruct := new(struct { + Principal *big.Int + UtilizeIndex *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.Principal = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.UtilizeIndex = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + + return *outstruct, err + +} + +// UtilizerData is a free data retrieval call binding the contract method 0x9e070088. +// +// Solidity: function utilizerData(address ) view returns(uint256 principal, uint256 utilizeIndex) +func (_SDUtilityPool *SDUtilityPoolSession) UtilizerData(arg0 common.Address) (struct { + Principal *big.Int + UtilizeIndex *big.Int +}, error) { + return _SDUtilityPool.Contract.UtilizerData(&_SDUtilityPool.CallOpts, arg0) +} + +// UtilizerData is a free data retrieval call binding the contract method 0x9e070088. +// +// Solidity: function utilizerData(address ) view returns(uint256 principal, uint256 utilizeIndex) +func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizerData(arg0 common.Address) (struct { + Principal *big.Int + UtilizeIndex *big.Int +}, error) { + return _SDUtilityPool.Contract.UtilizerData(&_SDUtilityPool.CallOpts, arg0) +} + +// AccrueFee is a paid mutator transaction binding the contract method 0xb26cc394. +// +// Solidity: function accrueFee() returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) AccrueFee(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "accrueFee") +} + +// AccrueFee is a paid mutator transaction binding the contract method 0xb26cc394. +// +// Solidity: function accrueFee() returns() +func (_SDUtilityPool *SDUtilityPoolSession) AccrueFee() (*types.Transaction, error) { + return _SDUtilityPool.Contract.AccrueFee(&_SDUtilityPool.TransactOpts) +} + +// AccrueFee is a paid mutator transaction binding the contract method 0xb26cc394. +// +// Solidity: function accrueFee() returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) AccrueFee() (*types.Transaction, error) { + return _SDUtilityPool.Contract.AccrueFee(&_SDUtilityPool.TransactOpts) +} + +// Claim is a paid mutator transaction binding the contract method 0x379607f5. +// +// Solidity: function claim(uint256 requestId) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) Claim(opts *bind.TransactOpts, requestId *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "claim", requestId) +} + +// Claim is a paid mutator transaction binding the contract method 0x379607f5. +// +// Solidity: function claim(uint256 requestId) returns() +func (_SDUtilityPool *SDUtilityPoolSession) Claim(requestId *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Claim(&_SDUtilityPool.TransactOpts, requestId) +} + +// Claim is a paid mutator transaction binding the contract method 0x379607f5. +// +// Solidity: function claim(uint256 requestId) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Claim(requestId *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Claim(&_SDUtilityPool.TransactOpts, requestId) +} + +// Delegate is a paid mutator transaction binding the contract method 0x9fa6dd35. +// +// Solidity: function delegate(uint256 sdAmount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) Delegate(opts *bind.TransactOpts, sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "delegate", sdAmount) +} + +// Delegate is a paid mutator transaction binding the contract method 0x9fa6dd35. +// +// Solidity: function delegate(uint256 sdAmount) returns() +func (_SDUtilityPool *SDUtilityPoolSession) Delegate(sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Delegate(&_SDUtilityPool.TransactOpts, sdAmount) +} + +// Delegate is a paid mutator transaction binding the contract method 0x9fa6dd35. +// +// Solidity: function delegate(uint256 sdAmount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Delegate(sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Delegate(&_SDUtilityPool.TransactOpts, sdAmount) +} + +// ExchangeRateCurrent is a paid mutator transaction binding the contract method 0xbd6d894d. +// +// Solidity: function exchangeRateCurrent() returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactor) ExchangeRateCurrent(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "exchangeRateCurrent") +} + +// ExchangeRateCurrent is a paid mutator transaction binding the contract method 0xbd6d894d. +// +// Solidity: function exchangeRateCurrent() returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) ExchangeRateCurrent() (*types.Transaction, error) { + return _SDUtilityPool.Contract.ExchangeRateCurrent(&_SDUtilityPool.TransactOpts) +} + +// ExchangeRateCurrent is a paid mutator transaction binding the contract method 0xbd6d894d. +// +// Solidity: function exchangeRateCurrent() returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) ExchangeRateCurrent() (*types.Transaction, error) { + return _SDUtilityPool.Contract.ExchangeRateCurrent(&_SDUtilityPool.TransactOpts) +} + +// FinalizeDelegatorWithdrawalRequest is a paid mutator transaction binding the contract method 0x71898b4e. +// +// Solidity: function finalizeDelegatorWithdrawalRequest() returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) FinalizeDelegatorWithdrawalRequest(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "finalizeDelegatorWithdrawalRequest") +} + +// FinalizeDelegatorWithdrawalRequest is a paid mutator transaction binding the contract method 0x71898b4e. +// +// Solidity: function finalizeDelegatorWithdrawalRequest() returns() +func (_SDUtilityPool *SDUtilityPoolSession) FinalizeDelegatorWithdrawalRequest() (*types.Transaction, error) { + return _SDUtilityPool.Contract.FinalizeDelegatorWithdrawalRequest(&_SDUtilityPool.TransactOpts) +} + +// FinalizeDelegatorWithdrawalRequest is a paid mutator transaction binding the contract method 0x71898b4e. +// +// Solidity: function finalizeDelegatorWithdrawalRequest() returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) FinalizeDelegatorWithdrawalRequest() (*types.Transaction, error) { + return _SDUtilityPool.Contract.FinalizeDelegatorWithdrawalRequest(&_SDUtilityPool.TransactOpts) +} + +// HandleUtilizerSDSlashing is a paid mutator transaction binding the contract method 0xfa72bf63. +// +// Solidity: function handleUtilizerSDSlashing(address _utilizer, uint256 _slashSDAmount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) HandleUtilizerSDSlashing(opts *bind.TransactOpts, _utilizer common.Address, _slashSDAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "handleUtilizerSDSlashing", _utilizer, _slashSDAmount) +} + +// HandleUtilizerSDSlashing is a paid mutator transaction binding the contract method 0xfa72bf63. +// +// Solidity: function handleUtilizerSDSlashing(address _utilizer, uint256 _slashSDAmount) returns() +func (_SDUtilityPool *SDUtilityPoolSession) HandleUtilizerSDSlashing(_utilizer common.Address, _slashSDAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.HandleUtilizerSDSlashing(&_SDUtilityPool.TransactOpts, _utilizer, _slashSDAmount) +} + +// HandleUtilizerSDSlashing is a paid mutator transaction binding the contract method 0xfa72bf63. +// +// Solidity: function handleUtilizerSDSlashing(address _utilizer, uint256 _slashSDAmount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) HandleUtilizerSDSlashing(_utilizer common.Address, _slashSDAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.HandleUtilizerSDSlashing(&_SDUtilityPool.TransactOpts, _utilizer, _slashSDAmount) +} + +// LiquidationCall is a paid mutator transaction binding the contract method 0xd2ac4a3d. +// +// Solidity: function liquidationCall(address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) LiquidationCall(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "liquidationCall", account) +} + +// LiquidationCall is a paid mutator transaction binding the contract method 0xd2ac4a3d. +// +// Solidity: function liquidationCall(address account) returns() +func (_SDUtilityPool *SDUtilityPoolSession) LiquidationCall(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.LiquidationCall(&_SDUtilityPool.TransactOpts, account) +} + +// LiquidationCall is a paid mutator transaction binding the contract method 0xd2ac4a3d. +// +// Solidity: function liquidationCall(address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) LiquidationCall(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.LiquidationCall(&_SDUtilityPool.TransactOpts, account) +} + +// MaxApproveSD is a paid mutator transaction binding the contract method 0x3e04cd35. +// +// Solidity: function maxApproveSD() returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) MaxApproveSD(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "maxApproveSD") +} + +// MaxApproveSD is a paid mutator transaction binding the contract method 0x3e04cd35. +// +// Solidity: function maxApproveSD() returns() +func (_SDUtilityPool *SDUtilityPoolSession) MaxApproveSD() (*types.Transaction, error) { + return _SDUtilityPool.Contract.MaxApproveSD(&_SDUtilityPool.TransactOpts) +} + +// MaxApproveSD is a paid mutator transaction binding the contract method 0x3e04cd35. +// +// Solidity: function maxApproveSD() returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) MaxApproveSD() (*types.Transaction, error) { + return _SDUtilityPool.Contract.MaxApproveSD(&_SDUtilityPool.TransactOpts) +} + +// Repay is a paid mutator transaction binding the contract method 0x371fd8e6. +// +// Solidity: function repay(uint256 repayAmount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) Repay(opts *bind.TransactOpts, repayAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "repay", repayAmount) +} + +// Repay is a paid mutator transaction binding the contract method 0x371fd8e6. +// +// Solidity: function repay(uint256 repayAmount) returns() +func (_SDUtilityPool *SDUtilityPoolSession) Repay(repayAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Repay(&_SDUtilityPool.TransactOpts, repayAmount) +} + +// Repay is a paid mutator transaction binding the contract method 0x371fd8e6. +// +// Solidity: function repay(uint256 repayAmount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Repay(repayAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Repay(&_SDUtilityPool.TransactOpts, repayAmount) +} + +// RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. +// +// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) RepayOnBehalf(opts *bind.TransactOpts, utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "repayOnBehalf", utilizer, repayAmount) +} + +// RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. +// +// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns() +func (_SDUtilityPool *SDUtilityPoolSession) RepayOnBehalf(utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RepayOnBehalf(&_SDUtilityPool.TransactOpts, utilizer, repayAmount) +} + +// RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. +// +// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) RepayOnBehalf(utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RepayOnBehalf(&_SDUtilityPool.TransactOpts, utilizer, repayAmount) +} + +// RequestWithdraw is a paid mutator transaction binding the contract method 0x745400c9. +// +// Solidity: function requestWithdraw(uint256 cTokenAmount) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactor) RequestWithdraw(opts *bind.TransactOpts, cTokenAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "requestWithdraw", cTokenAmount) +} + +// RequestWithdraw is a paid mutator transaction binding the contract method 0x745400c9. +// +// Solidity: function requestWithdraw(uint256 cTokenAmount) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) RequestWithdraw(cTokenAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RequestWithdraw(&_SDUtilityPool.TransactOpts, cTokenAmount) +} + +// RequestWithdraw is a paid mutator transaction binding the contract method 0x745400c9. +// +// Solidity: function requestWithdraw(uint256 cTokenAmount) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) RequestWithdraw(cTokenAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RequestWithdraw(&_SDUtilityPool.TransactOpts, cTokenAmount) +} + +// RequestWithdrawWithSDAmount is a paid mutator transaction binding the contract method 0xc51cd1cc. +// +// Solidity: function requestWithdrawWithSDAmount(uint256 sdAmount) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactor) RequestWithdrawWithSDAmount(opts *bind.TransactOpts, sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "requestWithdrawWithSDAmount", sdAmount) +} + +// RequestWithdrawWithSDAmount is a paid mutator transaction binding the contract method 0xc51cd1cc. +// +// Solidity: function requestWithdrawWithSDAmount(uint256 sdAmount) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) RequestWithdrawWithSDAmount(sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RequestWithdrawWithSDAmount(&_SDUtilityPool.TransactOpts, sdAmount) +} + +// RequestWithdrawWithSDAmount is a paid mutator transaction binding the contract method 0xc51cd1cc. +// +// Solidity: function requestWithdrawWithSDAmount(uint256 sdAmount) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) RequestWithdrawWithSDAmount(sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RequestWithdrawWithSDAmount(&_SDUtilityPool.TransactOpts, sdAmount) +} + +// Utilize is a paid mutator transaction binding the contract method 0xec29c551. +// +// Solidity: function utilize(uint256 utilizeAmount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) Utilize(opts *bind.TransactOpts, utilizeAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "utilize", utilizeAmount) +} + +// Utilize is a paid mutator transaction binding the contract method 0xec29c551. +// +// Solidity: function utilize(uint256 utilizeAmount) returns() +func (_SDUtilityPool *SDUtilityPoolSession) Utilize(utilizeAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Utilize(&_SDUtilityPool.TransactOpts, utilizeAmount) +} + +// Utilize is a paid mutator transaction binding the contract method 0xec29c551. +// +// Solidity: function utilize(uint256 utilizeAmount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Utilize(utilizeAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Utilize(&_SDUtilityPool.TransactOpts, utilizeAmount) +} + +// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. +// +// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UtilizeWhileAddingKeys(opts *bind.TransactOpts, operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "utilizeWhileAddingKeys", operator, utilizeAmount, nonTerminalKeyCount) +} + +// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. +// +// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UtilizeWhileAddingKeys(operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UtilizeWhileAddingKeys(&_SDUtilityPool.TransactOpts, operator, utilizeAmount, nonTerminalKeyCount) +} + +// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. +// +// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UtilizeWhileAddingKeys(operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UtilizeWhileAddingKeys(&_SDUtilityPool.TransactOpts, operator, utilizeAmount, nonTerminalKeyCount) +} + +// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. +// +// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactor) UtilizerBalanceCurrent(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "utilizerBalanceCurrent", account) +} + +// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. +// +// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) UtilizerBalanceCurrent(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UtilizerBalanceCurrent(&_SDUtilityPool.TransactOpts, account) +} + +// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. +// +// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UtilizerBalanceCurrent(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UtilizerBalanceCurrent(&_SDUtilityPool.TransactOpts, account) +} + +// SDUtilityPoolAccruedFeesIterator is returned from FilterAccruedFees and is used to iterate over the raw logs and unpacked data for AccruedFees events raised by the SDUtilityPool contract. +type SDUtilityPoolAccruedFeesIterator struct { + Event *SDUtilityPoolAccruedFees // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolAccruedFeesIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolAccruedFees) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolAccruedFees) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolAccruedFeesIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolAccruedFeesIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolAccruedFees represents a AccruedFees event raised by the SDUtilityPool contract. +type SDUtilityPoolAccruedFees struct { + FeeAccumulated *big.Int + TotalProtocolFee *big.Int + TotalUtilizedSD *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterAccruedFees is a free log retrieval operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. +// +// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterAccruedFees(opts *bind.FilterOpts) (*SDUtilityPoolAccruedFeesIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "AccruedFees") + if err != nil { + return nil, err + } + return &SDUtilityPoolAccruedFeesIterator{contract: _SDUtilityPool.contract, event: "AccruedFees", logs: logs, sub: sub}, nil +} + +// WatchAccruedFees is a free log subscription operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. +// +// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchAccruedFees(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolAccruedFees) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "AccruedFees") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolAccruedFees) + if err := _SDUtilityPool.contract.UnpackLog(event, "AccruedFees", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseAccruedFees is a log parse operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. +// +// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseAccruedFees(log types.Log) (*SDUtilityPoolAccruedFees, error) { + event := new(SDUtilityPoolAccruedFees) + if err := _SDUtilityPool.contract.UnpackLog(event, "AccruedFees", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolDelegatedIterator is returned from FilterDelegated and is used to iterate over the raw logs and unpacked data for Delegated events raised by the SDUtilityPool contract. +type SDUtilityPoolDelegatedIterator struct { + Event *SDUtilityPoolDelegated // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolDelegatedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolDelegated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolDelegated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolDelegatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolDelegatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolDelegated represents a Delegated event raised by the SDUtilityPool contract. +type SDUtilityPoolDelegated struct { + Delegator common.Address + SdAmount *big.Int + SdXToMint *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterDelegated is a free log retrieval operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// +// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterDelegated(opts *bind.FilterOpts, delegator []common.Address) (*SDUtilityPoolDelegatedIterator, error) { + + var delegatorRule []interface{} + for _, delegatorItem := range delegator { + delegatorRule = append(delegatorRule, delegatorItem) + } + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Delegated", delegatorRule) + if err != nil { + return nil, err + } + return &SDUtilityPoolDelegatedIterator{contract: _SDUtilityPool.contract, event: "Delegated", logs: logs, sub: sub}, nil +} + +// WatchDelegated is a free log subscription operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// +// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchDelegated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolDelegated, delegator []common.Address) (event.Subscription, error) { + + var delegatorRule []interface{} + for _, delegatorItem := range delegator { + delegatorRule = append(delegatorRule, delegatorItem) + } + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Delegated", delegatorRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolDelegated) + if err := _SDUtilityPool.contract.UnpackLog(event, "Delegated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseDelegated is a log parse operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// +// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseDelegated(log types.Log) (*SDUtilityPoolDelegated, error) { + event := new(SDUtilityPoolDelegated) + if err := _SDUtilityPool.contract.UnpackLog(event, "Delegated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolFinalizedWithdrawRequestIterator is returned from FilterFinalizedWithdrawRequest and is used to iterate over the raw logs and unpacked data for FinalizedWithdrawRequest events raised by the SDUtilityPool contract. +type SDUtilityPoolFinalizedWithdrawRequestIterator struct { + Event *SDUtilityPoolFinalizedWithdrawRequest // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolFinalizedWithdrawRequest) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolFinalizedWithdrawRequest) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolFinalizedWithdrawRequest represents a FinalizedWithdrawRequest event raised by the SDUtilityPool contract. +type SDUtilityPoolFinalizedWithdrawRequest struct { + NextRequestIdToFinalize *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterFinalizedWithdrawRequest is a free log retrieval operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. +// +// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterFinalizedWithdrawRequest(opts *bind.FilterOpts) (*SDUtilityPoolFinalizedWithdrawRequestIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "FinalizedWithdrawRequest") + if err != nil { + return nil, err + } + return &SDUtilityPoolFinalizedWithdrawRequestIterator{contract: _SDUtilityPool.contract, event: "FinalizedWithdrawRequest", logs: logs, sub: sub}, nil +} + +// WatchFinalizedWithdrawRequest is a free log subscription operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. +// +// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchFinalizedWithdrawRequest(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolFinalizedWithdrawRequest) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "FinalizedWithdrawRequest") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolFinalizedWithdrawRequest) + if err := _SDUtilityPool.contract.UnpackLog(event, "FinalizedWithdrawRequest", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseFinalizedWithdrawRequest is a log parse operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. +// +// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseFinalizedWithdrawRequest(log types.Log) (*SDUtilityPoolFinalizedWithdrawRequest, error) { + event := new(SDUtilityPoolFinalizedWithdrawRequest) + if err := _SDUtilityPool.contract.UnpackLog(event, "FinalizedWithdrawRequest", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolProtocolFeeFactorUpdatedIterator is returned from FilterProtocolFeeFactorUpdated and is used to iterate over the raw logs and unpacked data for ProtocolFeeFactorUpdated events raised by the SDUtilityPool contract. +type SDUtilityPoolProtocolFeeFactorUpdatedIterator struct { + Event *SDUtilityPoolProtocolFeeFactorUpdated // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolProtocolFeeFactorUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolProtocolFeeFactorUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolProtocolFeeFactorUpdated represents a ProtocolFeeFactorUpdated event raised by the SDUtilityPool contract. +type SDUtilityPoolProtocolFeeFactorUpdated struct { + ProtocolFeeFactor *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterProtocolFeeFactorUpdated is a free log retrieval operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. +// +// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterProtocolFeeFactorUpdated(opts *bind.FilterOpts) (*SDUtilityPoolProtocolFeeFactorUpdatedIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "ProtocolFeeFactorUpdated") + if err != nil { + return nil, err + } + return &SDUtilityPoolProtocolFeeFactorUpdatedIterator{contract: _SDUtilityPool.contract, event: "ProtocolFeeFactorUpdated", logs: logs, sub: sub}, nil +} + +// WatchProtocolFeeFactorUpdated is a free log subscription operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. +// +// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchProtocolFeeFactorUpdated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolProtocolFeeFactorUpdated) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "ProtocolFeeFactorUpdated") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolProtocolFeeFactorUpdated) + if err := _SDUtilityPool.contract.UnpackLog(event, "ProtocolFeeFactorUpdated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseProtocolFeeFactorUpdated is a log parse operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. +// +// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseProtocolFeeFactorUpdated(log types.Log) (*SDUtilityPoolProtocolFeeFactorUpdated, error) { + event := new(SDUtilityPoolProtocolFeeFactorUpdated) + if err := _SDUtilityPool.contract.UnpackLog(event, "ProtocolFeeFactorUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolRedeemedIterator is returned from FilterRedeemed and is used to iterate over the raw logs and unpacked data for Redeemed events raised by the SDUtilityPool contract. +type SDUtilityPoolRedeemedIterator struct { + Event *SDUtilityPoolRedeemed // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolRedeemedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolRedeemed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolRedeemed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolRedeemedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolRedeemedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolRedeemed represents a Redeemed event raised by the SDUtilityPool contract. +type SDUtilityPoolRedeemed struct { + Delegator common.Address + SdAmount *big.Int + SdXAmount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRedeemed is a free log retrieval operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. +// +// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRedeemed(opts *bind.FilterOpts, delegator []common.Address) (*SDUtilityPoolRedeemedIterator, error) { + + var delegatorRule []interface{} + for _, delegatorItem := range delegator { + delegatorRule = append(delegatorRule, delegatorItem) + } + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Redeemed", delegatorRule) + if err != nil { + return nil, err + } + return &SDUtilityPoolRedeemedIterator{contract: _SDUtilityPool.contract, event: "Redeemed", logs: logs, sub: sub}, nil +} + +// WatchRedeemed is a free log subscription operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. +// +// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRedeemed(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRedeemed, delegator []common.Address) (event.Subscription, error) { + + var delegatorRule []interface{} + for _, delegatorItem := range delegator { + delegatorRule = append(delegatorRule, delegatorItem) + } + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Redeemed", delegatorRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolRedeemed) + if err := _SDUtilityPool.contract.UnpackLog(event, "Redeemed", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseRedeemed is a log parse operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. +// +// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRedeemed(log types.Log) (*SDUtilityPoolRedeemed, error) { + event := new(SDUtilityPoolRedeemed) + if err := _SDUtilityPool.contract.UnpackLog(event, "Redeemed", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolRepaidIterator is returned from FilterRepaid and is used to iterate over the raw logs and unpacked data for Repaid events raised by the SDUtilityPool contract. +type SDUtilityPoolRepaidIterator struct { + Event *SDUtilityPoolRepaid // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolRepaidIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolRepaid) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolRepaid) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolRepaidIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolRepaidIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolRepaid represents a Repaid event raised by the SDUtilityPool contract. +type SDUtilityPoolRepaid struct { + Utilizer common.Address + RepayAmount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRepaid is a free log retrieval operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. +// +// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRepaid(opts *bind.FilterOpts, utilizer []common.Address) (*SDUtilityPoolRepaidIterator, error) { + + var utilizerRule []interface{} + for _, utilizerItem := range utilizer { + utilizerRule = append(utilizerRule, utilizerItem) + } + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Repaid", utilizerRule) + if err != nil { + return nil, err + } + return &SDUtilityPoolRepaidIterator{contract: _SDUtilityPool.contract, event: "Repaid", logs: logs, sub: sub}, nil +} + +// WatchRepaid is a free log subscription operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. +// +// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRepaid(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRepaid, utilizer []common.Address) (event.Subscription, error) { + + var utilizerRule []interface{} + for _, utilizerItem := range utilizer { + utilizerRule = append(utilizerRule, utilizerItem) + } + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Repaid", utilizerRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolRepaid) + if err := _SDUtilityPool.contract.UnpackLog(event, "Repaid", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseRepaid is a log parse operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. +// +// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRepaid(log types.Log) (*SDUtilityPoolRepaid, error) { + event := new(SDUtilityPoolRepaid) + if err := _SDUtilityPool.contract.UnpackLog(event, "Repaid", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolRequestRedeemedIterator is returned from FilterRequestRedeemed and is used to iterate over the raw logs and unpacked data for RequestRedeemed events raised by the SDUtilityPool contract. +type SDUtilityPoolRequestRedeemedIterator struct { + Event *SDUtilityPoolRequestRedeemed // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolRequestRedeemed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolRequestRedeemed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolRequestRedeemedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolRequestRedeemedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolRequestRedeemed represents a RequestRedeemed event raised by the SDUtilityPool contract. +type SDUtilityPoolRequestRedeemed struct { + Caller common.Address + SdToTransfer *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRequestRedeemed is a free log retrieval operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. +// +// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRequestRedeemed(opts *bind.FilterOpts) (*SDUtilityPoolRequestRedeemedIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RequestRedeemed") + if err != nil { + return nil, err + } + return &SDUtilityPoolRequestRedeemedIterator{contract: _SDUtilityPool.contract, event: "RequestRedeemed", logs: logs, sub: sub}, nil +} + +// WatchRequestRedeemed is a free log subscription operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. +// +// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRequestRedeemed(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRequestRedeemed) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RequestRedeemed") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolRequestRedeemed) + if err := _SDUtilityPool.contract.UnpackLog(event, "RequestRedeemed", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseRequestRedeemed is a log parse operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. +// +// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRequestRedeemed(log types.Log) (*SDUtilityPoolRequestRedeemed, error) { + event := new(SDUtilityPoolRequestRedeemed) + if err := _SDUtilityPool.contract.UnpackLog(event, "RequestRedeemed", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolSDUtilizedIterator is returned from FilterSDUtilized and is used to iterate over the raw logs and unpacked data for SDUtilized events raised by the SDUtilityPool contract. +type SDUtilityPoolSDUtilizedIterator struct { + Event *SDUtilityPoolSDUtilized // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolSDUtilized) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolSDUtilized) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolSDUtilizedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolSDUtilizedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolSDUtilized represents a SDUtilized event raised by the SDUtilityPool contract. +type SDUtilityPoolSDUtilized struct { + Utilizer common.Address + UtilizeAmount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterSDUtilized is a free log retrieval operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. +// +// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterSDUtilized(opts *bind.FilterOpts) (*SDUtilityPoolSDUtilizedIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "SDUtilized") + if err != nil { + return nil, err + } + return &SDUtilityPoolSDUtilizedIterator{contract: _SDUtilityPool.contract, event: "SDUtilized", logs: logs, sub: sub}, nil +} + +// WatchSDUtilized is a free log subscription operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. +// +// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchSDUtilized(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolSDUtilized) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "SDUtilized") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolSDUtilized) + if err := _SDUtilityPool.contract.UnpackLog(event, "SDUtilized", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseSDUtilized is a log parse operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. +// +// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseSDUtilized(log types.Log) (*SDUtilityPoolSDUtilized, error) { + event := new(SDUtilityPoolSDUtilized) + if err := _SDUtilityPool.contract.UnpackLog(event, "SDUtilized", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolUpdatedFinalizationBatchLimitIterator is returned from FilterUpdatedFinalizationBatchLimit and is used to iterate over the raw logs and unpacked data for UpdatedFinalizationBatchLimit events raised by the SDUtilityPool contract. +type SDUtilityPoolUpdatedFinalizationBatchLimitIterator struct { + Event *SDUtilityPoolUpdatedFinalizationBatchLimit // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolUpdatedFinalizationBatchLimitIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolUpdatedFinalizationBatchLimit) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolUpdatedFinalizationBatchLimit) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolUpdatedFinalizationBatchLimitIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolUpdatedFinalizationBatchLimitIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolUpdatedFinalizationBatchLimit represents a UpdatedFinalizationBatchLimit event raised by the SDUtilityPool contract. +type SDUtilityPoolUpdatedFinalizationBatchLimit struct { + FinalizationBatchLimit *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUpdatedFinalizationBatchLimit is a free log retrieval operation binding the contract event 0x7ffbe87ac4b7820fd4ca4ac8c7c7820cc79c7cdd9631ac083c06bb833be63587. +// +// Solidity: event UpdatedFinalizationBatchLimit(uint256 finalizationBatchLimit) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterUpdatedFinalizationBatchLimit(opts *bind.FilterOpts) (*SDUtilityPoolUpdatedFinalizationBatchLimitIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "UpdatedFinalizationBatchLimit") + if err != nil { + return nil, err + } + return &SDUtilityPoolUpdatedFinalizationBatchLimitIterator{contract: _SDUtilityPool.contract, event: "UpdatedFinalizationBatchLimit", logs: logs, sub: sub}, nil +} + +// WatchUpdatedFinalizationBatchLimit is a free log subscription operation binding the contract event 0x7ffbe87ac4b7820fd4ca4ac8c7c7820cc79c7cdd9631ac083c06bb833be63587. +// +// Solidity: event UpdatedFinalizationBatchLimit(uint256 finalizationBatchLimit) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchUpdatedFinalizationBatchLimit(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolUpdatedFinalizationBatchLimit) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "UpdatedFinalizationBatchLimit") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolUpdatedFinalizationBatchLimit) + if err := _SDUtilityPool.contract.UnpackLog(event, "UpdatedFinalizationBatchLimit", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUpdatedFinalizationBatchLimit is a log parse operation binding the contract event 0x7ffbe87ac4b7820fd4ca4ac8c7c7820cc79c7cdd9631ac083c06bb833be63587. +// +// Solidity: event UpdatedFinalizationBatchLimit(uint256 finalizationBatchLimit) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseUpdatedFinalizationBatchLimit(log types.Log) (*SDUtilityPoolUpdatedFinalizationBatchLimit, error) { + event := new(SDUtilityPoolUpdatedFinalizationBatchLimit) + if err := _SDUtilityPool.contract.UnpackLog(event, "UpdatedFinalizationBatchLimit", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolUpdatedMaxETHWorthOfSDPerValidatorIterator is returned from FilterUpdatedMaxETHWorthOfSDPerValidator and is used to iterate over the raw logs and unpacked data for UpdatedMaxETHWorthOfSDPerValidator events raised by the SDUtilityPool contract. +type SDUtilityPoolUpdatedMaxETHWorthOfSDPerValidatorIterator struct { + Event *SDUtilityPoolUpdatedMaxETHWorthOfSDPerValidator // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolUpdatedMaxETHWorthOfSDPerValidatorIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolUpdatedMaxETHWorthOfSDPerValidator) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolUpdatedMaxETHWorthOfSDPerValidator) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolUpdatedMaxETHWorthOfSDPerValidatorIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolUpdatedMaxETHWorthOfSDPerValidatorIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolUpdatedMaxETHWorthOfSDPerValidator represents a UpdatedMaxETHWorthOfSDPerValidator event raised by the SDUtilityPool contract. +type SDUtilityPoolUpdatedMaxETHWorthOfSDPerValidator struct { + MaxETHWorthOfSDPerValidator *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUpdatedMaxETHWorthOfSDPerValidator is a free log retrieval operation binding the contract event 0x9491876f555a700a2938143a5a27937708ab194a6f8d94cd7eb8eefae92f34f5. +// +// Solidity: event UpdatedMaxETHWorthOfSDPerValidator(uint256 maxETHWorthOfSDPerValidator) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterUpdatedMaxETHWorthOfSDPerValidator(opts *bind.FilterOpts) (*SDUtilityPoolUpdatedMaxETHWorthOfSDPerValidatorIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "UpdatedMaxETHWorthOfSDPerValidator") + if err != nil { + return nil, err + } + return &SDUtilityPoolUpdatedMaxETHWorthOfSDPerValidatorIterator{contract: _SDUtilityPool.contract, event: "UpdatedMaxETHWorthOfSDPerValidator", logs: logs, sub: sub}, nil +} + +// WatchUpdatedMaxETHWorthOfSDPerValidator is a free log subscription operation binding the contract event 0x9491876f555a700a2938143a5a27937708ab194a6f8d94cd7eb8eefae92f34f5. +// +// Solidity: event UpdatedMaxETHWorthOfSDPerValidator(uint256 maxETHWorthOfSDPerValidator) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchUpdatedMaxETHWorthOfSDPerValidator(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolUpdatedMaxETHWorthOfSDPerValidator) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "UpdatedMaxETHWorthOfSDPerValidator") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolUpdatedMaxETHWorthOfSDPerValidator) + if err := _SDUtilityPool.contract.UnpackLog(event, "UpdatedMaxETHWorthOfSDPerValidator", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUpdatedMaxETHWorthOfSDPerValidator is a log parse operation binding the contract event 0x9491876f555a700a2938143a5a27937708ab194a6f8d94cd7eb8eefae92f34f5. +// +// Solidity: event UpdatedMaxETHWorthOfSDPerValidator(uint256 maxETHWorthOfSDPerValidator) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseUpdatedMaxETHWorthOfSDPerValidator(log types.Log) (*SDUtilityPoolUpdatedMaxETHWorthOfSDPerValidator, error) { + event := new(SDUtilityPoolUpdatedMaxETHWorthOfSDPerValidator) + if err := _SDUtilityPool.contract.UnpackLog(event, "UpdatedMaxETHWorthOfSDPerValidator", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolUpdatedMaxNonRedeemedDelegatorRequestCountIterator is returned from FilterUpdatedMaxNonRedeemedDelegatorRequestCount and is used to iterate over the raw logs and unpacked data for UpdatedMaxNonRedeemedDelegatorRequestCount events raised by the SDUtilityPool contract. +type SDUtilityPoolUpdatedMaxNonRedeemedDelegatorRequestCountIterator struct { + Event *SDUtilityPoolUpdatedMaxNonRedeemedDelegatorRequestCount // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolUpdatedMaxNonRedeemedDelegatorRequestCountIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolUpdatedMaxNonRedeemedDelegatorRequestCount) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolUpdatedMaxNonRedeemedDelegatorRequestCount) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolUpdatedMaxNonRedeemedDelegatorRequestCountIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolUpdatedMaxNonRedeemedDelegatorRequestCountIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolUpdatedMaxNonRedeemedDelegatorRequestCount represents a UpdatedMaxNonRedeemedDelegatorRequestCount event raised by the SDUtilityPool contract. +type SDUtilityPoolUpdatedMaxNonRedeemedDelegatorRequestCount struct { + Count *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUpdatedMaxNonRedeemedDelegatorRequestCount is a free log retrieval operation binding the contract event 0x620864df809b46dfaffcfb35289f5efd1abd7c309562a0bdb89ee19903b2ed10. +// +// Solidity: event UpdatedMaxNonRedeemedDelegatorRequestCount(uint256 count) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterUpdatedMaxNonRedeemedDelegatorRequestCount(opts *bind.FilterOpts) (*SDUtilityPoolUpdatedMaxNonRedeemedDelegatorRequestCountIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "UpdatedMaxNonRedeemedDelegatorRequestCount") + if err != nil { + return nil, err + } + return &SDUtilityPoolUpdatedMaxNonRedeemedDelegatorRequestCountIterator{contract: _SDUtilityPool.contract, event: "UpdatedMaxNonRedeemedDelegatorRequestCount", logs: logs, sub: sub}, nil +} + +// WatchUpdatedMaxNonRedeemedDelegatorRequestCount is a free log subscription operation binding the contract event 0x620864df809b46dfaffcfb35289f5efd1abd7c309562a0bdb89ee19903b2ed10. +// +// Solidity: event UpdatedMaxNonRedeemedDelegatorRequestCount(uint256 count) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchUpdatedMaxNonRedeemedDelegatorRequestCount(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolUpdatedMaxNonRedeemedDelegatorRequestCount) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "UpdatedMaxNonRedeemedDelegatorRequestCount") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolUpdatedMaxNonRedeemedDelegatorRequestCount) + if err := _SDUtilityPool.contract.UnpackLog(event, "UpdatedMaxNonRedeemedDelegatorRequestCount", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUpdatedMaxNonRedeemedDelegatorRequestCount is a log parse operation binding the contract event 0x620864df809b46dfaffcfb35289f5efd1abd7c309562a0bdb89ee19903b2ed10. +// +// Solidity: event UpdatedMaxNonRedeemedDelegatorRequestCount(uint256 count) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseUpdatedMaxNonRedeemedDelegatorRequestCount(log types.Log) (*SDUtilityPoolUpdatedMaxNonRedeemedDelegatorRequestCount, error) { + event := new(SDUtilityPoolUpdatedMaxNonRedeemedDelegatorRequestCount) + if err := _SDUtilityPool.contract.UnpackLog(event, "UpdatedMaxNonRedeemedDelegatorRequestCount", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolUpdatedMinBlockDelayToFinalizeRequestIterator is returned from FilterUpdatedMinBlockDelayToFinalizeRequest and is used to iterate over the raw logs and unpacked data for UpdatedMinBlockDelayToFinalizeRequest events raised by the SDUtilityPool contract. +type SDUtilityPoolUpdatedMinBlockDelayToFinalizeRequestIterator struct { + Event *SDUtilityPoolUpdatedMinBlockDelayToFinalizeRequest // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolUpdatedMinBlockDelayToFinalizeRequestIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolUpdatedMinBlockDelayToFinalizeRequest) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolUpdatedMinBlockDelayToFinalizeRequest) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolUpdatedMinBlockDelayToFinalizeRequestIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolUpdatedMinBlockDelayToFinalizeRequestIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolUpdatedMinBlockDelayToFinalizeRequest represents a UpdatedMinBlockDelayToFinalizeRequest event raised by the SDUtilityPool contract. +type SDUtilityPoolUpdatedMinBlockDelayToFinalizeRequest struct { + MinBlockDelayToFinalizeRequest *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUpdatedMinBlockDelayToFinalizeRequest is a free log retrieval operation binding the contract event 0xaa3bf534da453100a74c0c499340ebed87ce7f16483706a8b1e5ca11b9982789. +// +// Solidity: event UpdatedMinBlockDelayToFinalizeRequest(uint256 minBlockDelayToFinalizeRequest) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterUpdatedMinBlockDelayToFinalizeRequest(opts *bind.FilterOpts) (*SDUtilityPoolUpdatedMinBlockDelayToFinalizeRequestIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "UpdatedMinBlockDelayToFinalizeRequest") + if err != nil { + return nil, err + } + return &SDUtilityPoolUpdatedMinBlockDelayToFinalizeRequestIterator{contract: _SDUtilityPool.contract, event: "UpdatedMinBlockDelayToFinalizeRequest", logs: logs, sub: sub}, nil +} + +// WatchUpdatedMinBlockDelayToFinalizeRequest is a free log subscription operation binding the contract event 0xaa3bf534da453100a74c0c499340ebed87ce7f16483706a8b1e5ca11b9982789. +// +// Solidity: event UpdatedMinBlockDelayToFinalizeRequest(uint256 minBlockDelayToFinalizeRequest) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchUpdatedMinBlockDelayToFinalizeRequest(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolUpdatedMinBlockDelayToFinalizeRequest) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "UpdatedMinBlockDelayToFinalizeRequest") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolUpdatedMinBlockDelayToFinalizeRequest) + if err := _SDUtilityPool.contract.UnpackLog(event, "UpdatedMinBlockDelayToFinalizeRequest", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUpdatedMinBlockDelayToFinalizeRequest is a log parse operation binding the contract event 0xaa3bf534da453100a74c0c499340ebed87ce7f16483706a8b1e5ca11b9982789. +// +// Solidity: event UpdatedMinBlockDelayToFinalizeRequest(uint256 minBlockDelayToFinalizeRequest) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseUpdatedMinBlockDelayToFinalizeRequest(log types.Log) (*SDUtilityPoolUpdatedMinBlockDelayToFinalizeRequest, error) { + event := new(SDUtilityPoolUpdatedMinBlockDelayToFinalizeRequest) + if err := _SDUtilityPool.contract.UnpackLog(event, "UpdatedMinBlockDelayToFinalizeRequest", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolUpdatedStaderConfigIterator is returned from FilterUpdatedStaderConfig and is used to iterate over the raw logs and unpacked data for UpdatedStaderConfig events raised by the SDUtilityPool contract. +type SDUtilityPoolUpdatedStaderConfigIterator struct { + Event *SDUtilityPoolUpdatedStaderConfig // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolUpdatedStaderConfigIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolUpdatedStaderConfig) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolUpdatedStaderConfig) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolUpdatedStaderConfigIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolUpdatedStaderConfigIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolUpdatedStaderConfig represents a UpdatedStaderConfig event raised by the SDUtilityPool contract. +type SDUtilityPoolUpdatedStaderConfig struct { + StaderConfig common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUpdatedStaderConfig is a free log retrieval operation binding the contract event 0xdb2219043d7b197cb235f1af0cf6d782d77dee3de19e3f4fb6d39aae633b4485. +// +// Solidity: event UpdatedStaderConfig(address indexed _staderConfig) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterUpdatedStaderConfig(opts *bind.FilterOpts, _staderConfig []common.Address) (*SDUtilityPoolUpdatedStaderConfigIterator, error) { + + var _staderConfigRule []interface{} + for _, _staderConfigItem := range _staderConfig { + _staderConfigRule = append(_staderConfigRule, _staderConfigItem) + } + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "UpdatedStaderConfig", _staderConfigRule) + if err != nil { + return nil, err + } + return &SDUtilityPoolUpdatedStaderConfigIterator{contract: _SDUtilityPool.contract, event: "UpdatedStaderConfig", logs: logs, sub: sub}, nil +} + +// WatchUpdatedStaderConfig is a free log subscription operation binding the contract event 0xdb2219043d7b197cb235f1af0cf6d782d77dee3de19e3f4fb6d39aae633b4485. +// +// Solidity: event UpdatedStaderConfig(address indexed _staderConfig) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchUpdatedStaderConfig(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolUpdatedStaderConfig, _staderConfig []common.Address) (event.Subscription, error) { + + var _staderConfigRule []interface{} + for _, _staderConfigItem := range _staderConfig { + _staderConfigRule = append(_staderConfigRule, _staderConfigItem) + } + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "UpdatedStaderConfig", _staderConfigRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolUpdatedStaderConfig) + if err := _SDUtilityPool.contract.UnpackLog(event, "UpdatedStaderConfig", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUpdatedStaderConfig is a log parse operation binding the contract event 0xdb2219043d7b197cb235f1af0cf6d782d77dee3de19e3f4fb6d39aae633b4485. +// +// Solidity: event UpdatedStaderConfig(address indexed _staderConfig) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseUpdatedStaderConfig(log types.Log) (*SDUtilityPoolUpdatedStaderConfig, error) { + event := new(SDUtilityPoolUpdatedStaderConfig) + if err := _SDUtilityPool.contract.UnpackLog(event, "UpdatedStaderConfig", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolUpdatedUndelegationPeriodInBlocksIterator is returned from FilterUpdatedUndelegationPeriodInBlocks and is used to iterate over the raw logs and unpacked data for UpdatedUndelegationPeriodInBlocks events raised by the SDUtilityPool contract. +type SDUtilityPoolUpdatedUndelegationPeriodInBlocksIterator struct { + Event *SDUtilityPoolUpdatedUndelegationPeriodInBlocks // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolUpdatedUndelegationPeriodInBlocksIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolUpdatedUndelegationPeriodInBlocks) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolUpdatedUndelegationPeriodInBlocks) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolUpdatedUndelegationPeriodInBlocksIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolUpdatedUndelegationPeriodInBlocksIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolUpdatedUndelegationPeriodInBlocks represents a UpdatedUndelegationPeriodInBlocks event raised by the SDUtilityPool contract. +type SDUtilityPoolUpdatedUndelegationPeriodInBlocks struct { + UndelegationPeriodInBlocks *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUpdatedUndelegationPeriodInBlocks is a free log retrieval operation binding the contract event 0x727294fbc7a5976b29da226c439fc4cf0ec4f6a81a2d36e157af8667819aa7ac. +// +// Solidity: event UpdatedUndelegationPeriodInBlocks(uint256 undelegationPeriodInBlocks) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterUpdatedUndelegationPeriodInBlocks(opts *bind.FilterOpts) (*SDUtilityPoolUpdatedUndelegationPeriodInBlocksIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "UpdatedUndelegationPeriodInBlocks") + if err != nil { + return nil, err + } + return &SDUtilityPoolUpdatedUndelegationPeriodInBlocksIterator{contract: _SDUtilityPool.contract, event: "UpdatedUndelegationPeriodInBlocks", logs: logs, sub: sub}, nil +} + +// WatchUpdatedUndelegationPeriodInBlocks is a free log subscription operation binding the contract event 0x727294fbc7a5976b29da226c439fc4cf0ec4f6a81a2d36e157af8667819aa7ac. +// +// Solidity: event UpdatedUndelegationPeriodInBlocks(uint256 undelegationPeriodInBlocks) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchUpdatedUndelegationPeriodInBlocks(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolUpdatedUndelegationPeriodInBlocks) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "UpdatedUndelegationPeriodInBlocks") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolUpdatedUndelegationPeriodInBlocks) + if err := _SDUtilityPool.contract.UnpackLog(event, "UpdatedUndelegationPeriodInBlocks", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUpdatedUndelegationPeriodInBlocks is a log parse operation binding the contract event 0x727294fbc7a5976b29da226c439fc4cf0ec4f6a81a2d36e157af8667819aa7ac. +// +// Solidity: event UpdatedUndelegationPeriodInBlocks(uint256 undelegationPeriodInBlocks) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseUpdatedUndelegationPeriodInBlocks(log types.Log) (*SDUtilityPoolUpdatedUndelegationPeriodInBlocks, error) { + event := new(SDUtilityPoolUpdatedUndelegationPeriodInBlocks) + if err := _SDUtilityPool.contract.UnpackLog(event, "UpdatedUndelegationPeriodInBlocks", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolUtilizationRatePerBlockUpdatedIterator is returned from FilterUtilizationRatePerBlockUpdated and is used to iterate over the raw logs and unpacked data for UtilizationRatePerBlockUpdated events raised by the SDUtilityPool contract. +type SDUtilityPoolUtilizationRatePerBlockUpdatedIterator struct { + Event *SDUtilityPoolUtilizationRatePerBlockUpdated // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolUtilizationRatePerBlockUpdatedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolUtilizationRatePerBlockUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolUtilizationRatePerBlockUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolUtilizationRatePerBlockUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolUtilizationRatePerBlockUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolUtilizationRatePerBlockUpdated represents a UtilizationRatePerBlockUpdated event raised by the SDUtilityPool contract. +type SDUtilityPoolUtilizationRatePerBlockUpdated struct { + UtilizationRatePerBlock *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUtilizationRatePerBlockUpdated is a free log retrieval operation binding the contract event 0x3d9659ac5decde6b265b661cde27cd4a357992c35cfa014eb789ad7cbe89ff8b. +// +// Solidity: event UtilizationRatePerBlockUpdated(uint256 utilizationRatePerBlock) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterUtilizationRatePerBlockUpdated(opts *bind.FilterOpts) (*SDUtilityPoolUtilizationRatePerBlockUpdatedIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "UtilizationRatePerBlockUpdated") + if err != nil { + return nil, err + } + return &SDUtilityPoolUtilizationRatePerBlockUpdatedIterator{contract: _SDUtilityPool.contract, event: "UtilizationRatePerBlockUpdated", logs: logs, sub: sub}, nil +} + +// WatchUtilizationRatePerBlockUpdated is a free log subscription operation binding the contract event 0x3d9659ac5decde6b265b661cde27cd4a357992c35cfa014eb789ad7cbe89ff8b. +// +// Solidity: event UtilizationRatePerBlockUpdated(uint256 utilizationRatePerBlock) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchUtilizationRatePerBlockUpdated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolUtilizationRatePerBlockUpdated) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "UtilizationRatePerBlockUpdated") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolUtilizationRatePerBlockUpdated) + if err := _SDUtilityPool.contract.UnpackLog(event, "UtilizationRatePerBlockUpdated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUtilizationRatePerBlockUpdated is a log parse operation binding the contract event 0x3d9659ac5decde6b265b661cde27cd4a357992c35cfa014eb789ad7cbe89ff8b. +// +// Solidity: event UtilizationRatePerBlockUpdated(uint256 utilizationRatePerBlock) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseUtilizationRatePerBlockUpdated(log types.Log) (*SDUtilityPoolUtilizationRatePerBlockUpdated, error) { + event := new(SDUtilityPoolUtilizationRatePerBlockUpdated) + if err := _SDUtilityPool.contract.UnpackLog(event, "UtilizationRatePerBlockUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolUtilizerSDSlashingHandledIterator is returned from FilterUtilizerSDSlashingHandled and is used to iterate over the raw logs and unpacked data for UtilizerSDSlashingHandled events raised by the SDUtilityPool contract. +type SDUtilityPoolUtilizerSDSlashingHandledIterator struct { + Event *SDUtilityPoolUtilizerSDSlashingHandled // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolUtilizerSDSlashingHandledIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolUtilizerSDSlashingHandled) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolUtilizerSDSlashingHandled) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolUtilizerSDSlashingHandledIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolUtilizerSDSlashingHandledIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolUtilizerSDSlashingHandled represents a UtilizerSDSlashingHandled event raised by the SDUtilityPool contract. +type SDUtilityPoolUtilizerSDSlashingHandled struct { + Utilizer common.Address + SlashSDAmount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUtilizerSDSlashingHandled is a free log retrieval operation binding the contract event 0xf583a13dc98ab9935d418df5efc1b6e0b3b4f642ccc3a8601aec4646e965dc0b. +// +// Solidity: event UtilizerSDSlashingHandled(address utilizer, uint256 slashSDAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterUtilizerSDSlashingHandled(opts *bind.FilterOpts) (*SDUtilityPoolUtilizerSDSlashingHandledIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "UtilizerSDSlashingHandled") + if err != nil { + return nil, err + } + return &SDUtilityPoolUtilizerSDSlashingHandledIterator{contract: _SDUtilityPool.contract, event: "UtilizerSDSlashingHandled", logs: logs, sub: sub}, nil +} + +// WatchUtilizerSDSlashingHandled is a free log subscription operation binding the contract event 0xf583a13dc98ab9935d418df5efc1b6e0b3b4f642ccc3a8601aec4646e965dc0b. +// +// Solidity: event UtilizerSDSlashingHandled(address utilizer, uint256 slashSDAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchUtilizerSDSlashingHandled(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolUtilizerSDSlashingHandled) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "UtilizerSDSlashingHandled") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolUtilizerSDSlashingHandled) + if err := _SDUtilityPool.contract.UnpackLog(event, "UtilizerSDSlashingHandled", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUtilizerSDSlashingHandled is a log parse operation binding the contract event 0xf583a13dc98ab9935d418df5efc1b6e0b3b4f642ccc3a8601aec4646e965dc0b. +// +// Solidity: event UtilizerSDSlashingHandled(address utilizer, uint256 slashSDAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseUtilizerSDSlashingHandled(log types.Log) (*SDUtilityPoolUtilizerSDSlashingHandled, error) { + event := new(SDUtilityPoolUtilizerSDSlashingHandled) + if err := _SDUtilityPool.contract.UnpackLog(event, "UtilizerSDSlashingHandled", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolWithdrawRequestReceivedIterator is returned from FilterWithdrawRequestReceived and is used to iterate over the raw logs and unpacked data for WithdrawRequestReceived events raised by the SDUtilityPool contract. +type SDUtilityPoolWithdrawRequestReceivedIterator struct { + Event *SDUtilityPoolWithdrawRequestReceived // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolWithdrawRequestReceivedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolWithdrawRequestReceived) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolWithdrawRequestReceived) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolWithdrawRequestReceivedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolWithdrawRequestReceivedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolWithdrawRequestReceived represents a WithdrawRequestReceived event raised by the SDUtilityPool contract. +type SDUtilityPoolWithdrawRequestReceived struct { + Caller common.Address + NextRequestId *big.Int + SdAmountToWithdraw *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterWithdrawRequestReceived is a free log retrieval operation binding the contract event 0x0edfc24f4f80277416f78f699d4733f7bb58fd6fb8838e2b1033162cee5fd7aa. +// +// Solidity: event WithdrawRequestReceived(address caller, uint256 nextRequestId, uint256 sdAmountToWithdraw) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterWithdrawRequestReceived(opts *bind.FilterOpts) (*SDUtilityPoolWithdrawRequestReceivedIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "WithdrawRequestReceived") + if err != nil { + return nil, err + } + return &SDUtilityPoolWithdrawRequestReceivedIterator{contract: _SDUtilityPool.contract, event: "WithdrawRequestReceived", logs: logs, sub: sub}, nil +} + +// WatchWithdrawRequestReceived is a free log subscription operation binding the contract event 0x0edfc24f4f80277416f78f699d4733f7bb58fd6fb8838e2b1033162cee5fd7aa. +// +// Solidity: event WithdrawRequestReceived(address caller, uint256 nextRequestId, uint256 sdAmountToWithdraw) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchWithdrawRequestReceived(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolWithdrawRequestReceived) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "WithdrawRequestReceived") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolWithdrawRequestReceived) + if err := _SDUtilityPool.contract.UnpackLog(event, "WithdrawRequestReceived", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseWithdrawRequestReceived is a log parse operation binding the contract event 0x0edfc24f4f80277416f78f699d4733f7bb58fd6fb8838e2b1033162cee5fd7aa. +// +// Solidity: event WithdrawRequestReceived(address caller, uint256 nextRequestId, uint256 sdAmountToWithdraw) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseWithdrawRequestReceived(log types.Log) (*SDUtilityPoolWithdrawRequestReceived, error) { + event := new(SDUtilityPoolWithdrawRequestReceived) + if err := _SDUtilityPool.contract.UnpackLog(event, "WithdrawRequestReceived", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/stader-lib/contracts/stader-config.go b/stader-lib/contracts/stader-config.go index 3f746740b..30488a2ed 100644 --- a/stader-lib/contracts/stader-config.go +++ b/stader-lib/contracts/stader-config.go @@ -31,7 +31,7 @@ var ( // StaderConfigMetaData contains all meta data concerning the StaderConfig contract. var StaderConfigMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidLimits\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidMaxDepositValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidMaxWithdrawValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidMinDepositValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidMinWithdrawValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"key\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAddress\",\"type\":\"address\"}],\"name\":\"SetAccount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"key\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"SetConstant\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"key\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAddress\",\"type\":\"address\"}],\"name\":\"SetContract\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"key\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAddress\",\"type\":\"address\"}],\"name\":\"SetToken\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"key\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"SetVariable\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ADMIN\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"AUCTION_CONTRACT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DECIMALS\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ETHX_SUPPLY_POR_FEED\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ETH_BALANCE_POR_FEED\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ETH_DEPOSIT_CONTRACT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ETH_PER_NODE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ETHx\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FULL_DEPOSIT_SIZE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MANAGER\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_DEPOSIT_AMOUNT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_WITHDRAW_AMOUNT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MIN_BLOCK_DELAY_TO_FINALIZE_WITHDRAW_REQUEST\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MIN_DEPOSIT_AMOUNT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MIN_WITHDRAW_AMOUNT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NODE_EL_REWARD_VAULT_IMPLEMENTATION\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"OPERATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"OPERATOR_MAX_NAME_LENGTH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"OPERATOR_REWARD_COLLECTOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PENALTY_CONTRACT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PERMISSIONED_NODE_REGISTRY\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PERMISSIONED_POOL\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PERMISSIONED_SOCIALIZING_POOL\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PERMISSIONLESS_NODE_REGISTRY\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PERMISSIONLESS_POOL\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PERMISSIONLESS_SOCIALIZING_POOL\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"POOL_SELECTOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"POOL_UTILS\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PRE_DEPOSIT_SIZE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REWARD_THRESHOLD\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SD\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SD_COLLATERAL\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SOCIALIZING_POOL_CYCLE_DURATION\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SOCIALIZING_POOL_OPT_IN_COOLING_PERIOD\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"STADER_INSURANCE_FUND\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"STADER_ORACLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"STADER_TREASURY\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"STAKE_POOL_MANAGER\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TOTAL_FEE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"USER_WITHDRAW_MANAGER\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"VALIDATOR_WITHDRAWAL_VAULT_IMPLEMENTATION\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"VAULT_FACTORY\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WITHDRAWN_KEYS_BATCH_SIZE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAuctionContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDecimals\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getETHBalancePORFeedProxy\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getETHDepositContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getETHXSupplyPORFeedProxy\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getETHxToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getFullDepositSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMaxDepositAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMaxWithdrawAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMinBlockDelayToFinalizeWithdrawRequest\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMinDepositAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMinWithdrawAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getNodeELRewardVaultImplementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getOperatorMaxNameLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getOperatorRewardsCollector\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPenaltyContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPermissionedNodeRegistry\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPermissionedPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPermissionedSocializingPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPermissionlessNodeRegistry\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPermissionlessPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPermissionlessSocializingPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPoolSelector\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPoolUtils\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPreDepositSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRewardsThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getSDCollateral\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getSocializingPoolCycleDuration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getSocializingPoolOptInCoolingPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getStaderInsuranceFund\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getStaderOracle\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getStaderToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getStaderTreasury\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getStakePoolManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getStakedEthPerNode\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getUserWithdrawManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidatorWithdrawalVaultImplementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getVaultFactory\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getWithdrawnKeyBatchSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_ethDepositContract\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"onlyManagerRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"onlyOperatorRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_contractName\",\"type\":\"bytes32\"}],\"name\":\"onlyStaderContract\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"}],\"name\":\"updateAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_auctionContract\",\"type\":\"address\"}],\"name\":\"updateAuctionContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_ethBalanceProxy\",\"type\":\"address\"}],\"name\":\"updateETHBalancePORFeedProxy\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_ethXSupplyProxy\",\"type\":\"address\"}],\"name\":\"updateETHXSupplyPORFeedProxy\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_ethX\",\"type\":\"address\"}],\"name\":\"updateETHxToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxDepositAmount\",\"type\":\"uint256\"}],\"name\":\"updateMaxDepositAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxWithdrawAmount\",\"type\":\"uint256\"}],\"name\":\"updateMaxWithdrawAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minBlockDelay\",\"type\":\"uint256\"}],\"name\":\"updateMinBlockDelayToFinalizeWithdrawRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minDepositAmount\",\"type\":\"uint256\"}],\"name\":\"updateMinDepositAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minWithdrawAmount\",\"type\":\"uint256\"}],\"name\":\"updateMinWithdrawAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_nodeELRewardVaultImpl\",\"type\":\"address\"}],\"name\":\"updateNodeELRewardImplementation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operatorRewardsCollector\",\"type\":\"address\"}],\"name\":\"updateOperatorRewardsCollector\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_penaltyContract\",\"type\":\"address\"}],\"name\":\"updatePenaltyContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_permissionedNodeRegistry\",\"type\":\"address\"}],\"name\":\"updatePermissionedNodeRegistry\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_permissionedPool\",\"type\":\"address\"}],\"name\":\"updatePermissionedPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_permissionedSocializePool\",\"type\":\"address\"}],\"name\":\"updatePermissionedSocializingPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_permissionlessNodeRegistry\",\"type\":\"address\"}],\"name\":\"updatePermissionlessNodeRegistry\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_permissionlessPool\",\"type\":\"address\"}],\"name\":\"updatePermissionlessPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_permissionlessSocializePool\",\"type\":\"address\"}],\"name\":\"updatePermissionlessSocializingPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolSelector\",\"type\":\"address\"}],\"name\":\"updatePoolSelector\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolUtils\",\"type\":\"address\"}],\"name\":\"updatePoolUtils\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_rewardsThreshold\",\"type\":\"uint256\"}],\"name\":\"updateRewardsThreshold\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_sdCollateral\",\"type\":\"address\"}],\"name\":\"updateSDCollateral\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_socializingPoolCycleDuration\",\"type\":\"uint256\"}],\"name\":\"updateSocializingPoolCycleDuration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_SocializePoolOptInCoolingPeriod\",\"type\":\"uint256\"}],\"name\":\"updateSocializingPoolOptInCoolingPeriod\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderInsuranceFund\",\"type\":\"address\"}],\"name\":\"updateStaderInsuranceFund\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderOracle\",\"type\":\"address\"}],\"name\":\"updateStaderOracle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderToken\",\"type\":\"address\"}],\"name\":\"updateStaderToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderTreasury\",\"type\":\"address\"}],\"name\":\"updateStaderTreasury\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_stakePoolManager\",\"type\":\"address\"}],\"name\":\"updateStakePoolManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_userWithdrawManager\",\"type\":\"address\"}],\"name\":\"updateUserWithdrawManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validatorWithdrawalVaultImpl\",\"type\":\"address\"}],\"name\":\"updateValidatorWithdrawalVaultImplementation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_vaultFactory\",\"type\":\"address\"}],\"name\":\"updateVaultFactory\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_withdrawnKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"updateWithdrawnKeysBatchSize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"IndenticalValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidLimits\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidMaxDepositValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidMaxWithdrawValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidMinDepositValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidMinWithdrawValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"key\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAddress\",\"type\":\"address\"}],\"name\":\"SetAccount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"key\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"SetConstant\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"key\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAddress\",\"type\":\"address\"}],\"name\":\"SetContract\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"key\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAddress\",\"type\":\"address\"}],\"name\":\"SetToken\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"key\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"SetVariable\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ADMIN\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"AUCTION_CONTRACT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DECIMALS\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ETHX_SUPPLY_POR_FEED\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ETH_BALANCE_POR_FEED\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ETH_DEPOSIT_CONTRACT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ETH_PER_NODE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ETHx\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FULL_DEPOSIT_SIZE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MANAGER\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_DEPOSIT_AMOUNT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_WITHDRAW_AMOUNT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MIN_BLOCK_DELAY_TO_FINALIZE_WITHDRAW_REQUEST\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MIN_DEPOSIT_AMOUNT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MIN_WITHDRAW_AMOUNT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NODE_EL_REWARD_VAULT_IMPLEMENTATION\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"OPERATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"OPERATOR_MAX_NAME_LENGTH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"OPERATOR_REWARD_COLLECTOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PENALTY_CONTRACT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PERMISSIONED_NODE_REGISTRY\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PERMISSIONED_POOL\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PERMISSIONED_SOCIALIZING_POOL\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PERMISSIONLESS_NODE_REGISTRY\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PERMISSIONLESS_POOL\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PERMISSIONLESS_SOCIALIZING_POOL\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"POOL_SELECTOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"POOL_UTILS\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PRE_DEPOSIT_SIZE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REWARD_THRESHOLD\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SD\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SD_COLLATERAL\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SD_INCENTIVE_CONTROLLER\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SD_UTILITY_POOL\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SOCIALIZING_POOL_CYCLE_DURATION\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SOCIALIZING_POOL_OPT_IN_COOLING_PERIOD\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"STADER_INSURANCE_FUND\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"STADER_ORACLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"STADER_TREASURY\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"STAKE_POOL_MANAGER\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TOTAL_FEE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"USER_WITHDRAW_MANAGER\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"VALIDATOR_WITHDRAWAL_VAULT_IMPLEMENTATION\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"VAULT_FACTORY\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WITHDRAWN_KEYS_BATCH_SIZE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAuctionContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDecimals\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getETHBalancePORFeedProxy\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getETHDepositContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getETHXSupplyPORFeedProxy\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getETHxToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getFullDepositSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMaxDepositAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMaxWithdrawAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMinBlockDelayToFinalizeWithdrawRequest\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMinDepositAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMinWithdrawAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getNodeELRewardVaultImplementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getOperatorMaxNameLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getOperatorRewardsCollector\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPenaltyContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPermissionedNodeRegistry\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPermissionedPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPermissionedSocializingPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPermissionlessNodeRegistry\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPermissionlessPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPermissionlessSocializingPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPoolSelector\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPoolUtils\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPreDepositSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRewardsThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getSDCollateral\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getSDIncentiveController\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getSDUtilityPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getSocializingPoolCycleDuration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getSocializingPoolOptInCoolingPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getStaderInsuranceFund\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getStaderOracle\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getStaderToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getStaderTreasury\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getStakePoolManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getStakedEthPerNode\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getUserWithdrawManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidatorWithdrawalVaultImplementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getVaultFactory\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getWithdrawnKeyBatchSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_ethDepositContract\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"onlyManagerRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"onlyOperatorRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_contractName\",\"type\":\"bytes32\"}],\"name\":\"onlyStaderContract\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"}],\"name\":\"updateAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_auctionContract\",\"type\":\"address\"}],\"name\":\"updateAuctionContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_ethBalanceProxy\",\"type\":\"address\"}],\"name\":\"updateETHBalancePORFeedProxy\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_ethXSupplyProxy\",\"type\":\"address\"}],\"name\":\"updateETHXSupplyPORFeedProxy\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_ethX\",\"type\":\"address\"}],\"name\":\"updateETHxToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxDepositAmount\",\"type\":\"uint256\"}],\"name\":\"updateMaxDepositAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxWithdrawAmount\",\"type\":\"uint256\"}],\"name\":\"updateMaxWithdrawAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minBlockDelay\",\"type\":\"uint256\"}],\"name\":\"updateMinBlockDelayToFinalizeWithdrawRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minDepositAmount\",\"type\":\"uint256\"}],\"name\":\"updateMinDepositAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minWithdrawAmount\",\"type\":\"uint256\"}],\"name\":\"updateMinWithdrawAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_nodeELRewardVaultImpl\",\"type\":\"address\"}],\"name\":\"updateNodeELRewardImplementation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operatorRewardsCollector\",\"type\":\"address\"}],\"name\":\"updateOperatorRewardsCollector\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_penaltyContract\",\"type\":\"address\"}],\"name\":\"updatePenaltyContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_permissionedNodeRegistry\",\"type\":\"address\"}],\"name\":\"updatePermissionedNodeRegistry\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_permissionedPool\",\"type\":\"address\"}],\"name\":\"updatePermissionedPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_permissionedSocializePool\",\"type\":\"address\"}],\"name\":\"updatePermissionedSocializingPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_permissionlessNodeRegistry\",\"type\":\"address\"}],\"name\":\"updatePermissionlessNodeRegistry\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_permissionlessPool\",\"type\":\"address\"}],\"name\":\"updatePermissionlessPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_permissionlessSocializePool\",\"type\":\"address\"}],\"name\":\"updatePermissionlessSocializingPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolSelector\",\"type\":\"address\"}],\"name\":\"updatePoolSelector\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolUtils\",\"type\":\"address\"}],\"name\":\"updatePoolUtils\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_rewardsThreshold\",\"type\":\"uint256\"}],\"name\":\"updateRewardsThreshold\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_sdCollateral\",\"type\":\"address\"}],\"name\":\"updateSDCollateral\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_sdIncentiveController\",\"type\":\"address\"}],\"name\":\"updateSDIncentiveController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_utilityPool\",\"type\":\"address\"}],\"name\":\"updateSDUtilityPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_socializingPoolCycleDuration\",\"type\":\"uint256\"}],\"name\":\"updateSocializingPoolCycleDuration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_SocializePoolOptInCoolingPeriod\",\"type\":\"uint256\"}],\"name\":\"updateSocializingPoolOptInCoolingPeriod\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderInsuranceFund\",\"type\":\"address\"}],\"name\":\"updateStaderInsuranceFund\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderOracle\",\"type\":\"address\"}],\"name\":\"updateStaderOracle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderToken\",\"type\":\"address\"}],\"name\":\"updateStaderToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderTreasury\",\"type\":\"address\"}],\"name\":\"updateStaderTreasury\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_stakePoolManager\",\"type\":\"address\"}],\"name\":\"updateStakePoolManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_userWithdrawManager\",\"type\":\"address\"}],\"name\":\"updateUserWithdrawManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validatorWithdrawalVaultImpl\",\"type\":\"address\"}],\"name\":\"updateValidatorWithdrawalVaultImplementation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_vaultFactory\",\"type\":\"address\"}],\"name\":\"updateVaultFactory\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_withdrawnKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"updateWithdrawnKeysBatchSize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // StaderConfigABI is the input ABI used to generate the binding from. @@ -1203,6 +1203,68 @@ func (_StaderConfig *StaderConfigCallerSession) SDCOLLATERAL() ([32]byte, error) return _StaderConfig.Contract.SDCOLLATERAL(&_StaderConfig.CallOpts) } +// SDINCENTIVECONTROLLER is a free data retrieval call binding the contract method 0xa7919400. +// +// Solidity: function SD_INCENTIVE_CONTROLLER() view returns(bytes32) +func (_StaderConfig *StaderConfigCaller) SDINCENTIVECONTROLLER(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _StaderConfig.contract.Call(opts, &out, "SD_INCENTIVE_CONTROLLER") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// SDINCENTIVECONTROLLER is a free data retrieval call binding the contract method 0xa7919400. +// +// Solidity: function SD_INCENTIVE_CONTROLLER() view returns(bytes32) +func (_StaderConfig *StaderConfigSession) SDINCENTIVECONTROLLER() ([32]byte, error) { + return _StaderConfig.Contract.SDINCENTIVECONTROLLER(&_StaderConfig.CallOpts) +} + +// SDINCENTIVECONTROLLER is a free data retrieval call binding the contract method 0xa7919400. +// +// Solidity: function SD_INCENTIVE_CONTROLLER() view returns(bytes32) +func (_StaderConfig *StaderConfigCallerSession) SDINCENTIVECONTROLLER() ([32]byte, error) { + return _StaderConfig.Contract.SDINCENTIVECONTROLLER(&_StaderConfig.CallOpts) +} + +// SDUTILITYPOOL is a free data retrieval call binding the contract method 0xc58b4a92. +// +// Solidity: function SD_UTILITY_POOL() view returns(bytes32) +func (_StaderConfig *StaderConfigCaller) SDUTILITYPOOL(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _StaderConfig.contract.Call(opts, &out, "SD_UTILITY_POOL") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// SDUTILITYPOOL is a free data retrieval call binding the contract method 0xc58b4a92. +// +// Solidity: function SD_UTILITY_POOL() view returns(bytes32) +func (_StaderConfig *StaderConfigSession) SDUTILITYPOOL() ([32]byte, error) { + return _StaderConfig.Contract.SDUTILITYPOOL(&_StaderConfig.CallOpts) +} + +// SDUTILITYPOOL is a free data retrieval call binding the contract method 0xc58b4a92. +// +// Solidity: function SD_UTILITY_POOL() view returns(bytes32) +func (_StaderConfig *StaderConfigCallerSession) SDUTILITYPOOL() ([32]byte, error) { + return _StaderConfig.Contract.SDUTILITYPOOL(&_StaderConfig.CallOpts) +} + // SOCIALIZINGPOOLCYCLEDURATION is a free data retrieval call binding the contract method 0xbedcb34c. // // Solidity: function SOCIALIZING_POOL_CYCLE_DURATION() view returns(bytes32) @@ -2443,6 +2505,68 @@ func (_StaderConfig *StaderConfigCallerSession) GetSDCollateral() (common.Addres return _StaderConfig.Contract.GetSDCollateral(&_StaderConfig.CallOpts) } +// GetSDIncentiveController is a free data retrieval call binding the contract method 0xa9fe1b33. +// +// Solidity: function getSDIncentiveController() view returns(address) +func (_StaderConfig *StaderConfigCaller) GetSDIncentiveController(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _StaderConfig.contract.Call(opts, &out, "getSDIncentiveController") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetSDIncentiveController is a free data retrieval call binding the contract method 0xa9fe1b33. +// +// Solidity: function getSDIncentiveController() view returns(address) +func (_StaderConfig *StaderConfigSession) GetSDIncentiveController() (common.Address, error) { + return _StaderConfig.Contract.GetSDIncentiveController(&_StaderConfig.CallOpts) +} + +// GetSDIncentiveController is a free data retrieval call binding the contract method 0xa9fe1b33. +// +// Solidity: function getSDIncentiveController() view returns(address) +func (_StaderConfig *StaderConfigCallerSession) GetSDIncentiveController() (common.Address, error) { + return _StaderConfig.Contract.GetSDIncentiveController(&_StaderConfig.CallOpts) +} + +// GetSDUtilityPool is a free data retrieval call binding the contract method 0xf0056918. +// +// Solidity: function getSDUtilityPool() view returns(address) +func (_StaderConfig *StaderConfigCaller) GetSDUtilityPool(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _StaderConfig.contract.Call(opts, &out, "getSDUtilityPool") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetSDUtilityPool is a free data retrieval call binding the contract method 0xf0056918. +// +// Solidity: function getSDUtilityPool() view returns(address) +func (_StaderConfig *StaderConfigSession) GetSDUtilityPool() (common.Address, error) { + return _StaderConfig.Contract.GetSDUtilityPool(&_StaderConfig.CallOpts) +} + +// GetSDUtilityPool is a free data retrieval call binding the contract method 0xf0056918. +// +// Solidity: function getSDUtilityPool() view returns(address) +func (_StaderConfig *StaderConfigCallerSession) GetSDUtilityPool() (common.Address, error) { + return _StaderConfig.Contract.GetSDUtilityPool(&_StaderConfig.CallOpts) +} + // GetSocializingPoolCycleDuration is a free data retrieval call binding the contract method 0x1ca197a5. // // Solidity: function getSocializingPoolCycleDuration() view returns(uint256) @@ -3568,6 +3692,48 @@ func (_StaderConfig *StaderConfigTransactorSession) UpdateSDCollateral(_sdCollat return _StaderConfig.Contract.UpdateSDCollateral(&_StaderConfig.TransactOpts, _sdCollateral) } +// UpdateSDIncentiveController is a paid mutator transaction binding the contract method 0x7b5c8e60. +// +// Solidity: function updateSDIncentiveController(address _sdIncentiveController) returns() +func (_StaderConfig *StaderConfigTransactor) UpdateSDIncentiveController(opts *bind.TransactOpts, _sdIncentiveController common.Address) (*types.Transaction, error) { + return _StaderConfig.contract.Transact(opts, "updateSDIncentiveController", _sdIncentiveController) +} + +// UpdateSDIncentiveController is a paid mutator transaction binding the contract method 0x7b5c8e60. +// +// Solidity: function updateSDIncentiveController(address _sdIncentiveController) returns() +func (_StaderConfig *StaderConfigSession) UpdateSDIncentiveController(_sdIncentiveController common.Address) (*types.Transaction, error) { + return _StaderConfig.Contract.UpdateSDIncentiveController(&_StaderConfig.TransactOpts, _sdIncentiveController) +} + +// UpdateSDIncentiveController is a paid mutator transaction binding the contract method 0x7b5c8e60. +// +// Solidity: function updateSDIncentiveController(address _sdIncentiveController) returns() +func (_StaderConfig *StaderConfigTransactorSession) UpdateSDIncentiveController(_sdIncentiveController common.Address) (*types.Transaction, error) { + return _StaderConfig.Contract.UpdateSDIncentiveController(&_StaderConfig.TransactOpts, _sdIncentiveController) +} + +// UpdateSDUtilityPool is a paid mutator transaction binding the contract method 0x9c34e411. +// +// Solidity: function updateSDUtilityPool(address _utilityPool) returns() +func (_StaderConfig *StaderConfigTransactor) UpdateSDUtilityPool(opts *bind.TransactOpts, _utilityPool common.Address) (*types.Transaction, error) { + return _StaderConfig.contract.Transact(opts, "updateSDUtilityPool", _utilityPool) +} + +// UpdateSDUtilityPool is a paid mutator transaction binding the contract method 0x9c34e411. +// +// Solidity: function updateSDUtilityPool(address _utilityPool) returns() +func (_StaderConfig *StaderConfigSession) UpdateSDUtilityPool(_utilityPool common.Address) (*types.Transaction, error) { + return _StaderConfig.Contract.UpdateSDUtilityPool(&_StaderConfig.TransactOpts, _utilityPool) +} + +// UpdateSDUtilityPool is a paid mutator transaction binding the contract method 0x9c34e411. +// +// Solidity: function updateSDUtilityPool(address _utilityPool) returns() +func (_StaderConfig *StaderConfigTransactorSession) UpdateSDUtilityPool(_utilityPool common.Address) (*types.Transaction, error) { + return _StaderConfig.Contract.UpdateSDUtilityPool(&_StaderConfig.TransactOpts, _utilityPool) +} + // UpdateSocializingPoolCycleDuration is a paid mutator transaction binding the contract method 0x6870bb2b. // // Solidity: function updateSocializingPoolCycleDuration(uint256 _socializingPoolCycleDuration) returns() From 170badd926eb8faf87c65cd9db62c9df6c0172ee Mon Sep 17 00:00:00 2001 From: batphonghan Date: Mon, 27 Nov 2023 12:02:45 +0700 Subject: [PATCH 002/159] Add validator --- shared/services/services.go | 27 +++++ shared/services/stader/node.go | 4 +- shared/types/api/node.go | 12 ++- stader-cli/node/approve-sd.go | 16 +-- stader-cli/node/deposit-sd.go | 16 ++- stader-cli/validator/deposit.go | 122 ++++++++++++++++++++-- stader-lib/node/validator.go | 15 ++- stader-lib/sd-collateral/sd-deposit.go | 12 ++- stader-lib/sd_utility/sd_utility.go | 17 +++ stader-lib/stader-config/stader-config.go | 7 +- stader-lib/stader/stader.go | 33 +++++- stader/api/node/deposit-sd.go | 3 +- stader/api/validator/deposit.go | 89 ++++++++++++++-- 13 files changed, 338 insertions(+), 35 deletions(-) create mode 100644 stader-lib/sd_utility/sd_utility.go diff --git a/shared/services/services.go b/shared/services/services.go index 42d7b76f6..2adbb2ad2 100644 --- a/shared/services/services.go +++ b/shared/services/services.go @@ -223,6 +223,15 @@ func GetStakePoolManagerAddress(c *cli.Context) (common.Address, error) { return stader_config.GetStakePoolManagerAddress(sdcfg, nil) } +func GetSdUtilityAddress(c *cli.Context) (common.Address, error) { + sdcfg, err := GetStaderConfigContract(c) + if err != nil { + return common.Address{}, err + } + + return stader_config.GetSDUtilityPool(sdcfg, nil) +} + func GetPermissionlessNodeRegistry(c *cli.Context) (*stader.PermissionlessNodeRegistryContractManager, error) { cfg, err := getConfig(c) if err != nil { @@ -422,6 +431,24 @@ func GetStakePoolManager(c *cli.Context) (*stader.StakePoolManagerContractManage return stader.NewStakePoolManager(ec, stakePoolManagerAddress) } +func GetSdUtilityContract(c *cli.Context) (*stader.SDUtilityPoolContractManager, error) { + cfg, err := getConfig(c) + if err != nil { + return nil, err + } + ec, err := getEthClient(c, cfg) + if err != nil { + return nil, err + } + + sdUtilityAddress, err := GetSdUtilityAddress(c) + if err != nil { + return nil, err + } + + return stader.NewSDUtilityPool(ec, sdUtilityAddress) +} + func GetBeaconClient(c *cli.Context) (*BeaconClientManager, error) { cfg, err := getConfig(c) if err != nil { diff --git a/shared/services/stader/node.go b/shared/services/stader/node.go index a73c19ca9..449378162 100644 --- a/shared/services/stader/node.go +++ b/shared/services/stader/node.go @@ -268,8 +268,8 @@ func (c *Client) GetContractsInfo() (api.ContractsInfoResponse, error) { } // Make a node deposit -func (c *Client) NodeDeposit(amountWei *big.Int, numValidators *big.Int, reloadKeys bool) (api.NodeDepositResponse, error) { - responseBytes, err := c.callAPI(fmt.Sprintf("validator deposit %s %s %t", amountWei.String(), numValidators, reloadKeys)) +func (c *Client) NodeDeposit(amountWei, numValidators, utilitySDAmount *big.Int, reloadKeys bool) (api.NodeDepositResponse, error) { + responseBytes, err := c.callAPI(fmt.Sprintf("validator deposit %s %s %s %t", amountWei.String(), utilitySDAmount.String(), numValidators, reloadKeys)) if err != nil { return api.NodeDepositResponse{}, fmt.Errorf("could not make validator deposit as er: %w", err) } diff --git a/shared/types/api/node.go b/shared/types/api/node.go index a8ec3582a..ba21c26a7 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -97,13 +97,23 @@ type CanNodeDepositResponse struct { InsufficientBalance bool `json:"insufficientBalance"` InvalidAmount bool `json:"invalidAmount"` DepositPaused bool `json:"depositPaused"` - NotEnoughSdCollateral bool `json:"notEnoughSdCollateral"` MaxValidatorLimitReached bool `json:"maxValidatorLimitReached"` InputKeyLimitReached bool `json:"inputKeyLimitReached"` InputKeyLimit uint16 `json:"inputKeyLimit"` + SdStatus *SdStatus `json:"sdStatus"` GasInfo stader.GasInfo `json:"gasInfo"` } +type SdStatus struct { + NotEnoughSdCollateral bool `json:"notEnoughSdCollateral"` + SdUtilityBalance *big.Int `json:"sdUtilityBalance"` + SdCollateralCurrentAmount *big.Int `json:"sdCollateralCurrentAmount"` + SdCollateralRequireAmount *big.Int `json:"sdCollateralRequireAmount"` + SdBalance *big.Int `json:"sdBalance"` + SdMaxCollateralAmount *big.Int `json:"sdMaxCollateralAmount"` + PoolAvailableSDBalance *big.Int `json:"poolAvailableSDBalance"` +} + type NodeDepositResponse struct { Status string `json:"status"` Error string `json:"error"` diff --git a/stader-cli/node/approve-sd.go b/stader-cli/node/approve-sd.go index 094761537..d2f3ad140 100644 --- a/stader-cli/node/approve-sd.go +++ b/stader-cli/node/approve-sd.go @@ -42,7 +42,11 @@ func nodeApproveSd(c *cli.Context) error { amountWei := eth.EthToWei(amount) - err = nodeApproveSdWithAmount(c, staderClient, amountWei) + autoConfirm := c.Bool("yes") + + nonce := c.GlobalUint64("nonce") + + err = nodeApproveSdWithAmount(staderClient, amountWei, autoConfirm, nonce) if err != nil { return err } @@ -50,9 +54,9 @@ func nodeApproveSd(c *cli.Context) error { return nil } -func nodeApproveSdWithAmount(c *cli.Context, staderClient *stader.Client, amountWei *big.Int) error { +func nodeApproveSdWithAmount(staderClient *stader.Client, amountWei *big.Int, autoConfirm bool, nonce uint64) error { // If a custom nonce is set, print the multi-transaction warning - if c.GlobalUint64("nonce") != 0 { + if nonce != 0 { cliutils.PrintMultiTransactionNonceWarning() } @@ -62,13 +66,13 @@ func nodeApproveSdWithAmount(c *cli.Context, staderClient *stader.Client, amount return err } // Assign max fees - err = gas.AssignMaxFeeAndLimit(approvalGas.GasInfo, staderClient, c.Bool("yes")) + err = gas.AssignMaxFeeAndLimit(approvalGas.GasInfo, staderClient, autoConfirm) if err != nil { return err } // Prompt for confirmation - if !(c.Bool("yes") || cliutils.Confirm("Do you want to approve SD to be spent by the Collateral Contract?")) { + if !(autoConfirm || cliutils.Confirm("Do you want to approve SD to be spent by the Collateral Contract?")) { fmt.Println("Cancelled.") return nil } @@ -90,7 +94,7 @@ func nodeApproveSdWithAmount(c *cli.Context, staderClient *stader.Client, amount fmt.Println("Successfully approved SD.") // If a custom nonce is set, increment it for the next transaction - if c.GlobalUint64("nonce") != 0 { + if nonce != 0 { staderClient.IncrementCustomNonce() } diff --git a/stader-cli/node/deposit-sd.go b/stader-cli/node/deposit-sd.go index 9207ad153..434ba7463 100644 --- a/stader-cli/node/deposit-sd.go +++ b/stader-cli/node/deposit-sd.go @@ -2,6 +2,7 @@ package node import ( "fmt" + "math/big" "strconv" "github.com/stader-labs/stader-node/stader-lib/utils/eth" @@ -27,8 +28,9 @@ func nodeDepositSd(c *cli.Context) error { return err } + nounce := c.GlobalUint64("nonce") // If a custom nonce is set, print the multi-transaction warning - if c.GlobalUint64("nonce") != 0 { + if nounce != 0 { cliutils.PrintMultiTransactionNonceWarning() } @@ -38,8 +40,14 @@ func nodeDepositSd(c *cli.Context) error { if err != nil { return err } + autoConfirm := c.Bool("yes") + amountWei := eth.EthToWei(amount) + return NodeDepositSdWithAmount(staderClient, amountWei, autoConfirm, nounce) +} + +func NodeDepositSdWithAmount(staderClient *stader.Client, amountWei *big.Int, autoConfirm bool, nounce uint64) error { // Check allowance allowance, err := staderClient.GetNodeDepositSdAllowance() if err != nil { @@ -48,7 +56,7 @@ func nodeDepositSd(c *cli.Context) error { if allowance.Allowance.Cmp(amountWei) < 0 { fmt.Println("Before depositing SD, you must first give the collateral contract approval to interact with your SD. Amount to approve: ", eth.WeiToEth(amountWei)) - err = nodeApproveSdWithAmount(c, staderClient, amountWei) + err = nodeApproveSdWithAmount(staderClient, amountWei, autoConfirm, nounce) if err != nil { return err } @@ -70,13 +78,13 @@ func nodeDepositSd(c *cli.Context) error { } // Assign max fees - err = gas.AssignMaxFeeAndLimit(canDeposit.GasInfo, staderClient, c.Bool("yes")) + err = gas.AssignMaxFeeAndLimit(canDeposit.GasInfo, staderClient, autoConfirm) if err != nil { return err } // Prompt for confirmation - if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf("Are you sure you want to deposit %.6f SD? You will not be able to withdraw this SD until you exit your validators", math.RoundDown(eth.WeiToEth(amountWei), 6)))) { + if !(autoConfirm || cliutils.Confirm(fmt.Sprintf("Are you sure you want to deposit %.6f SD? You will not be able to withdraw this SD until you exit your validators", math.RoundDown(eth.WeiToEth(amountWei), 6)))) { fmt.Println("Cancelled.") return nil } diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 404729e46..7f2f977dc 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -3,15 +3,17 @@ package validator import ( "fmt" "math/big" + "strconv" "github.com/stader-labs/stader-node/shared/services/gas" "github.com/stader-labs/stader-node/shared/utils/log" - - "github.com/stader-labs/stader-node/stader-lib/utils/eth" - "github.com/urfave/cli" + "github.com/stader-labs/stader-node/shared/utils/math" + "github.com/stader-labs/stader-node/stader-cli/node" "github.com/stader-labs/stader-node/shared/services/stader" cliutils "github.com/stader-labs/stader-node/shared/utils/cli" + "github.com/stader-labs/stader-node/stader-lib/utils/eth" + "github.com/urfave/cli" ) func nodeDeposit(c *cli.Context) error { @@ -29,6 +31,7 @@ func nodeDeposit(c *cli.Context) error { } numValidators := c.Uint64("num-validators") + autoConfirm := c.Bool("yes") baseAmountInEth := 4 baseAmount := eth.EthToWei(4.0) @@ -52,10 +55,24 @@ func nodeDeposit(c *cli.Context) error { } } + // Get node status + status, err := staderClient.NodeStatus() + if err != nil { + return err + } + + fmt.Printf( + "The node %s%s%s has a balance of %.6f SD.\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, + math.RoundDown(eth.WeiToEth(status.AccountBalances.Sd), 18)) + canNodeDepositResponse, err := staderClient.CanNodeDeposit(baseAmount, big.NewInt(int64(numValidators)), true) if err != nil { return err } + if canNodeDepositResponse.InsufficientBalance { fmt.Printf("Account does not have enough balance!") return nil @@ -64,10 +81,89 @@ func nodeDeposit(c *cli.Context) error { fmt.Printf("Deposit is paused") return nil } - if canNodeDepositResponse.NotEnoughSdCollateral { - fmt.Printf("Not enough SD as collateral") - return nil + + sdStatus := canNodeDepositResponse.SdStatus + amountToCollateral := new(big.Int).Sub(sdStatus.SdCollateralRequireAmount, sdStatus.SdCollateralCurrentAmount) + + if amountToCollateral.Cmp(big.NewInt(0)) >= 1 { + fmt.Printf( + "The node %s%s%s need %.6f SD to meet collateral require.\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, + math.RoundDown(eth.WeiToEth(amountToCollateral), 18)) + } + + utilityAmount := big.NewInt(0) + + if sdStatus.NotEnoughSdCollateral { + // had SD but not in contract + + // User had enough to deposit-sd + // 1. deposit-sd + // 2. call deposit again + if amountToCollateral.Cmp(sdStatus.SdBalance) <= 0 { + err = node.NodeDepositSdWithAmount(staderClient, amountToCollateral, autoConfirm, 0) + if err != nil { + return err + } + + return nodeDeposit(c) + } else { + // User had not enough to deposit-sd + // Check if can borrow here + // ask utilize or deposit-sd + + minUtility := new(big.Int).Sub(sdStatus.SdCollateralRequireAmount, sdStatus.SdCollateralCurrentAmount) + + // Max + maxUtility := new(big.Int).Sub(sdStatus.SdMaxCollateralAmount, sdStatus.SdUtilityBalance) + + if minUtility.Cmp(sdStatus.PoolAvailableSDBalance) >= 0 { + fmt.Printf("Pool available SD: %s not enough to min utility : %s \n", sdStatus.PoolAvailableSDBalance.String(), minUtility.String()) + return nil + } + + // Set max to pool available + if sdStatus.PoolAvailableSDBalance.Cmp(maxUtility) <= 0 { + fmt.Printf("Pool available SD: %f, max utility : %f \n", eth.WeiToEth(sdStatus.PoolAvailableSDBalance), eth.WeiToEth(maxUtility)) + maxUtility = sdStatus.PoolAvailableSDBalance + } + + min := eth.WeiToEth(minUtility) + max := eth.WeiToEth(maxUtility) + + fmt.Printf("Min utility %+v max %+v \n", min, max) + + var _utilityAmount int + msg := fmt.Sprintf("Please enter a valid number in range %f <> %f.", min, max) + for { + s := cliutils.Prompt( + msg, + "^[1-9][0-9]*$", + msg) + _utilityAmount, err = strconv.Atoi(s) + if err != nil { + fmt.Println("Please enter a valid number.") + continue + } + + if _utilityAmount < int(min) || _utilityAmount > int(max) { + continue + } + + break + } + + utilityAmount = eth.EthToWei(float64(_utilityAmount)) + + if !cliutils.Confirm(fmt.Sprintf("You're about to utility %d SD: ", _utilityAmount)) { + fmt.Printf("Cancel \n") + return nil + } + } } + if canNodeDepositResponse.MaxValidatorLimitReached { fmt.Printf("Max validator limit reached") return nil @@ -83,6 +179,18 @@ func nodeDeposit(c *cli.Context) error { return err } + // Prompt for confirmation + if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( + "You are about to utility %f SD to create %d validators.\n"+ + "%sARE YOU SURE YOU WANT TO DO THIS?!%s", + eth.WeiToEth(utilityAmount), numValidators, + log.ColorYellow, + log.ColorReset))) { + fmt.Println("Cancelled.") + return nil + } + // 1 eth max per val0.8 + // Prompt for confirmation if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( "You are about to deposit %d ETH to create %d validators.\n"+ @@ -95,7 +203,7 @@ func nodeDeposit(c *cli.Context) error { } // Make deposit - response, err := staderClient.NodeDeposit(baseAmount, big.NewInt(int64(numValidators)), true) + response, err := staderClient.NodeDeposit(baseAmount, big.NewInt(int64(numValidators)), utilityAmount, true) if err != nil { return err } diff --git a/stader-lib/node/validator.go b/stader-lib/node/validator.go index 0547ffe12..d54219484 100644 --- a/stader-lib/node/validator.go +++ b/stader-lib/node/validator.go @@ -2,9 +2,10 @@ package node import ( "fmt" + "math/big" + "github.com/stader-labs/stader-node/stader-lib/contracts" types2 "github.com/stader-labs/stader-node/stader-lib/types" - "math/big" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" @@ -16,10 +17,16 @@ func EstimateAddValidatorKeys(pnr *stader.PermissionlessNodeRegistryContractMana return pnr.PermissionlessNodeRegistryContract.GetTransactionGasInfo(opts, "addValidatorKeys", pubKeys, preDepositSignatures, depositSignatures) } -func AddValidatorKeys(pnr *stader.PermissionlessNodeRegistryContractManager, pubKeys [][]byte, preDepositSignatures [][]byte, depositSignatures [][]byte, opts *bind.TransactOpts) (*types.Transaction, error) { - tx, err := pnr.PermissionlessNodeRegistry.AddValidatorKeys(opts, pubKeys, preDepositSignatures, depositSignatures) +func AddValidatorKeysWithAmount( + pnr *stader.PermissionlessNodeRegistryContractManager, + pubKeys [][]byte, + preDepositSignatures [][]byte, + depositSignatures [][]byte, + utilityAmount *big.Int, + opts *bind.TransactOpts) (*types.Transaction, error) { + tx, err := pnr.PermissionlessNodeRegistry.AddValidatorKeysWithUtilizeSD(opts, utilityAmount, pubKeys, preDepositSignatures, depositSignatures) if err != nil { - return nil, fmt.Errorf("could not add validator keys: %w", err) + return nil, fmt.Errorf("could not add validator keys with utilize: %w", err) } return tx, nil diff --git a/stader-lib/sd-collateral/sd-deposit.go b/stader-lib/sd-collateral/sd-deposit.go index 5932a45e3..61c92323f 100644 --- a/stader-lib/sd-collateral/sd-deposit.go +++ b/stader-lib/sd-collateral/sd-deposit.go @@ -2,12 +2,13 @@ package sd_collateral import ( "fmt" + "math/big" + "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/stader-labs/stader-node/stader-lib/stader" types2 "github.com/stader-labs/stader-node/stader-lib/types" - "math/big" ) func EstimateDepositSdAsCollateral(sdc *stader.SdCollateralContractManager, amount *big.Int, opts *bind.TransactOpts) (stader.GasInfo, error) { @@ -45,6 +46,15 @@ func GetOperatorSdBalance(sdc *stader.SdCollateralContractManager, operatorAddre return balance, err } +func MinimumSDToBond(sdc *stader.SdCollateralContractManager, poolID uint8, numValidators *big.Int, opts *bind.CallOpts) (*big.Int, error) { + minimumSDToBond, err := sdc.SdCollateral.GetMinimumSDToBond(opts, poolID, numValidators) + if err != nil { + return nil, err + } + + return minimumSDToBond, nil +} + func HasEnoughSdCollateral(sdc *stader.SdCollateralContractManager, operatorAddress common.Address, poolType uint8, numValidators *big.Int, opts *bind.CallOpts) (bool, error) { hasEnoughSdCollateral, err := sdc.SdCollateral.HasEnoughSDCollateral(opts, operatorAddress, poolType, numValidators) if err != nil { diff --git a/stader-lib/sd_utility/sd_utility.go b/stader-lib/sd_utility/sd_utility.go new file mode 100644 index 000000000..8578f9c5b --- /dev/null +++ b/stader-lib/sd_utility/sd_utility.go @@ -0,0 +1,17 @@ +package sd_utility + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/stader-labs/stader-node/stader-lib/stader" +) + +func UtilizerBalanceStored(sp *stader.SDUtilityPoolContractManager, address common.Address, opts *bind.CallOpts) (*big.Int, error) { + return sp.SDUtilityPool.UtilizerBalanceStored(opts, address) +} + +func GetPoolAvailableSDBalance(sp *stader.SDUtilityPoolContractManager, address common.Address, opts *bind.CallOpts) (*big.Int, error) { + return sp.SDUtilityPool.GetPoolAvailableSDBalance(opts) +} diff --git a/stader-lib/stader-config/stader-config.go b/stader-lib/stader-config/stader-config.go index 0f8264480..1cdb6911f 100644 --- a/stader-lib/stader-config/stader-config.go +++ b/stader-lib/stader-config/stader-config.go @@ -1,10 +1,11 @@ package stader_config import ( + "math/big" + "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/stader-labs/stader-node/stader-lib/stader" - "math/big" ) func GetRewardsThreshold(sdConfig *stader.StaderConfigContractManager, opts *bind.CallOpts) (*big.Int, error) { @@ -70,3 +71,7 @@ func GetSdCollateralAddress(sdConfig *stader.StaderConfigContractManager, opts * func GetOperatorRewardsCollectorAddress(sdConfig *stader.StaderConfigContractManager, opts *bind.CallOpts) (common.Address, error) { return sdConfig.StaderConfig.GetOperatorRewardsCollector(opts) } + +func GetSDUtilityPool(sdConfig *stader.StaderConfigContractManager, opts *bind.CallOpts) (common.Address, error) { + return sdConfig.StaderConfig.GetSDUtilityPool(opts) +} diff --git a/stader-lib/stader/stader.go b/stader-lib/stader/stader.go index 80e1d65dd..f165b3a5d 100644 --- a/stader-lib/stader/stader.go +++ b/stader-lib/stader/stader.go @@ -1,11 +1,12 @@ package stader import ( + "strings" + "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/stader-labs/stader-node/stader-lib/contracts" - "strings" ) type Erc20TokenContractManager struct { @@ -450,3 +451,33 @@ func NewOperatorRewardsCollector(client ExecutionClient, operatorRewardsCollecto }, nil } + +type SDUtilityPoolContractManager struct { + Client ExecutionClient + SDUtilityPool *contracts.SDUtilityPool + SDUtilityPoolContract *Contract +} + +func NewSDUtilityPool(client ExecutionClient, sdUtilizeAddress common.Address) (*SDUtilityPoolContractManager, error) { + sdUtilizeFactory, err := contracts.NewSDUtilityPool(sdUtilizeAddress, client) + if err != nil { + return nil, err + } + + sdUtilizeAbi, err := abi.JSON(strings.NewReader(contracts.SDUtilityPoolMetaData.ABI)) + if err != nil { + return nil, err + } + sdUtilizeContract := &Contract{ + Contract: bind.NewBoundContract(sdUtilizeAddress, sdUtilizeAbi, client, client, client), + Address: &sdUtilizeAddress, + ABI: &sdUtilizeAbi, + Client: client, + } + + return &SDUtilityPoolContractManager{ + Client: client, + SDUtilityPool: sdUtilizeFactory, + SDUtilityPoolContract: sdUtilizeContract, + }, nil +} diff --git a/stader/api/node/deposit-sd.go b/stader/api/node/deposit-sd.go index d0386e8c0..97493cfea 100644 --- a/stader/api/node/deposit-sd.go +++ b/stader/api/node/deposit-sd.go @@ -2,9 +2,10 @@ package node import ( "fmt" - "github.com/stader-labs/stader-node/stader-lib/sd-collateral" "math/big" + sd_collateral "github.com/stader-labs/stader-node/stader-lib/sd-collateral" + "github.com/ethereum/go-ethereum/common" "github.com/stader-labs/stader-node/stader-lib/tokens" "github.com/stader-labs/stader-node/stader-lib/utils" diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index 3143a3f9b..d2985970c 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -2,13 +2,17 @@ package validator import ( "fmt" + "math/big" + + "github.com/ethereum/go-ethereum/common" "github.com/stader-labs/stader-node/stader-lib/node" sd_collateral "github.com/stader-labs/stader-node/stader-lib/sd-collateral" + "github.com/stader-labs/stader-node/stader-lib/sd_utility" + "github.com/stader-labs/stader-node/stader-lib/stader" "github.com/stader-labs/stader-node/stader-lib/tokens" stadertypes "github.com/stader-labs/stader-node/stader-lib/types" "github.com/urfave/cli" _ "golang.org/x/sync/errgroup" - "math/big" "github.com/stader-labs/stader-node/shared/services" "github.com/stader-labs/stader-node/shared/types/api" @@ -16,6 +20,59 @@ import ( "github.com/stader-labs/stader-node/shared/utils/validator" ) +const MaxEthThresholdUtilize = 8 + +func getSDStatus( + sdc *stader.SdCollateralContractManager, + sdu *stader.SDUtilityPoolContractManager, + sdt *stader.Erc20TokenContractManager, + operatorAddress common.Address, + totalValidatorsPostAddition *big.Int, +) (*api.SdStatus, error) { + + sdUtilityBalance, err := sd_utility.UtilizerBalanceStored(sdu, operatorAddress, nil) + if err != nil { + return nil, err + } + + poolAvailableSDBalance, err := sd_utility.GetPoolAvailableSDBalance(sdu, operatorAddress, nil) + if err != nil { + return nil, err + } + + minimumSDToBond, err := sd_collateral.MinimumSDToBond(sdc, 1, totalValidatorsPostAddition, nil) + if err != nil { + return nil, err + } + + sdCollateralCurrentAmount, err := sd_collateral.GetOperatorSdBalance(sdc, operatorAddress, nil) + if err != nil { + return nil, err + } + + // Check Sd balance + sdBalance, err := sdt.Erc20Token.BalanceOf(nil, operatorAddress) + if err != nil { + return nil, err + } + + maxSDToBound := new(big.Int).Mul(minimumSDToBond, big.NewInt(2)) + + hasEnoughSdCollateral, err := sd_collateral.HasEnoughSdCollateral(sdc, operatorAddress, 1, totalValidatorsPostAddition, nil) + if err != nil { + return nil, err + } + + return &api.SdStatus{ + NotEnoughSdCollateral: !hasEnoughSdCollateral, + SdUtilityBalance: sdUtilityBalance, + SdBalance: sdBalance, + SdCollateralCurrentAmount: sdCollateralCurrentAmount, + SdCollateralRequireAmount: minimumSDToBond, + SdMaxCollateralAmount: maxSDToBound, + PoolAvailableSDBalance: poolAvailableSDBalance, + }, nil +} func canNodeDeposit(c *cli.Context, amountWei *big.Int, numValidators *big.Int, reloadKeys bool) (*api.CanNodeDepositResponse, error) { if err := services.RequireNodeWallet(c); err != nil { return nil, err @@ -42,6 +99,18 @@ func canNodeDeposit(c *cli.Context, amountWei *big.Int, numValidators *big.Int, if err != nil { return nil, err } + + sdt, err := services.GetSdTokenContract(c) + if err != nil { + return nil, err + } + + sdu, err := services.GetSdUtilityContract(c) + // TODO: enable this when contract ready + // if err != nil { + // return nil, err + // } + bc, err := services.GetBeaconClient(c) if err != nil { return nil, err @@ -107,12 +176,14 @@ func canNodeDeposit(c *cli.Context, amountWei *big.Int, numValidators *big.Int, totalValidatorsPostAddition := totalValidatorNonTerminalKeys + numValidators.Uint64() - hasEnoughSdCollateral, err := sd_collateral.HasEnoughSdCollateral(sdc, nodeAccount.Address, 1, big.NewInt(int64(totalValidatorsPostAddition)), nil) + sdStatus, err := getSDStatus(sdc, sdu, sdt, nodeAccount.Address, big.NewInt(int64(totalValidatorsPostAddition))) if err != nil { return nil, err } - if !hasEnoughSdCollateral { - canNodeDepositResponse.NotEnoughSdCollateral = true + + canNodeDepositResponse.SdStatus = sdStatus + + if canNodeDepositResponse.SdStatus.NotEnoughSdCollateral { return &canNodeDepositResponse, nil } @@ -204,8 +275,7 @@ func canNodeDeposit(c *cli.Context, amountWei *big.Int, numValidators *big.Int, return &canNodeDepositResponse, nil } -func nodeDeposit(c *cli.Context, amountWei *big.Int, numValidators *big.Int, reloadKeys bool) (*api.NodeDepositResponse, error) { - +func nodeDeposit(c *cli.Context, amountWei *big.Int, amountUtility *big.Int, numValidators *big.Int, reloadKeys bool) (*api.NodeDepositResponse, error) { cfg, err := services.GetConfig(c) if err != nil { return nil, err @@ -345,7 +415,12 @@ func nodeDeposit(c *cli.Context, amountWei *big.Int, numValidators *big.Int, rel return nil, fmt.Errorf("error checking for nonce override: %w", err) } - tx, err := node.AddValidatorKeys(prn, pubKeys, preDepositSignatures, depositSignatures, opts) + tx, err := node.AddValidatorKeysWithAmount(prn, + pubKeys, + preDepositSignatures, + depositSignatures, + amountUtility, + opts) if err != nil { return nil, err } From e419ffba979d4e944ffb47d8f25978cca3e15f21 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 28 Nov 2023 16:07:06 +0700 Subject: [PATCH 003/159] Update CLI --- shared/services/stader/node.go | 64 ++++++++++++++++++++ shared/types/api/node.go | 28 +++++++++ stader-cli/node/commands.go | 50 ++++++++++++++++ stader-cli/node/repay-sd.go | 70 ++++++++++++++++++++++ stader-cli/node/utilize-sd.go | 70 ++++++++++++++++++++++ stader-lib/node/validator.go | 18 +++++- stader-lib/sd_utility/sd_utility.go | 27 ++++++++- stader/api/node/commands.go | 85 +++++++++++++++++++++++++++ stader/api/node/repay-sd.go | 90 +++++++++++++++++++++++++++++ stader/api/node/sd-status.go | 70 ++++++++++++++++++++++ stader/api/node/utility-sd.go | 90 +++++++++++++++++++++++++++++ stader/api/validator/commands.go | 15 +++-- stader/api/validator/deposit.go | 27 +++++---- 13 files changed, 684 insertions(+), 20 deletions(-) create mode 100644 stader-cli/node/repay-sd.go create mode 100644 stader-cli/node/utilize-sd.go create mode 100644 stader/api/node/repay-sd.go create mode 100644 stader/api/node/sd-status.go create mode 100644 stader/api/node/utility-sd.go diff --git a/shared/services/stader/node.go b/shared/services/stader/node.go index 449378162..380357f9b 100644 --- a/shared/services/stader/node.go +++ b/shared/services/stader/node.go @@ -634,3 +634,67 @@ func (c *Client) SetRewardAddress(operatorRewardAddress common.Address) (api.Set } return response, nil } + +// Approve SD for depositing as collateral +func (c *Client) NodeRepaySd(amountWei *big.Int) (api.NodeRepaySDResponse, error) { + responseBytes, err := c.callAPI(fmt.Sprintf("node repay-sd %s", amountWei.String())) + if err != nil { + return api.NodeRepaySDResponse{}, fmt.Errorf("could not repay SD: %w", err) + } + var response api.NodeRepaySDResponse + if err := json.Unmarshal(responseBytes, &response); err != nil { + return api.NodeRepaySDResponse{}, fmt.Errorf("could not decode repay node SD response: %w", err) + } + if response.Error != "" { + return api.NodeRepaySDResponse{}, fmt.Errorf("could not repay SD: %s", response.Error) + } + return response, nil +} + +// Approve SD for depositing as collateral +func (c *Client) CanNodeRepaySd(amountWei *big.Int) (api.CanRepaySDResponse, error) { + responseBytes, err := c.callAPI(fmt.Sprintf("node can-repay-sd %s", amountWei.String())) + if err != nil { + return api.CanRepaySDResponse{}, fmt.Errorf("could not repay SD: %w", err) + } + var response api.CanRepaySDResponse + if err := json.Unmarshal(responseBytes, &response); err != nil { + return api.CanRepaySDResponse{}, fmt.Errorf("could not decode repay SD response: %w", err) + } + if response.Error != "" { + return api.CanRepaySDResponse{}, fmt.Errorf("could not repay SD: %s", response.Error) + } + return response, nil +} + +// Approve SD for depositing as collateral +func (c *Client) NodeUtilizeSd(amountWei *big.Int) (api.NodeUtilitySDResponse, error) { + responseBytes, err := c.callAPI(fmt.Sprintf("node utilize-sd %s", amountWei.String())) + if err != nil { + return api.NodeUtilitySDResponse{}, fmt.Errorf("could not utilize SD: %w", err) + } + var response api.NodeUtilitySDResponse + if err := json.Unmarshal(responseBytes, &response); err != nil { + return api.NodeUtilitySDResponse{}, fmt.Errorf("could not decode utilize response: %w", err) + } + if response.Error != "" { + return api.NodeUtilitySDResponse{}, fmt.Errorf("could not utilize SD: %s", response.Error) + } + return response, nil +} + +// Approve SD for depositing as collateral +func (c *Client) CanNodeUtilizeSd(amountWei *big.Int) (api.CanUtilitySDResponse, error) { + responseBytes, err := c.callAPI(fmt.Sprintf("node can-utilize-sd %s", amountWei.String())) + if err != nil { + return api.CanUtilitySDResponse{}, fmt.Errorf("could not utilize SD: %w", err) + } + var response api.CanUtilitySDResponse + if err := json.Unmarshal(responseBytes, &response); err != nil { + return api.CanUtilitySDResponse{}, fmt.Errorf("could not decode node SD utilize response: %w", err) + } + if response.Error != "" { + return api.CanUtilitySDResponse{}, fmt.Errorf("could not utilize SD: %s", response.Error) + } + return response, nil +} diff --git a/shared/types/api/node.go b/shared/types/api/node.go index ba21c26a7..c21bce08d 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -69,6 +69,7 @@ type CanNodeDepositSdResponse struct { InsufficientBalance bool `json:"insufficientBalance"` GasInfo stader.GasInfo `json:"gasInfo"` } + type NodeDepositSdApproveGasResponse struct { Status string `json:"status"` Error string `json:"error"` @@ -416,3 +417,30 @@ type ClaimRewards struct { OperatorRewardAddress common.Address `json:"operatorRewardAddress"` TxHash common.Hash `json:"txHash"` } +type SdStatusResponse struct { + *SdStatus +} + +type NodeRepaySDResponse struct { + Status string `json:"status"` + Error string `json:"error"` + TxHash common.Hash `json:"txHash"` +} + +type CanRepaySDResponse struct { + Status string `json:"status"` + Error string `json:"error"` + GasInfo stader.GasInfo `json:"gasInfo"` +} + +type NodeUtilitySDResponse struct { + Status string `json:"status"` + Error string `json:"error"` + TxHash common.Hash `json:"txHash"` +} + +type CanUtilitySDResponse struct { + Status string `json:"status"` + Error string `json:"error"` + GasInfo stader.GasInfo `json:"gasInfo"` +} diff --git a/stader-cli/node/commands.go b/stader-cli/node/commands.go index 949462bc1..333fbcede 100644 --- a/stader-cli/node/commands.go +++ b/stader-cli/node/commands.go @@ -368,6 +368,56 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { return nodeApproveSd(c) }, }, + { + Name: "utilization-sd", + Aliases: []string{"us"}, + Usage: "Utilize from the Utility pool.", + UsageText: "stader-cli node utilization-sd [options]", + Flags: []cli.Flag{ + cli.StringFlag{ + Name: "amount, a", + Usage: "The amount of SD to utilize", + }, + cli.BoolFlag{ + Name: "yes, y", + Usage: "Automatically confirm SD utilize", + }, + }, + Action: func(c *cli.Context) error { + + if _, err := cliutils.ValidatePositiveEthAmount("sd utilize amount", c.String("amount")); err != nil { + return err + } + + // Run + return utilizeSD(c) + }, + }, + { + Name: "repay-sd", + Aliases: []string{"rs"}, + Usage: "Repay the amount to reduce their utilization position", + UsageText: "stader-cli node repay-sd [options]", + Flags: []cli.Flag{ + cli.StringFlag{ + Name: "amount, a", + Usage: "The amount of SD to repay", + }, + cli.BoolFlag{ + Name: "yes, y", + Usage: "Automatically confirm SD repay", + }, + }, + Action: func(c *cli.Context) error { + + if _, err := cliutils.ValidatePositiveEthAmount("sd repay amount", c.String("amount")); err != nil { + return err + } + + // Run + return repaySD(c) + }, + }, }, }) } diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go new file mode 100644 index 000000000..ba3e00add --- /dev/null +++ b/stader-cli/node/repay-sd.go @@ -0,0 +1,70 @@ +package node + +import ( + "fmt" + "strconv" + + "github.com/urfave/cli" + + "github.com/stader-labs/stader-node/shared/services/gas" + "github.com/stader-labs/stader-node/shared/services/stader" + cliutils "github.com/stader-labs/stader-node/shared/utils/cli" + "github.com/stader-labs/stader-node/stader-lib/utils/eth" +) + +func repaySD(c *cli.Context) error { + + staderClient, err := stader.NewClientFromCtx(c) + if err != nil { + return err + } + defer staderClient.Close() + + // Check and assign the EC status + err = cliutils.CheckClientStatus(staderClient) + if err != nil { + return err + } + + // Print what network we're on + err = cliutils.PrintNetwork(staderClient) + + // Get stake mount + amountInString := c.String("amount") + amount, err := strconv.ParseFloat(amountInString, 64) + if err != nil { + return err + } + + amountWei := eth.EthToWei(amount) + // Check if we can Withdraw El Rewards + canClaimElRewardsResponse, err := staderClient.CanNodeRepaySd(amountWei) + if err != nil { + return err + } + + err = gas.AssignMaxFeeAndLimit(canClaimElRewardsResponse.GasInfo, staderClient, c.Bool("yes")) + if err != nil { + return err + } + + // Prompt for confirmation + if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( + "Are you sure you want to repay SD?"))) { + fmt.Println("Cancelled.") + return nil + } + + // Withdraw El Rewards + res, err := staderClient.NodeRepaySd(amountWei) + if err != nil { + return err + } + + cliutils.PrintTransactionHash(staderClient, res.TxHash) + if _, err = staderClient.WaitForTransaction(res.TxHash); err != nil { + return err + } + + return nil +} diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go new file mode 100644 index 000000000..5d4d81a61 --- /dev/null +++ b/stader-cli/node/utilize-sd.go @@ -0,0 +1,70 @@ +package node + +import ( + "fmt" + "strconv" + + "github.com/urfave/cli" + + "github.com/stader-labs/stader-node/shared/services/gas" + "github.com/stader-labs/stader-node/shared/services/stader" + cliutils "github.com/stader-labs/stader-node/shared/utils/cli" + "github.com/stader-labs/stader-node/stader-lib/utils/eth" +) + +func utilizeSD(c *cli.Context) error { + + staderClient, err := stader.NewClientFromCtx(c) + if err != nil { + return err + } + defer staderClient.Close() + + // Check and assign the EC status + err = cliutils.CheckClientStatus(staderClient) + if err != nil { + return err + } + + // Print what network we're on + err = cliutils.PrintNetwork(staderClient) + + // Get stake mount + amountInString := c.String("amount") + amount, err := strconv.ParseFloat(amountInString, 64) + if err != nil { + return err + } + + amountWei := eth.EthToWei(amount) + // Check if we can Withdraw El Rewards + canClaimElRewardsResponse, err := staderClient.CanNodeUtilizeSd(amountWei) + if err != nil { + return err + } + + err = gas.AssignMaxFeeAndLimit(canClaimElRewardsResponse.GasInfo, staderClient, c.Bool("yes")) + if err != nil { + return err + } + + // Prompt for confirmation + if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( + "Are you sure you want to utilize SD?"))) { + fmt.Println("Cancelled.") + return nil + } + + // Withdraw El Rewards + res, err := staderClient.NodeUtilizeSd(amountWei) + if err != nil { + return err + } + + cliutils.PrintTransactionHash(staderClient, res.TxHash) + if _, err = staderClient.WaitForTransaction(res.TxHash); err != nil { + return err + } + + return nil +} diff --git a/stader-lib/node/validator.go b/stader-lib/node/validator.go index d54219484..45990548c 100644 --- a/stader-lib/node/validator.go +++ b/stader-lib/node/validator.go @@ -13,8 +13,22 @@ import ( "github.com/stader-labs/stader-node/stader-lib/stader" ) -func EstimateAddValidatorKeys(pnr *stader.PermissionlessNodeRegistryContractManager, pubKeys [][]byte, preDepositSignatures [][]byte, depositSignatures [][]byte, opts *bind.TransactOpts) (stader.GasInfo, error) { - return pnr.PermissionlessNodeRegistryContract.GetTransactionGasInfo(opts, "addValidatorKeys", pubKeys, preDepositSignatures, depositSignatures) +func EstimateAddValidatorKeys( + pnr *stader.PermissionlessNodeRegistryContractManager, + utilityAmount *big.Int, + pubKeys [][]byte, + preDepositSignatures [][]byte, + depositSignatures [][]byte, + opts *bind.TransactOpts, +) (stader.GasInfo, error) { + return pnr.PermissionlessNodeRegistryContract.GetTransactionGasInfo( + opts, + "addValidatorKeysWithUtilizeSD", + utilityAmount, + pubKeys, + preDepositSignatures, + depositSignatures, + ) } func AddValidatorKeysWithAmount( diff --git a/stader-lib/sd_utility/sd_utility.go b/stader-lib/sd_utility/sd_utility.go index 8578f9c5b..0b17c3755 100644 --- a/stader-lib/sd_utility/sd_utility.go +++ b/stader-lib/sd_utility/sd_utility.go @@ -5,13 +5,34 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" "github.com/stader-labs/stader-node/stader-lib/stader" + "github.com/stader-labs/stader-node/stader-lib/utils/eth" ) -func UtilizerBalanceStored(sp *stader.SDUtilityPoolContractManager, address common.Address, opts *bind.CallOpts) (*big.Int, error) { - return sp.SDUtilityPool.UtilizerBalanceStored(opts, address) +func GetUtilizerLatestBalance(sp *stader.SDUtilityPoolContractManager, address common.Address, opts *bind.CallOpts) (*big.Int, error) { + return big.NewInt(0), nil + return sp.SDUtilityPool.GetUtilizerLatestBalance(opts, address) } func GetPoolAvailableSDBalance(sp *stader.SDUtilityPoolContractManager, address common.Address, opts *bind.CallOpts) (*big.Int, error) { - return sp.SDUtilityPool.GetPoolAvailableSDBalance(opts) + return eth.EthToWei(1000), nil + // return sp.SDUtilityPool.GetPoolAvailableSDBalance(opts) +} + +// Estimate the gas of Utilize +func EstimateUtilize(sp *stader.SDUtilityPoolContractManager, utilityAmount *big.Int, opts *bind.TransactOpts) (stader.GasInfo, error) { + return sp.SDUtilityPoolContract.GetTransactionGasInfo(opts, "utilize", utilityAmount) +} + +func Utilize(sp *stader.SDUtilityPoolContractManager, utilityAmount *big.Int, opts *bind.TransactOpts) (*types.Transaction, error) { + return sp.SDUtilityPool.Utilize(opts, utilityAmount) +} + +func EstimateRepay(sp *stader.SDUtilityPoolContractManager, utilityAmount *big.Int, opts *bind.TransactOpts) (stader.GasInfo, error) { + return sp.SDUtilityPoolContract.GetTransactionGasInfo(opts, "repay", utilityAmount) +} + +func Repay(sp *stader.SDUtilityPoolContractManager, utilityAmount *big.Int, opts *bind.TransactOpts) (*types.Transaction, error) { + return sp.SDUtilityPool.Repay(opts, utilityAmount) } diff --git a/stader/api/node/commands.go b/stader/api/node/commands.go index 68e664095..817a46342 100644 --- a/stader/api/node/commands.go +++ b/stader/api/node/commands.go @@ -173,6 +173,91 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { }, }, + { + Name: "utilize-sd", + Usage: "Utilize SD", + UsageText: "stader-cli api node utilize-sd amount", + Action: func(c *cli.Context) error { + + // Validate args + if err := cliutils.ValidateArgCount(c, 1); err != nil { + return err + } + amountWei, err := cliutils.ValidatePositiveWeiAmount("utilize amount", c.Args().Get(0)) + if err != nil { + return err + } + + // Run + api.PrintResponse(utilitySd(c, amountWei)) + return nil + + }, + }, + { + Name: "can-utilize-sd", + Usage: "Utilize SD", + UsageText: "stader-cli api node can-utilize-sd amount", + Action: func(c *cli.Context) error { + + // Validate args + if err := cliutils.ValidateArgCount(c, 1); err != nil { + return err + } + amountWei, err := cliutils.ValidatePositiveWeiAmount("can utilize amount", c.Args().Get(0)) + if err != nil { + return err + } + + // Run + api.PrintResponse(canUtilitySd(c, amountWei)) + return nil + + }, + }, + { + Name: "repay-sd", + Usage: "Utilize SD", + UsageText: "stader-cli api node repay-sd amount", + Action: func(c *cli.Context) error { + + // Validate args + if err := cliutils.ValidateArgCount(c, 1); err != nil { + return err + } + amountWei, err := cliutils.ValidatePositiveWeiAmount("repay amount", c.Args().Get(0)) + if err != nil { + return err + } + + // Run + api.PrintResponse(repaySD(c, amountWei)) + return nil + + }, + }, + { + Name: "can-repay-sd", + Usage: "Can repay SD", + UsageText: "stader-cli api node can-repay-sd amount", + Action: func(c *cli.Context) error { + + // Validate args + if err := cliutils.ValidateArgCount(c, 1); err != nil { + return err + } + amountWei, err := cliutils.ValidatePositiveWeiAmount("can repay amount", c.Args().Get(0)) + if err != nil { + return err + } + + // Run + api.PrintResponse(canRepaySD(c, amountWei)) + return nil + + }, + }, + { Name: "wait-and-deposit-sd", Aliases: []string{"k2"}, diff --git a/stader/api/node/repay-sd.go b/stader/api/node/repay-sd.go new file mode 100644 index 000000000..cb894021c --- /dev/null +++ b/stader/api/node/repay-sd.go @@ -0,0 +1,90 @@ +package node + +import ( + "math/big" + + "github.com/stader-labs/stader-node/stader-lib/sd_utility" + + "github.com/urfave/cli" + + "github.com/stader-labs/stader-node/shared/services" + "github.com/stader-labs/stader-node/shared/types/api" +) + +func canRepaySD(c *cli.Context, amountWei *big.Int) (*api.CanRepaySDResponse, error) { + + return &api.CanRepaySDResponse{}, nil + + // Get services + if err := services.RequireNodeWallet(c); err != nil { + return nil, err + } + + w, err := services.GetWallet(c) + if err != nil { + return nil, err + } + + // Response + response := api.CanRepaySDResponse{} + + sdu, err := services.GetSdUtilityContract(c) + if err != nil { + return nil, err + } + + // Get gas estimates + opts, err := w.GetNodeAccountTransactor() + if err != nil { + return nil, err + } + + gasInfo, err := sd_utility.EstimateRepay(sdu, amountWei, opts) + if err != nil { + return nil, err + } + + response.GasInfo = gasInfo + + return &response, nil +} + +func repaySD(c *cli.Context, amountWei *big.Int) (*api.NodeRepaySDResponse, error) { + + return &api.NodeRepaySDResponse{ + Error: "Repay err", + }, nil + + // Get services + if err := services.RequireNodeWallet(c); err != nil { + return nil, err + } + + w, err := services.GetWallet(c) + if err != nil { + return nil, err + } + + sdu, err := services.GetSdUtilityContract(c) + if err != nil { + return nil, err + } + + // Get gas estimates + opts, err := w.GetNodeAccountTransactor() + if err != nil { + return nil, err + } + + // Response + response := api.NodeRepaySDResponse{} + + tx, err := sd_utility.Repay(sdu, amountWei, opts) + if err != nil { + return nil, err + } + + response.TxHash = tx.Hash() + + return &response, nil +} diff --git a/stader/api/node/sd-status.go b/stader/api/node/sd-status.go new file mode 100644 index 000000000..a558e324a --- /dev/null +++ b/stader/api/node/sd-status.go @@ -0,0 +1,70 @@ +package node + +import ( + "math/big" + + "github.com/stader-labs/stader-node/stader-lib/node" + "github.com/stader-labs/stader-node/stader/api/validator" + + "github.com/urfave/cli" + + "github.com/stader-labs/stader-node/shared/services" + "github.com/stader-labs/stader-node/shared/types/api" +) + +func getSDStatus(c *cli.Context, amountWei *big.Int) (*api.SdStatusResponse, error) { + sdc, err := services.GetSdCollateralContract(c) + if err != nil { + return nil, err + } + + sdt, err := services.GetSdTokenContract(c) + if err != nil { + return nil, err + } + + sdu, err := services.GetSdUtilityContract(c) + // TODO: enable this when contract ready + if err != nil { + return nil, err + } + + w, err := services.GetWallet(c) + if err != nil { + return nil, err + } + + // Get node account + nodeAccount, err := w.GetNodeAccount() + if err != nil { + return nil, err + } + + prn, err := services.GetPermissionlessNodeRegistry(c) + if err != nil { + return nil, err + } + + operatorId, err := node.GetOperatorId(prn, nodeAccount.Address, nil) + if err != nil { + return nil, err + } + + totalValidatorKeys, err := node.GetTotalValidatorKeys(prn, operatorId, nil) + if err != nil { + return nil, err + } + totalValidatorNonTerminalKeys, err := node.GetTotalNonTerminalValidatorKeys(prn, nodeAccount.Address, totalValidatorKeys, nil) + if err != nil { + return nil, err + } + + sdStatus, err := validator.GetSDStatus(sdc, sdu, sdt, nodeAccount.Address, big.NewInt(int64(totalValidatorNonTerminalKeys))) + if err != nil { + return nil, err + } + + return &api.SdStatusResponse{ + SdStatus: sdStatus, + }, nil +} diff --git a/stader/api/node/utility-sd.go b/stader/api/node/utility-sd.go new file mode 100644 index 000000000..2a3cf1d7f --- /dev/null +++ b/stader/api/node/utility-sd.go @@ -0,0 +1,90 @@ +package node + +import ( + "math/big" + + "github.com/urfave/cli" + + "github.com/stader-labs/stader-node/shared/services" + "github.com/stader-labs/stader-node/shared/types/api" + "github.com/stader-labs/stader-node/stader-lib/sd_utility" +) + +func utilitySd(c *cli.Context, amountWei *big.Int) (*api.NodeUtilitySDResponse, error) { + + return &api.NodeUtilitySDResponse{}, nil + // Get services + if err := services.RequireNodeWallet(c); err != nil { + return nil, err + } + + w, err := services.GetWallet(c) + if err != nil { + return nil, err + } + + sdu, err := services.GetSdUtilityContract(c) + if err != nil { + return nil, err + } + + // Get gas estimates + opts, err := w.GetNodeAccountTransactor() + if err != nil { + return nil, err + } + + // Response + response := api.NodeUtilitySDResponse{} + + tx, err := sd_utility.Utilize(sdu, amountWei, opts) + if err != nil { + return nil, err + } + + response.TxHash = tx.Hash() + + return &response, nil + +} + +func canUtilitySd(c *cli.Context, amountWei *big.Int) (*api.CanUtilitySDResponse, error) { + + return &api.CanUtilitySDResponse{ + Error: "utility err", + }, nil + + // Get services + if err := services.RequireNodeWallet(c); err != nil { + return nil, err + } + + w, err := services.GetWallet(c) + if err != nil { + return nil, err + } + + // Response + response := api.CanUtilitySDResponse{} + + sdu, err := services.GetSdUtilityContract(c) + if err != nil { + return nil, err + } + + // Get gas estimates + opts, err := w.GetNodeAccountTransactor() + if err != nil { + return nil, err + } + + gasInfo, err := sd_utility.EstimateUtilize(sdu, amountWei, opts) + if err != nil { + return nil, err + } + + response.GasInfo = gasInfo + + return &response, nil + +} diff --git a/stader/api/validator/commands.go b/stader/api/validator/commands.go index 064640673..f83325a57 100644 --- a/stader/api/validator/commands.go +++ b/stader/api/validator/commands.go @@ -70,11 +70,11 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { Name: "deposit", Aliases: []string{"d"}, Usage: "Make a deposit and create a validator", - UsageText: "stader-cli api validator deposit amount num-validators reload-keys", + UsageText: "stader-cli api validator deposit amount utility num-validators reload-keys", Action: func(c *cli.Context) error { // Validate args - if err := cliutils.ValidateArgCount(c, 3); err != nil { + if err := cliutils.ValidateArgCount(c, 4); err != nil { return err } amountWei, err := cliutils.ValidateWeiAmount("deposit amount", c.Args().Get(0)) @@ -82,18 +82,23 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { return err } - numValidators, err := cliutils.ValidateBigInt("num-validators", c.Args().Get(1)) + utilityAmount, err := cliutils.ValidateWeiAmount("utility amount", c.Args().Get(1)) if err != nil { return err } - reloadKeys, err := cliutils.ValidateBool("reload-keys", c.Args().Get(2)) + numValidators, err := cliutils.ValidateBigInt("num-validators", c.Args().Get(2)) + if err != nil { + return err + } + + reloadKeys, err := cliutils.ValidateBool("reload-keys", c.Args().Get(3)) if err != nil { return err } // Run - response, err := nodeDeposit(c, amountWei, numValidators, reloadKeys) + response, err := nodeDeposit(c, amountWei, utilityAmount, numValidators, reloadKeys) api.PrintResponse(response, err) return nil diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index d2985970c..f26e31622 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -20,9 +20,9 @@ import ( "github.com/stader-labs/stader-node/shared/utils/validator" ) -const MaxEthThresholdUtilize = 8 +const MaxBondThreshold = 2 -func getSDStatus( +func GetSDStatus( sdc *stader.SdCollateralContractManager, sdu *stader.SDUtilityPoolContractManager, sdt *stader.Erc20TokenContractManager, @@ -30,7 +30,7 @@ func getSDStatus( totalValidatorsPostAddition *big.Int, ) (*api.SdStatus, error) { - sdUtilityBalance, err := sd_utility.UtilizerBalanceStored(sdu, operatorAddress, nil) + sdUtilityBalance, err := sd_utility.GetUtilizerLatestBalance(sdu, operatorAddress, nil) if err != nil { return nil, err } @@ -56,7 +56,7 @@ func getSDStatus( return nil, err } - maxSDToBound := new(big.Int).Mul(minimumSDToBond, big.NewInt(2)) + maxSDToBound := new(big.Int).Mul(minimumSDToBond, big.NewInt(MaxBondThreshold)) hasEnoughSdCollateral, err := sd_collateral.HasEnoughSdCollateral(sdc, operatorAddress, 1, totalValidatorsPostAddition, nil) if err != nil { @@ -73,6 +73,7 @@ func getSDStatus( PoolAvailableSDBalance: poolAvailableSDBalance, }, nil } + func canNodeDeposit(c *cli.Context, amountWei *big.Int, numValidators *big.Int, reloadKeys bool) (*api.CanNodeDepositResponse, error) { if err := services.RequireNodeWallet(c); err != nil { return nil, err @@ -106,10 +107,9 @@ func canNodeDeposit(c *cli.Context, amountWei *big.Int, numValidators *big.Int, } sdu, err := services.GetSdUtilityContract(c) - // TODO: enable this when contract ready - // if err != nil { - // return nil, err - // } + if err != nil { + return nil, err + } bc, err := services.GetBeaconClient(c) if err != nil { @@ -176,7 +176,7 @@ func canNodeDeposit(c *cli.Context, amountWei *big.Int, numValidators *big.Int, totalValidatorsPostAddition := totalValidatorNonTerminalKeys + numValidators.Uint64() - sdStatus, err := getSDStatus(sdc, sdu, sdt, nodeAccount.Address, big.NewInt(int64(totalValidatorsPostAddition))) + sdStatus, err := GetSDStatus(sdc, sdu, sdt, nodeAccount.Address, big.NewInt(int64(totalValidatorsPostAddition))) if err != nil { return nil, err } @@ -264,7 +264,14 @@ func canNodeDeposit(c *cli.Context, amountWei *big.Int, numValidators *big.Int, return nil, fmt.Errorf("error checking for nonce override: %w", err) } - gasInfo, err := node.EstimateAddValidatorKeys(prn, pubKeys, preDepositSignatures, depositSignatures, opts) + gasInfo, err := node.EstimateAddValidatorKeys( + prn, + big.NewInt(0), + pubKeys, + preDepositSignatures, + depositSignatures, + opts, + ) if err != nil { return nil, err } From 1da6fe03893c4c1e1978394b6ec88495cc8c1042 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 28 Nov 2023 20:38:54 +0700 Subject: [PATCH 004/159] Check various require --- shared/services/stader/node.go | 33 ++++++++++- shared/types/api/node.go | 92 +++++++++++++++++------------- stader-cli/node/claim-rewards.go | 8 +++ stader-cli/node/repay-exess-sd.go | 90 +++++++++++++++++++++++++++++ stader-cli/node/repay-sd.go | 20 ++++++- stader-cli/node/send-el-rewards.go | 2 +- stader-cli/node/utilize-sd.go | 32 +++++++++-- stader-cli/node/withdraw-sd.go | 9 ++- stader-cli/validator/deposit.go | 13 ++++- stader/api/node/claim-rewards.go | 10 +++- stader/api/node/repay-sd.go | 15 +++-- stader/api/node/sd-status.go | 7 +-- stader/api/node/utility-sd.go | 13 +++-- stader/api/node/withdraw-sd.go | 10 +++- stader/api/validator/deposit.go | 8 +-- 15 files changed, 281 insertions(+), 81 deletions(-) create mode 100644 stader-cli/node/repay-exess-sd.go diff --git a/shared/services/stader/node.go b/shared/services/stader/node.go index 380357f9b..65c8661bb 100644 --- a/shared/services/stader/node.go +++ b/shared/services/stader/node.go @@ -635,7 +635,6 @@ func (c *Client) SetRewardAddress(operatorRewardAddress common.Address) (api.Set return response, nil } -// Approve SD for depositing as collateral func (c *Client) NodeRepaySd(amountWei *big.Int) (api.NodeRepaySDResponse, error) { responseBytes, err := c.callAPI(fmt.Sprintf("node repay-sd %s", amountWei.String())) if err != nil { @@ -667,7 +666,6 @@ func (c *Client) CanNodeRepaySd(amountWei *big.Int) (api.CanRepaySDResponse, err return response, nil } -// Approve SD for depositing as collateral func (c *Client) NodeUtilizeSd(amountWei *big.Int) (api.NodeUtilitySDResponse, error) { responseBytes, err := c.callAPI(fmt.Sprintf("node utilize-sd %s", amountWei.String())) if err != nil { @@ -683,7 +681,6 @@ func (c *Client) NodeUtilizeSd(amountWei *big.Int) (api.NodeUtilitySDResponse, e return response, nil } -// Approve SD for depositing as collateral func (c *Client) CanNodeUtilizeSd(amountWei *big.Int) (api.CanUtilitySDResponse, error) { responseBytes, err := c.callAPI(fmt.Sprintf("node can-utilize-sd %s", amountWei.String())) if err != nil { @@ -698,3 +695,33 @@ func (c *Client) CanNodeUtilizeSd(amountWei *big.Int) (api.CanUtilitySDResponse, } return response, nil } + +func (c *Client) NodeRepayExcessSd(amountWei *big.Int) (api.NodeRepaySDResponse, error) { + responseBytes, err := c.callAPI(fmt.Sprintf("no repay-excess-sd %s", amountWei.String())) + if err != nil { + return api.NodeRepaySDResponse{}, fmt.Errorf("could not repay excess SD: %w", err) + } + var response api.NodeRepaySDResponse + if err := json.Unmarshal(responseBytes, &response); err != nil { + return api.NodeRepaySDResponse{}, fmt.Errorf("could not decode repay excess response: %w", err) + } + if response.Error != "" { + return api.NodeRepaySDResponse{}, fmt.Errorf("could not repay excess SD: %s", response.Error) + } + return response, nil +} + +func (c *Client) CanRepayExcessSD(amountWei *big.Int) (api.CanRepayExcessSDResponse, error) { + responseBytes, err := c.callAPI(fmt.Sprintf("node can-repay-excess-sd %s", amountWei.String())) + if err != nil { + return api.CanRepayExcessSDResponse{}, fmt.Errorf("could not repay excess SD: %w", err) + } + var response api.CanRepayExcessSDResponse + if err := json.Unmarshal(responseBytes, &response); err != nil { + return api.CanRepayExcessSDResponse{}, fmt.Errorf("could not decode node repay SD excess response: %w", err) + } + if response.Error != "" { + return api.CanRepayExcessSDResponse{}, fmt.Errorf("could not repay excess SD: %s", response.Error) + } + return response, nil +} diff --git a/shared/types/api/node.go b/shared/types/api/node.go index c21bce08d..931b4a601 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -92,27 +92,17 @@ type NodeDepositSdAllowanceResponse struct { } type CanNodeDepositResponse struct { - Status string `json:"status"` - Error string `json:"error"` - CanDeposit bool `json:"CanDeposit"` - InsufficientBalance bool `json:"insufficientBalance"` - InvalidAmount bool `json:"invalidAmount"` - DepositPaused bool `json:"depositPaused"` - MaxValidatorLimitReached bool `json:"maxValidatorLimitReached"` - InputKeyLimitReached bool `json:"inputKeyLimitReached"` - InputKeyLimit uint16 `json:"inputKeyLimit"` - SdStatus *SdStatus `json:"sdStatus"` - GasInfo stader.GasInfo `json:"gasInfo"` -} - -type SdStatus struct { - NotEnoughSdCollateral bool `json:"notEnoughSdCollateral"` - SdUtilityBalance *big.Int `json:"sdUtilityBalance"` - SdCollateralCurrentAmount *big.Int `json:"sdCollateralCurrentAmount"` - SdCollateralRequireAmount *big.Int `json:"sdCollateralRequireAmount"` - SdBalance *big.Int `json:"sdBalance"` - SdMaxCollateralAmount *big.Int `json:"sdMaxCollateralAmount"` - PoolAvailableSDBalance *big.Int `json:"poolAvailableSDBalance"` + Status string `json:"status"` + Error string `json:"error"` + CanDeposit bool `json:"CanDeposit"` + InsufficientBalance bool `json:"insufficientBalance"` + InvalidAmount bool `json:"invalidAmount"` + DepositPaused bool `json:"depositPaused"` + MaxValidatorLimitReached bool `json:"maxValidatorLimitReached"` + InputKeyLimitReached bool `json:"inputKeyLimitReached"` + InputKeyLimit uint16 `json:"inputKeyLimit"` + SdStatusResponse *SdStatusResponse `json:"sdStatusResponse"` + GasInfo stader.GasInfo `json:"gasInfo"` } type NodeDepositResponse struct { @@ -276,11 +266,12 @@ type SendElRewardsResponse struct { } type CanWithdrawSdResponse struct { - Status string `json:"status"` - Error string `json:"error"` - InsufficientSdCollateral bool `json:"insufficientSdCollateral"` - InsufficientWithdrawableSd bool `json:"insufficientWithdrawableSd"` - GasInfo stader.GasInfo `json:"gasInfo"` + Status string `json:"status"` + Error string `json:"error"` + InsufficientSdCollateral bool `json:"insufficientSdCollateral"` + InsufficientWithdrawableSd bool `json:"insufficientWithdrawableSd"` + SdStatusResponse *SdStatusResponse `json:"sdStatusResponse"` + GasInfo stader.GasInfo `json:"gasInfo"` } type WithdrawSdResponse struct { @@ -404,10 +395,11 @@ type NodeSignResponse struct { } type CanClaimRewards struct { - Status string `json:"status"` - Error string `json:"error"` - NoRewards bool `json:"noRewards"` - GasInfo stader.GasInfo `json:"gasInfo"` + Status string `json:"status"` + Error string `json:"error"` + NoRewards bool `json:"noRewards"` + SdStatusResponse *SdStatusResponse `json:"sdStatusResponse"` + GasInfo stader.GasInfo `json:"gasInfo"` } type ClaimRewards struct { @@ -417,9 +409,6 @@ type ClaimRewards struct { OperatorRewardAddress common.Address `json:"operatorRewardAddress"` TxHash common.Hash `json:"txHash"` } -type SdStatusResponse struct { - *SdStatus -} type NodeRepaySDResponse struct { Status string `json:"status"` @@ -428,9 +417,10 @@ type NodeRepaySDResponse struct { } type CanRepaySDResponse struct { - Status string `json:"status"` - Error string `json:"error"` - GasInfo stader.GasInfo `json:"gasInfo"` + Status string `json:"status"` + Error string `json:"error"` + GasInfo stader.GasInfo `json:"gasInfo"` + SdStatusResponse *SdStatusResponse `json:"sdStatusResponse"` } type NodeUtilitySDResponse struct { @@ -440,7 +430,31 @@ type NodeUtilitySDResponse struct { } type CanUtilitySDResponse struct { - Status string `json:"status"` - Error string `json:"error"` - GasInfo stader.GasInfo `json:"gasInfo"` + Status string `json:"status"` + Error string `json:"error"` + GasInfo stader.GasInfo `json:"gasInfo"` + SdStatusResponse *SdStatusResponse `json:"sdStatusResponse"` +} + +type SdStatusResponse struct { + NotEnoughSdCollateral bool `json:"notEnoughSdCollateral"` + SdUtilityBalance *big.Int `json:"sdUtilityBalance"` + SdCollateralCurrentAmount *big.Int `json:"sdCollateralCurrentAmount"` + SdCollateralRequireAmount *big.Int `json:"sdCollateralRequireAmount"` + SdBalance *big.Int `json:"sdBalance"` + SdMaxCollateralAmount *big.Int `json:"sdMaxCollateralAmount"` + PoolAvailableSDBalance *big.Int `json:"poolAvailableSDBalance"` +} + +type NodeRepayExcessSDResponse struct { + Status string `json:"status"` + Error string `json:"error"` + TxHash common.Hash `json:"txHash"` +} + +type CanRepayExcessSDResponse struct { + Status string `json:"status"` + Error string `json:"error"` + GasInfo stader.GasInfo `json:"gasInfo"` + SdStatusResponse *SdStatusResponse `json:"sdStatusResponse"` } diff --git a/stader-cli/node/claim-rewards.go b/stader-cli/node/claim-rewards.go index 2b56628e4..17db16a22 100644 --- a/stader-cli/node/claim-rewards.go +++ b/stader-cli/node/claim-rewards.go @@ -2,6 +2,8 @@ package node import ( "fmt" + "math/big" + "github.com/stader-labs/stader-node/shared/services/gas" "github.com/stader-labs/stader-node/shared/services/stader" cliutils "github.com/stader-labs/stader-node/shared/utils/cli" @@ -36,6 +38,12 @@ func ClaimRewards(c *cli.Context) error { return nil } + // If there is an existing utilization position + if canClaimRewardsResponse.SdStatusResponse.SdUtilityBalance.Cmp(big.NewInt(0)) > 0 { + fmt.Printf("You need to first pay %s and close the utilization position to get back your funds. Execute the following command to repay your utilized SD stader-cli repay-sd --amount \n", canClaimRewardsResponse.SdStatusResponse.SdUtilityBalance.String()) + return nil + } + err = gas.AssignMaxFeeAndLimit(canClaimRewardsResponse.GasInfo, staderClient, c.Bool("yes")) if err != nil { return err diff --git a/stader-cli/node/repay-exess-sd.go b/stader-cli/node/repay-exess-sd.go new file mode 100644 index 000000000..aff1f1515 --- /dev/null +++ b/stader-cli/node/repay-exess-sd.go @@ -0,0 +1,90 @@ +package node + +import ( + "fmt" + "math/big" + "strconv" + + "github.com/urfave/cli" + + "github.com/stader-labs/stader-node/shared/services/gas" + "github.com/stader-labs/stader-node/shared/services/stader" + cliutils "github.com/stader-labs/stader-node/shared/utils/cli" + "github.com/stader-labs/stader-node/stader-lib/utils/eth" +) + +func repayExcessSD(c *cli.Context) error { + staderClient, err := stader.NewClientFromCtx(c) + if err != nil { + return err + } + defer staderClient.Close() + + // Check and assign the EC status + err = cliutils.CheckClientStatus(staderClient) + if err != nil { + return err + } + + // Print what network we're on + err = cliutils.PrintNetwork(staderClient) + if err != nil { + return err + } + + // Get stake mount + amountInString := c.String("amount") + + amount, err := strconv.ParseFloat(amountInString, 64) + if err != nil { + return err + } + + amountWei := eth.EthToWei(amount) + + canRepayExcessSdResponse, err := staderClient.CanRepayExcessSD(amountWei) + if err != nil { + return err + } + + sdStatus := canRepayExcessSdResponse.SdStatusResponse + + // Less than 200 % + if sdStatus.SdCollateralCurrentAmount.Cmp(sdStatus.SdMaxCollateralAmount) < 0 { + fmt.Printf("Not enough SD collateral to repay utilized SD %s \n", sdStatus.PoolAvailableSDBalance.String()) + return nil + } + + // Do not had position + if sdStatus.SdUtilityBalance.Cmp(big.NewInt(0)) <= 0 { + fmt.Printf("You don't have an existing utilization position. To withdraw excess SD to your wallet execute the following command stader-cli node withdraw-sd\n") + return nil + } + + amountToRepayExcess := new(big.Int).Sub(sdStatus.SdUtilityBalance, sdStatus.SdMaxCollateralAmount) + + err = gas.AssignMaxFeeAndLimit(canRepayExcessSdResponse.GasInfo, staderClient, c.Bool("yes")) + if err != nil { + return err + } + + // Prompt for confirmation + if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintln( + "Are you sure you want to repay SD?"))) { + fmt.Println("Cancelled.") + return nil + } + + res, err := staderClient.NodeRepaySd(amountToRepayExcess) + if err != nil { + return err + } + + cliutils.PrintTransactionHash(staderClient, res.TxHash) + + if _, err = staderClient.WaitForTransaction(res.TxHash); err != nil { + return err + } + + return nil +} diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index ba3e00add..eb4ce3b6c 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -13,7 +13,6 @@ import ( ) func repaySD(c *cli.Context) error { - staderClient, err := stader.NewClientFromCtx(c) if err != nil { return err @@ -28,9 +27,13 @@ func repaySD(c *cli.Context) error { // Print what network we're on err = cliutils.PrintNetwork(staderClient) + if err != nil { + return err + } // Get stake mount amountInString := c.String("amount") + amount, err := strconv.ParseFloat(amountInString, 64) if err != nil { return err @@ -43,25 +46,36 @@ func repaySD(c *cli.Context) error { return err } + // Check if repay more than need + if amountWei.Cmp(canClaimElRewardsResponse.SdStatusResponse.SdUtilityBalance) >= 1 { + fmt.Printf("The amount is more than amount need to repay: %s \n", canClaimElRewardsResponse.SdStatusResponse.SdUtilityBalance.String()) + return nil + } + + if amountWei.Cmp(canClaimElRewardsResponse.SdStatusResponse.SdBalance) >= 1 { + fmt.Printf("The node's SD balance is not enough: %s \n", canClaimElRewardsResponse.SdStatusResponse.SdBalance.String()) + return nil + } + err = gas.AssignMaxFeeAndLimit(canClaimElRewardsResponse.GasInfo, staderClient, c.Bool("yes")) if err != nil { return err } // Prompt for confirmation - if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( + if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintln( "Are you sure you want to repay SD?"))) { fmt.Println("Cancelled.") return nil } - // Withdraw El Rewards res, err := staderClient.NodeRepaySd(amountWei) if err != nil { return err } cliutils.PrintTransactionHash(staderClient, res.TxHash) + if _, err = staderClient.WaitForTransaction(res.TxHash); err != nil { return err } diff --git a/stader-cli/node/send-el-rewards.go b/stader-cli/node/send-el-rewards.go index 284271e5f..fe3cebe76 100644 --- a/stader-cli/node/send-el-rewards.go +++ b/stader-cli/node/send-el-rewards.go @@ -2,6 +2,7 @@ package node import ( "fmt" + "github.com/stader-labs/stader-node/shared/services/gas" "github.com/stader-labs/stader-node/shared/services/stader" cliutils "github.com/stader-labs/stader-node/shared/utils/cli" @@ -48,7 +49,6 @@ func SendElRewards(c *cli.Context) error { return nil } - // Withdraw El Rewards res, err := staderClient.SendElRewards() if err != nil { return err diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index 5d4d81a61..05a568cbd 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -2,6 +2,7 @@ package node import ( "fmt" + "math/big" "strconv" "github.com/urfave/cli" @@ -13,7 +14,6 @@ import ( ) func utilizeSD(c *cli.Context) error { - staderClient, err := stader.NewClientFromCtx(c) if err != nil { return err @@ -28,40 +28,60 @@ func utilizeSD(c *cli.Context) error { // Print what network we're on err = cliutils.PrintNetwork(staderClient) + if err != nil { + return err + } // Get stake mount amountInString := c.String("amount") + amount, err := strconv.ParseFloat(amountInString, 64) if err != nil { return err } amountWei := eth.EthToWei(amount) - // Check if we can Withdraw El Rewards - canClaimElRewardsResponse, err := staderClient.CanNodeUtilizeSd(amountWei) + + canNodeUtilizeSdResponse, err := staderClient.CanNodeUtilizeSd(amountWei) if err != nil { return err } - err = gas.AssignMaxFeeAndLimit(canClaimElRewardsResponse.GasInfo, staderClient, c.Bool("yes")) + sdStatus := canNodeUtilizeSdResponse.SdStatusResponse + + // Max + maxUtility := new(big.Int).Sub(sdStatus.SdMaxCollateralAmount, sdStatus.SdUtilityBalance) + // 1. + if sdStatus.PoolAvailableSDBalance.Cmp(amountWei) < 0 { + fmt.Printf("The amount in pool is not enough: %s \n", sdStatus.PoolAvailableSDBalance.String()) + return nil + } + + // 1. + if maxUtility.Cmp(amountWei) < 0 { + fmt.Printf("The max amount is : %s \n", maxUtility.String()) + return nil + } + + err = gas.AssignMaxFeeAndLimit(canNodeUtilizeSdResponse.GasInfo, staderClient, c.Bool("yes")) if err != nil { return err } // Prompt for confirmation - if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( + if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintln( "Are you sure you want to utilize SD?"))) { fmt.Println("Cancelled.") return nil } - // Withdraw El Rewards res, err := staderClient.NodeUtilizeSd(amountWei) if err != nil { return err } cliutils.PrintTransactionHash(staderClient, res.TxHash) + if _, err = staderClient.WaitForTransaction(res.TxHash); err != nil { return err } diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index 2d9b327ed..58c0af3c5 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -2,13 +2,15 @@ package node import ( "fmt" + "math/big" + "strconv" + "github.com/stader-labs/stader-node/shared/services/gas" "github.com/stader-labs/stader-node/shared/services/stader" cliutils "github.com/stader-labs/stader-node/shared/utils/cli" "github.com/stader-labs/stader-node/shared/utils/math" "github.com/stader-labs/stader-node/stader-lib/utils/eth" "github.com/urfave/cli" - "strconv" ) func WithdrawSd(c *cli.Context) error { @@ -44,6 +46,11 @@ func WithdrawSd(c *cli.Context) error { return nil } + if canWithdrawSdResponse.SdStatusResponse.SdUtilityBalance.Cmp(big.NewInt(0)) > 0 { + fmt.Println("You have an existing utilization position, please repay your utilized SD first by executing the following command ") + return nil + } + // Assign max fees err = gas.AssignMaxFeeAndLimit(canWithdrawSdResponse.GasInfo, staderClient, c.Bool("yes")) if err != nil { diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 7f2f977dc..2cd834efd 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -82,7 +82,7 @@ func nodeDeposit(c *cli.Context) error { return nil } - sdStatus := canNodeDepositResponse.SdStatus + sdStatus := canNodeDepositResponse.SdStatusResponse amountToCollateral := new(big.Int).Sub(sdStatus.SdCollateralRequireAmount, sdStatus.SdCollateralCurrentAmount) if amountToCollateral.Cmp(big.NewInt(0)) >= 1 { @@ -119,11 +119,16 @@ func nodeDeposit(c *cli.Context) error { // Max maxUtility := new(big.Int).Sub(sdStatus.SdMaxCollateralAmount, sdStatus.SdUtilityBalance) - if minUtility.Cmp(sdStatus.PoolAvailableSDBalance) >= 0 { + if minUtility.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { fmt.Printf("Pool available SD: %s not enough to min utility : %s \n", sdStatus.PoolAvailableSDBalance.String(), minUtility.String()) return nil } + if minUtility.Cmp(maxUtility) > 0 { + fmt.Printf("Do not had enough ETH bond to utility : %s \n", minUtility.String()) + return nil + } + // Set max to pool available if sdStatus.PoolAvailableSDBalance.Cmp(maxUtility) <= 0 { fmt.Printf("Pool available SD: %f, max utility : %f \n", eth.WeiToEth(sdStatus.PoolAvailableSDBalance), eth.WeiToEth(maxUtility)) @@ -136,7 +141,7 @@ func nodeDeposit(c *cli.Context) error { fmt.Printf("Min utility %+v max %+v \n", min, max) var _utilityAmount int - msg := fmt.Sprintf("Please enter a valid number in range %f <> %f.", min, max) + msg := fmt.Sprintf("Please enter a valid number in range %f and %f.", min, max) for { s := cliutils.Prompt( msg, @@ -149,6 +154,7 @@ func nodeDeposit(c *cli.Context) error { } if _utilityAmount < int(min) || _utilityAmount > int(max) { + fmt.Printf("Invalid input, please specify an amount within %f and %f range \n", min, max) continue } @@ -189,6 +195,7 @@ func nodeDeposit(c *cli.Context) error { fmt.Println("Cancelled.") return nil } + // 1 eth max per val0.8 // Prompt for confirmation diff --git a/stader/api/node/claim-rewards.go b/stader/api/node/claim-rewards.go index df3350ea9..1fd9f709a 100644 --- a/stader/api/node/claim-rewards.go +++ b/stader/api/node/claim-rewards.go @@ -1,11 +1,12 @@ package node import ( + "math/big" + "github.com/stader-labs/stader-node/shared/services" "github.com/stader-labs/stader-node/shared/types/api" "github.com/stader-labs/stader-node/stader-lib/node" "github.com/urfave/cli" - "math/big" ) func CanClaimRewards(c *cli.Context) (*api.CanClaimRewards, error) { @@ -39,6 +40,13 @@ func CanClaimRewards(c *cli.Context) (*api.CanClaimRewards, error) { return &response, nil } + sdStatus, err := getSDStatus(c) + if err != nil { + return nil, err + } + + response.SdStatusResponse = sdStatus + opts, err := w.GetNodeAccountTransactor() if err != nil { return nil, err diff --git a/stader/api/node/repay-sd.go b/stader/api/node/repay-sd.go index cb894021c..c9bbb4ea2 100644 --- a/stader/api/node/repay-sd.go +++ b/stader/api/node/repay-sd.go @@ -12,9 +12,6 @@ import ( ) func canRepaySD(c *cli.Context, amountWei *big.Int) (*api.CanRepaySDResponse, error) { - - return &api.CanRepaySDResponse{}, nil - // Get services if err := services.RequireNodeWallet(c); err != nil { return nil, err @@ -44,17 +41,19 @@ func canRepaySD(c *cli.Context, amountWei *big.Int) (*api.CanRepaySDResponse, er return nil, err } + sdStatus, err := getSDStatus(c) + if err != nil { + return nil, err + } + + response.SdStatusResponse = sdStatus + response.GasInfo = gasInfo return &response, nil } func repaySD(c *cli.Context, amountWei *big.Int) (*api.NodeRepaySDResponse, error) { - - return &api.NodeRepaySDResponse{ - Error: "Repay err", - }, nil - // Get services if err := services.RequireNodeWallet(c); err != nil { return nil, err diff --git a/stader/api/node/sd-status.go b/stader/api/node/sd-status.go index a558e324a..e5176179e 100644 --- a/stader/api/node/sd-status.go +++ b/stader/api/node/sd-status.go @@ -12,7 +12,7 @@ import ( "github.com/stader-labs/stader-node/shared/types/api" ) -func getSDStatus(c *cli.Context, amountWei *big.Int) (*api.SdStatusResponse, error) { +func getSDStatus(c *cli.Context) (*api.SdStatusResponse, error) { sdc, err := services.GetSdCollateralContract(c) if err != nil { return nil, err @@ -24,7 +24,6 @@ func getSDStatus(c *cli.Context, amountWei *big.Int) (*api.SdStatusResponse, err } sdu, err := services.GetSdUtilityContract(c) - // TODO: enable this when contract ready if err != nil { return nil, err } @@ -64,7 +63,5 @@ func getSDStatus(c *cli.Context, amountWei *big.Int) (*api.SdStatusResponse, err return nil, err } - return &api.SdStatusResponse{ - SdStatus: sdStatus, - }, nil + return sdStatus, nil } diff --git a/stader/api/node/utility-sd.go b/stader/api/node/utility-sd.go index 2a3cf1d7f..80a212cd2 100644 --- a/stader/api/node/utility-sd.go +++ b/stader/api/node/utility-sd.go @@ -49,12 +49,6 @@ func utilitySd(c *cli.Context, amountWei *big.Int) (*api.NodeUtilitySDResponse, } func canUtilitySd(c *cli.Context, amountWei *big.Int) (*api.CanUtilitySDResponse, error) { - - return &api.CanUtilitySDResponse{ - Error: "utility err", - }, nil - - // Get services if err := services.RequireNodeWallet(c); err != nil { return nil, err } @@ -72,6 +66,13 @@ func canUtilitySd(c *cli.Context, amountWei *big.Int) (*api.CanUtilitySDResponse return nil, err } + sdStatus, err := getSDStatus(c) + if err != nil { + return nil, err + } + + response.SdStatusResponse = sdStatus + // Get gas estimates opts, err := w.GetNodeAccountTransactor() if err != nil { diff --git a/stader/api/node/withdraw-sd.go b/stader/api/node/withdraw-sd.go index 1d0ffc44b..65f175493 100644 --- a/stader/api/node/withdraw-sd.go +++ b/stader/api/node/withdraw-sd.go @@ -2,13 +2,14 @@ package node import ( "fmt" + "math/big" + "github.com/stader-labs/stader-node/shared/services" "github.com/stader-labs/stader-node/shared/types/api" "github.com/stader-labs/stader-node/shared/utils/eth1" "github.com/stader-labs/stader-node/stader-lib/node" sd_collateral "github.com/stader-labs/stader-node/stader-lib/sd-collateral" "github.com/urfave/cli" - "math/big" ) func canWithdrawSd(c *cli.Context, amountWei *big.Int) (*api.CanWithdrawSdResponse, error) { @@ -81,6 +82,13 @@ func canWithdrawSd(c *cli.Context, amountWei *big.Int) (*api.CanWithdrawSdRespon return &response, nil } + sdStatus, err := getSDStatus(c) + if err != nil { + return nil, err + } + + response.SdStatusResponse = sdStatus + opts, err := w.GetNodeAccountTransactor() if err != nil { return nil, err diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index f26e31622..53d476e7f 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -28,7 +28,7 @@ func GetSDStatus( sdt *stader.Erc20TokenContractManager, operatorAddress common.Address, totalValidatorsPostAddition *big.Int, -) (*api.SdStatus, error) { +) (*api.SdStatusResponse, error) { sdUtilityBalance, err := sd_utility.GetUtilizerLatestBalance(sdu, operatorAddress, nil) if err != nil { @@ -63,7 +63,7 @@ func GetSDStatus( return nil, err } - return &api.SdStatus{ + return &api.SdStatusResponse{ NotEnoughSdCollateral: !hasEnoughSdCollateral, SdUtilityBalance: sdUtilityBalance, SdBalance: sdBalance, @@ -181,9 +181,9 @@ func canNodeDeposit(c *cli.Context, amountWei *big.Int, numValidators *big.Int, return nil, err } - canNodeDepositResponse.SdStatus = sdStatus + canNodeDepositResponse.SdStatusResponse = sdStatus - if canNodeDepositResponse.SdStatus.NotEnoughSdCollateral { + if canNodeDepositResponse.SdStatusResponse.NotEnoughSdCollateral { return &canNodeDepositResponse, nil } From 2dff0b3b91124ee1b28d9fdc35ada6227897f7aa Mon Sep 17 00:00:00 2001 From: batphonghan Date: Wed, 29 Nov 2023 11:39:10 +0700 Subject: [PATCH 005/159] Refactoring --- shared/types/api/node.go | 2 +- stader-cli/node/claim-rewards.go | 4 +-- stader-cli/node/repay-exess-sd.go | 4 +-- stader-cli/node/repay-sd.go | 4 +-- stader-cli/node/utilize-sd.go | 2 +- stader-cli/node/withdraw-sd.go | 2 +- stader-cli/validator/deposit.go | 47 +++++++++++++++++++++++++++---- stader/api/validator/deposit.go | 2 +- 8 files changed, 52 insertions(+), 15 deletions(-) diff --git a/shared/types/api/node.go b/shared/types/api/node.go index 931b4a601..852ab2fa0 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -438,7 +438,7 @@ type CanUtilitySDResponse struct { type SdStatusResponse struct { NotEnoughSdCollateral bool `json:"notEnoughSdCollateral"` - SdUtilityBalance *big.Int `json:"sdUtilityBalance"` + SdUtilizerLatestBalance *big.Int `json:"sdUtilizerLatestBalance"` SdCollateralCurrentAmount *big.Int `json:"sdCollateralCurrentAmount"` SdCollateralRequireAmount *big.Int `json:"sdCollateralRequireAmount"` SdBalance *big.Int `json:"sdBalance"` diff --git a/stader-cli/node/claim-rewards.go b/stader-cli/node/claim-rewards.go index 17db16a22..2e27216c0 100644 --- a/stader-cli/node/claim-rewards.go +++ b/stader-cli/node/claim-rewards.go @@ -39,8 +39,8 @@ func ClaimRewards(c *cli.Context) error { } // If there is an existing utilization position - if canClaimRewardsResponse.SdStatusResponse.SdUtilityBalance.Cmp(big.NewInt(0)) > 0 { - fmt.Printf("You need to first pay %s and close the utilization position to get back your funds. Execute the following command to repay your utilized SD stader-cli repay-sd --amount \n", canClaimRewardsResponse.SdStatusResponse.SdUtilityBalance.String()) + if canClaimRewardsResponse.SdStatusResponse.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { + fmt.Printf("You need to first pay %s and close the utilization position to get back your funds. Execute the following command to repay your utilized SD stader-cli repay-sd --amount \n", canClaimRewardsResponse.SdStatusResponse.SdUtilizerLatestBalance.String()) return nil } diff --git a/stader-cli/node/repay-exess-sd.go b/stader-cli/node/repay-exess-sd.go index aff1f1515..36e6bd7c5 100644 --- a/stader-cli/node/repay-exess-sd.go +++ b/stader-cli/node/repay-exess-sd.go @@ -56,12 +56,12 @@ func repayExcessSD(c *cli.Context) error { } // Do not had position - if sdStatus.SdUtilityBalance.Cmp(big.NewInt(0)) <= 0 { + if sdStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) <= 0 { fmt.Printf("You don't have an existing utilization position. To withdraw excess SD to your wallet execute the following command stader-cli node withdraw-sd\n") return nil } - amountToRepayExcess := new(big.Int).Sub(sdStatus.SdUtilityBalance, sdStatus.SdMaxCollateralAmount) + amountToRepayExcess := new(big.Int).Sub(sdStatus.SdUtilizerLatestBalance, sdStatus.SdMaxCollateralAmount) err = gas.AssignMaxFeeAndLimit(canRepayExcessSdResponse.GasInfo, staderClient, c.Bool("yes")) if err != nil { diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index eb4ce3b6c..830115985 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -47,8 +47,8 @@ func repaySD(c *cli.Context) error { } // Check if repay more than need - if amountWei.Cmp(canClaimElRewardsResponse.SdStatusResponse.SdUtilityBalance) >= 1 { - fmt.Printf("The amount is more than amount need to repay: %s \n", canClaimElRewardsResponse.SdStatusResponse.SdUtilityBalance.String()) + if amountWei.Cmp(canClaimElRewardsResponse.SdStatusResponse.SdUtilizerLatestBalance) >= 1 { + fmt.Printf("The amount is more than amount need to repay: %s \n", canClaimElRewardsResponse.SdStatusResponse.SdUtilizerLatestBalance.String()) return nil } diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index 05a568cbd..abdfb88d4 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -50,7 +50,7 @@ func utilizeSD(c *cli.Context) error { sdStatus := canNodeUtilizeSdResponse.SdStatusResponse // Max - maxUtility := new(big.Int).Sub(sdStatus.SdMaxCollateralAmount, sdStatus.SdUtilityBalance) + maxUtility := new(big.Int).Sub(sdStatus.SdMaxCollateralAmount, sdStatus.SdUtilizerLatestBalance) // 1. if sdStatus.PoolAvailableSDBalance.Cmp(amountWei) < 0 { fmt.Printf("The amount in pool is not enough: %s \n", sdStatus.PoolAvailableSDBalance.String()) diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index 58c0af3c5..aac3cb85c 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -46,7 +46,7 @@ func WithdrawSd(c *cli.Context) error { return nil } - if canWithdrawSdResponse.SdStatusResponse.SdUtilityBalance.Cmp(big.NewInt(0)) > 0 { + if canWithdrawSdResponse.SdStatusResponse.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { fmt.Println("You have an existing utilization position, please repay your utilized SD first by executing the following command ") return nil } diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 2cd834efd..552c1786b 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -16,6 +16,8 @@ import ( "github.com/urfave/cli" ) +const Decimal = 18 + func nodeDeposit(c *cli.Context) error { staderClient, err := stader.NewClientFromCtx(c) @@ -85,18 +87,53 @@ func nodeDeposit(c *cli.Context) error { sdStatus := canNodeDepositResponse.SdStatusResponse amountToCollateral := new(big.Int).Sub(sdStatus.SdCollateralRequireAmount, sdStatus.SdCollateralCurrentAmount) + fmt.Printf( + "The node %s%s%s current had %.6f SD in collateral.\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, + math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralCurrentAmount), Decimal)) + + fmt.Printf( + "The node %s%s%s need %.6f SD in collateral after deposit.\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, + math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralRequireAmount), Decimal)) + + fmt.Printf( + "The node %s%s%s can had max %.6f SD in collateral after deposit.\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, + math.RoundDown(eth.WeiToEth(sdStatus.SdMaxCollateralAmount), Decimal)) + + fmt.Printf( + "The node %s%s%s current utility %.6f SD.\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, + math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizerLatestBalance), Decimal)) + if amountToCollateral.Cmp(big.NewInt(0)) >= 1 { fmt.Printf( "The node %s%s%s need %.6f SD to meet collateral require.\n\n", log.ColorBlue, status.AccountAddress, log.ColorReset, - math.RoundDown(eth.WeiToEth(amountToCollateral), 18)) + math.RoundDown(eth.WeiToEth(amountToCollateral), Decimal)) } utilityAmount := big.NewInt(0) if sdStatus.NotEnoughSdCollateral { + fmt.Printf( + "The node %s%s%s had not enough SD in collateral.\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, + ) + // had SD but not in contract // User had enough to deposit-sd @@ -117,7 +154,7 @@ func nodeDeposit(c *cli.Context) error { minUtility := new(big.Int).Sub(sdStatus.SdCollateralRequireAmount, sdStatus.SdCollateralCurrentAmount) // Max - maxUtility := new(big.Int).Sub(sdStatus.SdMaxCollateralAmount, sdStatus.SdUtilityBalance) + maxUtility := new(big.Int).Sub(sdStatus.SdMaxCollateralAmount, sdStatus.SdUtilizerLatestBalance) if minUtility.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { fmt.Printf("Pool available SD: %s not enough to min utility : %s \n", sdStatus.PoolAvailableSDBalance.String(), minUtility.String()) @@ -141,7 +178,7 @@ func nodeDeposit(c *cli.Context) error { fmt.Printf("Min utility %+v max %+v \n", min, max) var _utilityAmount int - msg := fmt.Sprintf("Please enter a valid number in range %f and %f.", min, max) + msg := fmt.Sprintf("Please enter a valid number in range %f and %f: ", min, max) for { s := cliutils.Prompt( msg, @@ -154,7 +191,7 @@ func nodeDeposit(c *cli.Context) error { } if _utilityAmount < int(min) || _utilityAmount > int(max) { - fmt.Printf("Invalid input, please specify an amount within %f and %f range \n", min, max) + fmt.Printf("Invalid input, please specify an amount within %f and %f range:\n", min, max) continue } @@ -210,7 +247,7 @@ func nodeDeposit(c *cli.Context) error { } // Make deposit - response, err := staderClient.NodeDeposit(baseAmount, big.NewInt(int64(numValidators)), utilityAmount, true) + response, err := staderClient.NodeDeposit(baseAmount, big.NewInt(int64(numValidators)), utilityAmount, false) if err != nil { return err } diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index 53d476e7f..4185b23e7 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -65,7 +65,7 @@ func GetSDStatus( return &api.SdStatusResponse{ NotEnoughSdCollateral: !hasEnoughSdCollateral, - SdUtilityBalance: sdUtilityBalance, + SdUtilizerLatestBalance: sdUtilityBalance, SdBalance: sdBalance, SdCollateralCurrentAmount: sdCollateralCurrentAmount, SdCollateralRequireAmount: minimumSDToBond, From ce7b118d76dd076828b763e3a27784eeffc4c831 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Wed, 29 Nov 2023 12:35:02 +0700 Subject: [PATCH 006/159] Refactor --- shared/utils/cli/prompt.go | 8 ++++++ stader-cli/node/repay-sd.go | 7 +++-- stader-cli/node/utilize-sd.go | 49 +++++++++++++++++++++++++++------ stader-cli/validator/deposit.go | 11 +++++--- 4 files changed, 60 insertions(+), 15 deletions(-) diff --git a/shared/utils/cli/prompt.go b/shared/utils/cli/prompt.go index ccccef233..af0e9de24 100644 --- a/shared/utils/cli/prompt.go +++ b/shared/utils/cli/prompt.go @@ -91,3 +91,11 @@ func ConfirmSecureSession(warning string) bool { return true } + +func PrintError(msg string) { + fmt.Printf("%s%s%s\n", colorRed, msg, colorReset) +} + +func PrintWarning(msg string) { + fmt.Printf("%s%s%s\n", colorYellow, msg, colorReset) +} diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index 830115985..6999b823c 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -46,14 +46,15 @@ func repaySD(c *cli.Context) error { return err } - // Check if repay more than need + // 1. Check if repay more than need if amountWei.Cmp(canClaimElRewardsResponse.SdStatusResponse.SdUtilizerLatestBalance) >= 1 { - fmt.Printf("The amount is more than amount need to repay: %s \n", canClaimElRewardsResponse.SdStatusResponse.SdUtilizerLatestBalance.String()) + cliutils.PrintError(fmt.Sprintf("Repayment amount greater than the Utilization position: %s \n", canClaimElRewardsResponse.SdStatusResponse.SdUtilizerLatestBalance.String())) return nil } + // 2. If user had enough to repay if amountWei.Cmp(canClaimElRewardsResponse.SdStatusResponse.SdBalance) >= 1 { - fmt.Printf("The node's SD balance is not enough: %s \n", canClaimElRewardsResponse.SdStatusResponse.SdBalance.String()) + cliutils.PrintError(fmt.Sprintf("The node's SD balance is not enough SD, current SD available: %f \n", eth.WeiToEth(canClaimElRewardsResponse.SdStatusResponse.SdBalance))) return nil } diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index abdfb88d4..399d08af4 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -9,6 +9,7 @@ import ( "github.com/stader-labs/stader-node/shared/services/gas" "github.com/stader-labs/stader-node/shared/services/stader" + "github.com/stader-labs/stader-node/shared/types/api" cliutils "github.com/stader-labs/stader-node/shared/utils/cli" "github.com/stader-labs/stader-node/stader-lib/utils/eth" ) @@ -49,17 +50,25 @@ func utilizeSD(c *cli.Context) error { sdStatus := canNodeUtilizeSdResponse.SdStatusResponse + // min + minUtility := GetMinUtility(sdStatus) + // Max - maxUtility := new(big.Int).Sub(sdStatus.SdMaxCollateralAmount, sdStatus.SdUtilizerLatestBalance) - // 1. + maxUtility := GetMaxUtility(sdStatus) + + if maxUtility.Cmp(minUtility) < 0 { + cliutils.PrintError("Insufficient ETH bonding") + return nil + } + // 1. If there's enough SD in pool if sdStatus.PoolAvailableSDBalance.Cmp(amountWei) < 0 { - fmt.Printf("The amount in pool is not enough: %s \n", sdStatus.PoolAvailableSDBalance.String()) + fmt.Printf("The amount in pool: %f is not enough\n", eth.WeiToEth(sdStatus.PoolAvailableSDBalance)) return nil } - // 1. - if maxUtility.Cmp(amountWei) < 0 { - fmt.Printf("The max amount is : %s \n", maxUtility.String()) + // 2. If not utilize to max amount + if maxUtility.Cmp(amountWei) < 0 || minUtility.Cmp(amountWei) > 0 { + cliutils.PrintError(fmt.Sprintf("Invalid input, please specify an amount within %f and %f range \n", eth.WeiToEth(minUtility), eth.WeiToEth(maxUtility))) return nil } @@ -69,8 +78,8 @@ func utilizeSD(c *cli.Context) error { } // Prompt for confirmation - if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintln( - "Are you sure you want to utilize SD?"))) { + if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( + "Are you sure you want to utilize %+v SD? ", amount))) { fmt.Println("Cancelled.") return nil } @@ -88,3 +97,27 @@ func utilizeSD(c *cli.Context) error { return nil } + +func GetMinUtility(sdStatus *api.SdStatusResponse) *big.Int { + minUtility := new(big.Int).Sub(sdStatus.SdCollateralRequireAmount, sdStatus.SdCollateralCurrentAmount) + + if minUtility.Cmp(big.NewInt(0)) < 0 { + cliutils.PrintWarning("Over collateral") + + minUtility = big.NewInt(0) + } + + return minUtility +} + +func GetMaxUtility(sdStatus *api.SdStatusResponse) *big.Int { + maxUtility := new(big.Int).Sub(sdStatus.SdMaxCollateralAmount, sdStatus.SdUtilizerLatestBalance) + + if maxUtility.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { + cliutils.PrintWarning("Pool not had enough SD") + + maxUtility = sdStatus.PoolAvailableSDBalance + } + + return maxUtility +} diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 552c1786b..bbda0f5a3 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -151,18 +151,21 @@ func nodeDeposit(c *cli.Context) error { // Check if can borrow here // ask utilize or deposit-sd - minUtility := new(big.Int).Sub(sdStatus.SdCollateralRequireAmount, sdStatus.SdCollateralCurrentAmount) + minUtility := node.GetMinUtility(sdStatus) // Max - maxUtility := new(big.Int).Sub(sdStatus.SdMaxCollateralAmount, sdStatus.SdUtilizerLatestBalance) + maxUtility := node.GetMaxUtility(sdStatus) + // 1. If the pool had enough SD if minUtility.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { - fmt.Printf("Pool available SD: %s not enough to min utility : %s \n", sdStatus.PoolAvailableSDBalance.String(), minUtility.String()) + cliutils.PrintError( + fmt.Sprintf("Pool available SD: %s not enough to min utility : %s \n", sdStatus.PoolAvailableSDBalance.String(), minUtility.String())) return nil } + // 2. If user had enough Eth if minUtility.Cmp(maxUtility) > 0 { - fmt.Printf("Do not had enough ETH bond to utility : %s \n", minUtility.String()) + cliutils.PrintError(fmt.Sprintf("Do not had enough ETH bond to utility : %s \n", minUtility.String())) return nil } From 915985b92c00fb3f53c4b9f82a62221ed5a9f0c7 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Wed, 29 Nov 2023 16:46:19 +0700 Subject: [PATCH 007/159] Refactor --- stader-cli/node/claim-rewards.go | 2 +- stader-cli/node/claim-sp-rewards.go | 9 +++++---- stader-cli/node/withdraw-sd.go | 2 +- stader/api/node/withdraw-sd.go | 14 +++++++------- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/stader-cli/node/claim-rewards.go b/stader-cli/node/claim-rewards.go index 2e27216c0..ba7bc53f6 100644 --- a/stader-cli/node/claim-rewards.go +++ b/stader-cli/node/claim-rewards.go @@ -40,7 +40,7 @@ func ClaimRewards(c *cli.Context) error { // If there is an existing utilization position if canClaimRewardsResponse.SdStatusResponse.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { - fmt.Printf("You need to first pay %s and close the utilization position to get back your funds. Execute the following command to repay your utilized SD stader-cli repay-sd --amount \n", canClaimRewardsResponse.SdStatusResponse.SdUtilizerLatestBalance.String()) + cliutils.PrintError(fmt.Sprintf("You need to first pay %f and close the utilization position to get back your funds. Execute the following command to repay your utilized SD stader-cli repay-sd --amount \n", eth.WeiToEth(canClaimRewardsResponse.SdStatusResponse.SdUtilizerLatestBalance))) return nil } diff --git a/stader-cli/node/claim-sp-rewards.go b/stader-cli/node/claim-sp-rewards.go index 68ec2a4b3..e11d55f85 100644 --- a/stader-cli/node/claim-sp-rewards.go +++ b/stader-cli/node/claim-sp-rewards.go @@ -2,15 +2,16 @@ package node import ( "fmt" + "math/big" + "strconv" + "strings" + "github.com/stader-labs/stader-node/shared/services/gas" "github.com/stader-labs/stader-node/shared/services/stader" cliutils "github.com/stader-labs/stader-node/shared/utils/cli" "github.com/stader-labs/stader-node/shared/utils/math" "github.com/stader-labs/stader-node/stader-lib/utils/eth" "github.com/urfave/cli" - "math/big" - "strconv" - "strings" ) func ClaimSpRewards(c *cli.Context) error { @@ -65,7 +66,7 @@ func ClaimSpRewards(c *cli.Context) error { cycleIndexes = append(cycleIndexes, big.NewInt(cycleInfo.MerkleProofInfo.Cycle)) } - fmt.Println("Following are the unclaimed cycles, Please enter in a comma seperated string the cycles you want to claim rewards for:\n") + fmt.Println("Following are the unclaimed cycles, Please enter in a comma separated string the cycles you want to claim rewards for:") fmt.Printf("%-18s%-14.30s%-14.10s%-10s\n", "Cycle Number", "Cycle Date", "ETH Rewards", "SD Rewards") cyclesToClaim := map[int64]bool{} diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index aac3cb85c..b268fb6f0 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -47,7 +47,7 @@ func WithdrawSd(c *cli.Context) error { } if canWithdrawSdResponse.SdStatusResponse.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { - fmt.Println("You have an existing utilization position, please repay your utilized SD first by executing the following command ") + cliutils.PrintWarning("You have an existing utilization position, please repay your utilized SD first by executing the following command ") return nil } diff --git a/stader/api/node/withdraw-sd.go b/stader/api/node/withdraw-sd.go index 65f175493..2622ecacd 100644 --- a/stader/api/node/withdraw-sd.go +++ b/stader/api/node/withdraw-sd.go @@ -46,6 +46,13 @@ func canWithdrawSd(c *cli.Context, amountWei *big.Int) (*api.CanWithdrawSdRespon return nil, err } + sdStatus, err := getSDStatus(c) + if err != nil { + return nil, err + } + + response.SdStatusResponse = sdStatus + // get current sd collateral operatorSdCollateral, err := sd_collateral.GetOperatorSdBalance(sdc, nodeAccount.Address, nil) if err != nil { @@ -82,13 +89,6 @@ func canWithdrawSd(c *cli.Context, amountWei *big.Int) (*api.CanWithdrawSdRespon return &response, nil } - sdStatus, err := getSDStatus(c) - if err != nil { - return nil, err - } - - response.SdStatusResponse = sdStatus - opts, err := w.GetNodeAccountTransactor() if err != nil { return nil, err From 89743924eef9782d27789f45ccff167c2ab0e510 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Thu, 30 Nov 2023 15:48:02 +0700 Subject: [PATCH 008/159] Update cli --- shared/services/stader/node.go | 15 +++++ stader-cli/node/claim-rewards.go | 5 +- stader-cli/node/commands.go | 39 +++++++++---- stader-cli/node/repay-exess-sd.go | 16 +++++- stader-cli/node/repay-sd.go | 6 +- stader-cli/node/utilize-sd.go | 93 ++++++++++++++++++++----------- stader-cli/node/withdraw-sd.go | 4 +- stader-cli/validator/deposit.go | 93 ++++++------------------------- stader/api/node/claim-rewards.go | 2 +- stader/api/node/commands.go | 17 ++++++ stader/api/node/repay-sd.go | 2 +- stader/api/node/sd-status.go | 6 +- stader/api/node/utility-sd.go | 8 --- stader/api/node/withdraw-sd.go | 2 +- 14 files changed, 163 insertions(+), 145 deletions(-) diff --git a/shared/services/stader/node.go b/shared/services/stader/node.go index 65c8661bb..90dd2dc73 100644 --- a/shared/services/stader/node.go +++ b/shared/services/stader/node.go @@ -725,3 +725,18 @@ func (c *Client) CanRepayExcessSD(amountWei *big.Int) (api.CanRepayExcessSDRespo } return response, nil } + +func (c *Client) GetSDStatus() (api.GetSdStatusResponse, error) { + responseBytes, err := c.callAPI("node get-sd-status") + if err != nil { + return api.GetSdStatusResponse{}, fmt.Errorf("could not get-sd-status: %w", err) + } + var response api.GetSdStatusResponse + if err := json.Unmarshal(responseBytes, &response); err != nil { + return api.GetSdStatusResponse{}, fmt.Errorf("could not decode node get SD status response: %w", err) + } + if response.Error != "" { + return api.GetSdStatusResponse{}, fmt.Errorf("could not get SD status: %s", response.Error) + } + return response, nil +} diff --git a/stader-cli/node/claim-rewards.go b/stader-cli/node/claim-rewards.go index ba7bc53f6..8a2991152 100644 --- a/stader-cli/node/claim-rewards.go +++ b/stader-cli/node/claim-rewards.go @@ -38,7 +38,10 @@ func ClaimRewards(c *cli.Context) error { return nil } - // If there is an existing utilization position + // TODO: + // 1. How much SD fee need to repay + // 2. Based on the current Health Factor, you can claim upto ETH. + if canClaimRewardsResponse.SdStatusResponse.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { cliutils.PrintError(fmt.Sprintf("You need to first pay %f and close the utilization position to get back your funds. Execute the following command to repay your utilized SD stader-cli repay-sd --amount \n", eth.WeiToEth(canClaimRewardsResponse.SdStatusResponse.SdUtilizerLatestBalance))) return nil diff --git a/stader-cli/node/commands.go b/stader-cli/node/commands.go index 333fbcede..77b90443b 100644 --- a/stader-cli/node/commands.go +++ b/stader-cli/node/commands.go @@ -369,27 +369,17 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { }, }, { - Name: "utilization-sd", + Name: "utilize-sd", Aliases: []string{"us"}, Usage: "Utilize from the Utility pool.", - UsageText: "stader-cli node utilization-sd [options]", + UsageText: "stader-cli node utilization-sd", Flags: []cli.Flag{ - cli.StringFlag{ - Name: "amount, a", - Usage: "The amount of SD to utilize", - }, cli.BoolFlag{ Name: "yes, y", Usage: "Automatically confirm SD utilize", }, }, Action: func(c *cli.Context) error { - - if _, err := cliutils.ValidatePositiveEthAmount("sd utilize amount", c.String("amount")); err != nil { - return err - } - - // Run return utilizeSD(c) }, }, @@ -418,6 +408,31 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { return repaySD(c) }, }, + { + Name: "repay-excess-sd", + Aliases: []string{"res"}, + Usage: "Repay utilized SD using the excess SD collateral", + UsageText: "stader-cli node repay-excess-sd [options]", + Flags: []cli.Flag{ + cli.StringFlag{ + Name: "amount, a", + Usage: "The amount of SD to repay excess", + }, + cli.BoolFlag{ + Name: "yes, y", + Usage: "Automatically confirm SD repay", + }, + }, + Action: func(c *cli.Context) error { + + if _, err := cliutils.ValidatePositiveEthAmount("sd repay amount", c.String("amount")); err != nil { + return err + } + + // Run + return repayExcessSD(c) + }, + }, }, }) } diff --git a/stader-cli/node/repay-exess-sd.go b/stader-cli/node/repay-exess-sd.go index 36e6bd7c5..c340aee5c 100644 --- a/stader-cli/node/repay-exess-sd.go +++ b/stader-cli/node/repay-exess-sd.go @@ -57,11 +57,16 @@ func repayExcessSD(c *cli.Context) error { // Do not had position if sdStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) <= 0 { - fmt.Printf("You don't have an existing utilization position. To withdraw excess SD to your wallet execute the following command stader-cli node withdraw-sd\n") + fmt.Printf("You don't have an existing utilization position. To withdraw excess SD to your wallet execute the following command: stader-cli node withdraw-sd --amount \n") return nil } - amountToRepayExcess := new(big.Int).Sub(sdStatus.SdUtilizerLatestBalance, sdStatus.SdMaxCollateralAmount) + amountExcess := new(big.Int).Sub(sdStatus.SdMaxCollateralAmount, sdStatus.SdCollateralCurrentAmount) + + if amountExcess.Cmp(big.NewInt(0)) <= 0 { + fmt.Printf("You don't have excess SD collateral\n") + return nil + } err = gas.AssignMaxFeeAndLimit(canRepayExcessSdResponse.GasInfo, staderClient, c.Bool("yes")) if err != nil { @@ -75,7 +80,12 @@ func repayExcessSD(c *cli.Context) error { return nil } - res, err := staderClient.NodeRepaySd(amountToRepayExcess) + _, err = staderClient.CanNodeRepaySd(amountWei) + if err != nil { + return err + } + + res, err := staderClient.NodeRepaySd(amountExcess) if err != nil { return err } diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index 6999b823c..0a64a0497 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -40,7 +40,7 @@ func repaySD(c *cli.Context) error { } amountWei := eth.EthToWei(amount) - // Check if we can Withdraw El Rewards + canClaimElRewardsResponse, err := staderClient.CanNodeRepaySd(amountWei) if err != nil { return err @@ -64,8 +64,8 @@ func repaySD(c *cli.Context) error { } // Prompt for confirmation - if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintln( - "Are you sure you want to repay SD?"))) { + if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( + "Are you sure you want to repay %f SD?", amount))) { fmt.Println("Cancelled.") return nil } diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index 399d08af4..1f508ea4e 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -33,45 +33,18 @@ func utilizeSD(c *cli.Context) error { return err } - // Get stake mount - amountInString := c.String("amount") - - amount, err := strconv.ParseFloat(amountInString, 64) + sdStatusResponse, err := staderClient.GetSDStatus() if err != nil { return err } - amountWei := eth.EthToWei(amount) + amountWei := PromChooseUtilityAmount(sdStatusResponse.SDStatus) canNodeUtilizeSdResponse, err := staderClient.CanNodeUtilizeSd(amountWei) if err != nil { return err } - sdStatus := canNodeUtilizeSdResponse.SdStatusResponse - - // min - minUtility := GetMinUtility(sdStatus) - - // Max - maxUtility := GetMaxUtility(sdStatus) - - if maxUtility.Cmp(minUtility) < 0 { - cliutils.PrintError("Insufficient ETH bonding") - return nil - } - // 1. If there's enough SD in pool - if sdStatus.PoolAvailableSDBalance.Cmp(amountWei) < 0 { - fmt.Printf("The amount in pool: %f is not enough\n", eth.WeiToEth(sdStatus.PoolAvailableSDBalance)) - return nil - } - - // 2. If not utilize to max amount - if maxUtility.Cmp(amountWei) < 0 || minUtility.Cmp(amountWei) > 0 { - cliutils.PrintError(fmt.Sprintf("Invalid input, please specify an amount within %f and %f range \n", eth.WeiToEth(minUtility), eth.WeiToEth(maxUtility))) - return nil - } - err = gas.AssignMaxFeeAndLimit(canNodeUtilizeSdResponse.GasInfo, staderClient, c.Bool("yes")) if err != nil { return err @@ -79,7 +52,7 @@ func utilizeSD(c *cli.Context) error { // Prompt for confirmation if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( - "Are you sure you want to utilize %+v SD? ", amount))) { + "Are you sure you want to utilize %f SD? ", eth.WeiToEth(amountWei)))) { fmt.Println("Cancelled.") return nil } @@ -102,8 +75,6 @@ func GetMinUtility(sdStatus *api.SdStatusResponse) *big.Int { minUtility := new(big.Int).Sub(sdStatus.SdCollateralRequireAmount, sdStatus.SdCollateralCurrentAmount) if minUtility.Cmp(big.NewInt(0)) < 0 { - cliutils.PrintWarning("Over collateral") - minUtility = big.NewInt(0) } @@ -114,10 +85,64 @@ func GetMaxUtility(sdStatus *api.SdStatusResponse) *big.Int { maxUtility := new(big.Int).Sub(sdStatus.SdMaxCollateralAmount, sdStatus.SdUtilizerLatestBalance) if maxUtility.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { - cliutils.PrintWarning("Pool not had enough SD") - maxUtility = sdStatus.PoolAvailableSDBalance } return maxUtility } + +func PromChooseUtilityAmount(sdStatus *api.SdStatusResponse) *big.Int { + minUtility := GetMinUtility(sdStatus) + maxUtility := GetMaxUtility(sdStatus) + + // 1. If the pool had enough SD + if minUtility.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { + cliutils.PrintError( + fmt.Sprintf("Pool available SD: %s not enough to min utility : %s \n", sdStatus.PoolAvailableSDBalance.String(), minUtility.String())) + return nil + } + + // 2. If user had enough Eth + if minUtility.Cmp(maxUtility) > 0 { + cliutils.PrintError(fmt.Sprintf("Do not had enough ETH bond to utility : %s \n", minUtility.String())) + return nil + } + + // Set max to pool available + if sdStatus.PoolAvailableSDBalance.Cmp(maxUtility) <= 0 { + maxUtility = sdStatus.PoolAvailableSDBalance + } + + min := eth.WeiToEth(minUtility) + max := eth.WeiToEth(maxUtility) + + var _utilityAmount int + + var err error + + msg := fmt.Sprintf("Please enter a number of SD to utilize in range %f and %f: ", min, max) + + for { + s := cliutils.Prompt( + msg, + "^[1-9][0-9]*$", + msg) + + _utilityAmount, err = strconv.Atoi(s) + if err != nil { + fmt.Println("Please enter a valid number.") + continue + } + + if _utilityAmount < int(min) || _utilityAmount > int(max) { + fmt.Printf("Invalid input, please specify an amount within %f and %f range:\n", min, max) + continue + } + + break + } + + utilityAmount := eth.EthToWei(float64(_utilityAmount)) + + return utilityAmount +} diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index b268fb6f0..9d969cc92 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -42,12 +42,12 @@ func WithdrawSd(c *cli.Context) error { return nil } if canWithdrawSdResponse.InsufficientSdCollateral { - fmt.Println("Insufficient SD collateral!") + fmt.Println("SD collateral less tha 200%") return nil } if canWithdrawSdResponse.SdStatusResponse.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { - cliutils.PrintWarning("You have an existing utilization position, please repay your utilized SD first by executing the following command ") + cliutils.PrintWarning("You have an existing utilization position, please repay your utilized SD first by executing the following command: stader-cli repay-sd --amount ") return nil } diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index bbda0f5a3..720a3cdaa 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -3,7 +3,6 @@ package validator import ( "fmt" "math/big" - "strconv" "github.com/stader-labs/stader-node/shared/services/gas" "github.com/stader-labs/stader-node/shared/utils/log" @@ -76,7 +75,7 @@ func nodeDeposit(c *cli.Context) error { } if canNodeDepositResponse.InsufficientBalance { - fmt.Printf("Account does not have enough balance!") + fmt.Printf("Account does not have enough ETH balance!") return nil } if canNodeDepositResponse.DepositPaused { @@ -128,85 +127,38 @@ func nodeDeposit(c *cli.Context) error { if sdStatus.NotEnoughSdCollateral { fmt.Printf( - "The node %s%s%s had not enough SD in collateral.\n\n", + "The node %s%s%s had not enough SD in collateral please deposit SD.\n\n", log.ColorBlue, status.AccountAddress, log.ColorReset, ) - // had SD but not in contract + ops := []string{"Deposit from node wallet", "Utility SD"} + i, _ := cliutils.Select("Choose option", ops) + + switch i { + case 0: + if status.AccountBalances.Sd.Cmp(amountToCollateral) < 0 { + cliutils.PrintError("You do not had enough SD in your wallet. Please deposit and try again") + return nil + } - // User had enough to deposit-sd - // 1. deposit-sd - // 2. call deposit again - if amountToCollateral.Cmp(sdStatus.SdBalance) <= 0 { err = node.NodeDepositSdWithAmount(staderClient, amountToCollateral, autoConfirm, 0) if err != nil { return err } return nodeDeposit(c) - } else { - // User had not enough to deposit-sd - // Check if can borrow here - // ask utilize or deposit-sd - minUtility := node.GetMinUtility(sdStatus) - - // Max - maxUtility := node.GetMaxUtility(sdStatus) - - // 1. If the pool had enough SD - if minUtility.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { - cliutils.PrintError( - fmt.Sprintf("Pool available SD: %s not enough to min utility : %s \n", sdStatus.PoolAvailableSDBalance.String(), minUtility.String())) - return nil - } - - // 2. If user had enough Eth - if minUtility.Cmp(maxUtility) > 0 { - cliutils.PrintError(fmt.Sprintf("Do not had enough ETH bond to utility : %s \n", minUtility.String())) - return nil - } - - // Set max to pool available - if sdStatus.PoolAvailableSDBalance.Cmp(maxUtility) <= 0 { - fmt.Printf("Pool available SD: %f, max utility : %f \n", eth.WeiToEth(sdStatus.PoolAvailableSDBalance), eth.WeiToEth(maxUtility)) - maxUtility = sdStatus.PoolAvailableSDBalance - } + case 1: + utilityAmount = node.PromChooseUtilityAmount(sdStatus) - min := eth.WeiToEth(minUtility) - max := eth.WeiToEth(maxUtility) - - fmt.Printf("Min utility %+v max %+v \n", min, max) - - var _utilityAmount int - msg := fmt.Sprintf("Please enter a valid number in range %f and %f: ", min, max) - for { - s := cliutils.Prompt( - msg, - "^[1-9][0-9]*$", - msg) - _utilityAmount, err = strconv.Atoi(s) - if err != nil { - fmt.Println("Please enter a valid number.") - continue - } - - if _utilityAmount < int(min) || _utilityAmount > int(max) { - fmt.Printf("Invalid input, please specify an amount within %f and %f range:\n", min, max) - continue - } - - break - } - - utilityAmount = eth.EthToWei(float64(_utilityAmount)) - - if !cliutils.Confirm(fmt.Sprintf("You're about to utility %d SD: ", _utilityAmount)) { + if !cliutils.Confirm(fmt.Sprintf("You're about to utility %f SD: ", eth.WeiToEth(utilityAmount))) { fmt.Printf("Cancel \n") return nil } + default: + return nil } } @@ -225,19 +177,6 @@ func nodeDeposit(c *cli.Context) error { return err } - // Prompt for confirmation - if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( - "You are about to utility %f SD to create %d validators.\n"+ - "%sARE YOU SURE YOU WANT TO DO THIS?!%s", - eth.WeiToEth(utilityAmount), numValidators, - log.ColorYellow, - log.ColorReset))) { - fmt.Println("Cancelled.") - return nil - } - - // 1 eth max per val0.8 - // Prompt for confirmation if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( "You are about to deposit %d ETH to create %d validators.\n"+ diff --git a/stader/api/node/claim-rewards.go b/stader/api/node/claim-rewards.go index 1fd9f709a..44290ef48 100644 --- a/stader/api/node/claim-rewards.go +++ b/stader/api/node/claim-rewards.go @@ -45,7 +45,7 @@ func CanClaimRewards(c *cli.Context) (*api.CanClaimRewards, error) { return nil, err } - response.SdStatusResponse = sdStatus + response.SdStatusResponse = sdStatus.SDStatus opts, err := w.GetNodeAccountTransactor() if err != nil { diff --git a/stader/api/node/commands.go b/stader/api/node/commands.go index 817a46342..becb2fe84 100644 --- a/stader/api/node/commands.go +++ b/stader/api/node/commands.go @@ -795,6 +795,23 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { }, }, + + { + Name: "get-sd-status", + Usage: "Get SD Status", + UsageText: "stader-cli api node get-sd-status", + Action: func(c *cli.Context) error { + + // Validate args + if err := cliutils.ValidateArgCount(c, 0); err != nil { + return err + } + // Run + api.PrintResponse(getSDStatus(c)) + return nil + + }, + }, }, }) } diff --git a/stader/api/node/repay-sd.go b/stader/api/node/repay-sd.go index c9bbb4ea2..4032e15b8 100644 --- a/stader/api/node/repay-sd.go +++ b/stader/api/node/repay-sd.go @@ -46,7 +46,7 @@ func canRepaySD(c *cli.Context, amountWei *big.Int) (*api.CanRepaySDResponse, er return nil, err } - response.SdStatusResponse = sdStatus + response.SdStatusResponse = sdStatus.SDStatus response.GasInfo = gasInfo diff --git a/stader/api/node/sd-status.go b/stader/api/node/sd-status.go index e5176179e..951138630 100644 --- a/stader/api/node/sd-status.go +++ b/stader/api/node/sd-status.go @@ -12,7 +12,7 @@ import ( "github.com/stader-labs/stader-node/shared/types/api" ) -func getSDStatus(c *cli.Context) (*api.SdStatusResponse, error) { +func getSDStatus(c *cli.Context) (*api.GetSdStatusResponse, error) { sdc, err := services.GetSdCollateralContract(c) if err != nil { return nil, err @@ -63,5 +63,7 @@ func getSDStatus(c *cli.Context) (*api.SdStatusResponse, error) { return nil, err } - return sdStatus, nil + return &api.GetSdStatusResponse{ + SDStatus: sdStatus, + }, nil } diff --git a/stader/api/node/utility-sd.go b/stader/api/node/utility-sd.go index 80a212cd2..b47290e1f 100644 --- a/stader/api/node/utility-sd.go +++ b/stader/api/node/utility-sd.go @@ -12,7 +12,6 @@ import ( func utilitySd(c *cli.Context, amountWei *big.Int) (*api.NodeUtilitySDResponse, error) { - return &api.NodeUtilitySDResponse{}, nil // Get services if err := services.RequireNodeWallet(c); err != nil { return nil, err @@ -66,13 +65,6 @@ func canUtilitySd(c *cli.Context, amountWei *big.Int) (*api.CanUtilitySDResponse return nil, err } - sdStatus, err := getSDStatus(c) - if err != nil { - return nil, err - } - - response.SdStatusResponse = sdStatus - // Get gas estimates opts, err := w.GetNodeAccountTransactor() if err != nil { diff --git a/stader/api/node/withdraw-sd.go b/stader/api/node/withdraw-sd.go index 2622ecacd..ce11e5328 100644 --- a/stader/api/node/withdraw-sd.go +++ b/stader/api/node/withdraw-sd.go @@ -51,7 +51,7 @@ func canWithdrawSd(c *cli.Context, amountWei *big.Int) (*api.CanWithdrawSdRespon return nil, err } - response.SdStatusResponse = sdStatus + response.SdStatusResponse = sdStatus.SDStatus // get current sd collateral operatorSdCollateral, err := sd_collateral.GetOperatorSdBalance(sdc, nodeAccount.Address, nil) From 5740f6a4b97e0ee2052bc9a5efe4a713160a5328 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Thu, 30 Nov 2023 15:48:30 +0700 Subject: [PATCH 009/159] Update response --- shared/types/api/node.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/shared/types/api/node.go b/shared/types/api/node.go index 852ab2fa0..e414d8cac 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -430,10 +430,15 @@ type NodeUtilitySDResponse struct { } type CanUtilitySDResponse struct { - Status string `json:"status"` - Error string `json:"error"` - GasInfo stader.GasInfo `json:"gasInfo"` - SdStatusResponse *SdStatusResponse `json:"sdStatusResponse"` + Status string `json:"status"` + Error string `json:"error"` + GasInfo stader.GasInfo `json:"gasInfo"` +} + +type GetSdStatusResponse struct { + Status string `json:"status"` + Error string `json:"error"` + SDStatus *SdStatusResponse `json:"sdStatusResponse"` } type SdStatusResponse struct { From d662db450e2d5d62b8f287294c7fe03f1aab456e Mon Sep 17 00:00:00 2001 From: batphonghan Date: Thu, 30 Nov 2023 16:28:01 +0700 Subject: [PATCH 010/159] Refactor --- shared/services/services.go | 2 +- shared/services/stader/node.go | 11 +++++------ stader-cli/node/approve-sd.go | 1 - stader-cli/node/deposit-sd.go | 3 ++- stader-cli/node/repay-exess-sd.go | 11 ++--------- stader-cli/node/repay-sd.go | 1 - stader-cli/validator/deposit.go | 7 ++++++- stader-lib/sd_utility/sd_utility.go | 7 ++----- stader-lib/stader-config/stader-config.go | 2 +- stader/api/validator/commands.go | 8 ++++---- stader/api/validator/deposit.go | 8 ++++---- 11 files changed, 27 insertions(+), 34 deletions(-) diff --git a/shared/services/services.go b/shared/services/services.go index 2adbb2ad2..da6e13eac 100644 --- a/shared/services/services.go +++ b/shared/services/services.go @@ -229,7 +229,7 @@ func GetSdUtilityAddress(c *cli.Context) (common.Address, error) { return common.Address{}, err } - return stader_config.GetSDUtilityPool(sdcfg, nil) + return stader_config.GetSDUtilityPoolAddress(sdcfg, nil) } func GetPermissionlessNodeRegistry(c *cli.Context) (*stader.PermissionlessNodeRegistryContractManager, error) { diff --git a/shared/services/stader/node.go b/shared/services/stader/node.go index 90dd2dc73..1029cba90 100644 --- a/shared/services/stader/node.go +++ b/shared/services/stader/node.go @@ -207,8 +207,8 @@ func (c *Client) GetNodeDepositSdAllowance() (api.NodeDepositSdAllowanceResponse } // Check whether the node can make a deposit -func (c *Client) CanNodeDeposit(amountWei *big.Int, numValidators *big.Int, reloadKeys bool) (api.CanNodeDepositResponse, error) { - responseBytes, err := c.callAPI(fmt.Sprintf("validator can-deposit %s %s %t", amountWei.String(), numValidators, reloadKeys)) +func (c *Client) CanNodeDeposit(amountWei, amountUtilityWei *big.Int, numValidators *big.Int, reloadKeys bool) (api.CanNodeDepositResponse, error) { + responseBytes, err := c.callAPI(fmt.Sprintf("validator can-deposit %s %s %s %t", amountWei.String(), amountUtilityWei.String(), numValidators, reloadKeys)) if err != nil { return api.CanNodeDepositResponse{}, fmt.Errorf("could not get can validator deposit status: %w", err) } @@ -650,18 +650,17 @@ func (c *Client) NodeRepaySd(amountWei *big.Int) (api.NodeRepaySDResponse, error return response, nil } -// Approve SD for depositing as collateral func (c *Client) CanNodeRepaySd(amountWei *big.Int) (api.CanRepaySDResponse, error) { responseBytes, err := c.callAPI(fmt.Sprintf("node can-repay-sd %s", amountWei.String())) if err != nil { - return api.CanRepaySDResponse{}, fmt.Errorf("could not repay SD: %w", err) + return api.CanRepaySDResponse{}, fmt.Errorf("could not get CanNodeRepaySd SD: %w", err) } var response api.CanRepaySDResponse if err := json.Unmarshal(responseBytes, &response); err != nil { - return api.CanRepaySDResponse{}, fmt.Errorf("could not decode repay SD response: %w", err) + return api.CanRepaySDResponse{}, fmt.Errorf("could not decode CanNodeRepaySd response: %w", err) } if response.Error != "" { - return api.CanRepaySDResponse{}, fmt.Errorf("could not repay SD: %s", response.Error) + return api.CanRepaySDResponse{}, fmt.Errorf("could not can-repay SD: %s", response.Error) } return response, nil } diff --git a/stader-cli/node/approve-sd.go b/stader-cli/node/approve-sd.go index d2f3ad140..aed52420c 100644 --- a/stader-cli/node/approve-sd.go +++ b/stader-cli/node/approve-sd.go @@ -32,7 +32,6 @@ func nodeApproveSd(c *cli.Context) error { cliutils.PrintMultiTransactionNonceWarning() } - // Get stake mount amountInString := c.String("amount") amount, err := strconv.ParseFloat(amountInString, 64) diff --git a/stader-cli/node/deposit-sd.go b/stader-cli/node/deposit-sd.go index 434ba7463..3e66c92de 100644 --- a/stader-cli/node/deposit-sd.go +++ b/stader-cli/node/deposit-sd.go @@ -34,12 +34,13 @@ func nodeDepositSd(c *cli.Context) error { cliutils.PrintMultiTransactionNonceWarning() } - // Get stake mount amountInString := c.String("amount") + amount, err := strconv.ParseFloat(amountInString, 64) if err != nil { return err } + autoConfirm := c.Bool("yes") amountWei := eth.EthToWei(amount) diff --git a/stader-cli/node/repay-exess-sd.go b/stader-cli/node/repay-exess-sd.go index c340aee5c..b39fb205a 100644 --- a/stader-cli/node/repay-exess-sd.go +++ b/stader-cli/node/repay-exess-sd.go @@ -32,7 +32,6 @@ func repayExcessSD(c *cli.Context) error { return err } - // Get stake mount amountInString := c.String("amount") amount, err := strconv.ParseFloat(amountInString, 64) @@ -49,19 +48,13 @@ func repayExcessSD(c *cli.Context) error { sdStatus := canRepayExcessSdResponse.SdStatusResponse - // Less than 200 % - if sdStatus.SdCollateralCurrentAmount.Cmp(sdStatus.SdMaxCollateralAmount) < 0 { - fmt.Printf("Not enough SD collateral to repay utilized SD %s \n", sdStatus.PoolAvailableSDBalance.String()) - return nil - } - // Do not had position if sdStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) <= 0 { fmt.Printf("You don't have an existing utilization position. To withdraw excess SD to your wallet execute the following command: stader-cli node withdraw-sd --amount \n") return nil } - amountExcess := new(big.Int).Sub(sdStatus.SdMaxCollateralAmount, sdStatus.SdCollateralCurrentAmount) + amountExcess := new(big.Int).Sub(sdStatus.SdCollateralCurrentAmount, sdStatus.SdMaxCollateralAmount) if amountExcess.Cmp(big.NewInt(0)) <= 0 { fmt.Printf("You don't have excess SD collateral\n") @@ -85,7 +78,7 @@ func repayExcessSD(c *cli.Context) error { return err } - res, err := staderClient.NodeRepaySd(amountExcess) + res, err := staderClient.NodeRepaySd(amountWei) if err != nil { return err } diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index 0a64a0497..e1d2bb9ba 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -31,7 +31,6 @@ func repaySD(c *cli.Context) error { return err } - // Get stake mount amountInString := c.String("amount") amount, err := strconv.ParseFloat(amountInString, 64) diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 720a3cdaa..814493e6d 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -69,7 +69,7 @@ func nodeDeposit(c *cli.Context) error { log.ColorReset, math.RoundDown(eth.WeiToEth(status.AccountBalances.Sd), 18)) - canNodeDepositResponse, err := staderClient.CanNodeDeposit(baseAmount, big.NewInt(int64(numValidators)), true) + canNodeDepositResponse, err := staderClient.CanNodeDeposit(baseAmount, big.NewInt(0), big.NewInt(int64(numValidators)), true) if err != nil { return err } @@ -162,6 +162,11 @@ func nodeDeposit(c *cli.Context) error { } } + canNodeDepositResponse, err = staderClient.CanNodeDeposit(baseAmount, utilityAmount, big.NewInt(int64(numValidators)), true) + if err != nil { + return err + } + if canNodeDepositResponse.MaxValidatorLimitReached { fmt.Printf("Max validator limit reached") return nil diff --git a/stader-lib/sd_utility/sd_utility.go b/stader-lib/sd_utility/sd_utility.go index 0b17c3755..75280ba6f 100644 --- a/stader-lib/sd_utility/sd_utility.go +++ b/stader-lib/sd_utility/sd_utility.go @@ -7,17 +7,14 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/stader-labs/stader-node/stader-lib/stader" - "github.com/stader-labs/stader-node/stader-lib/utils/eth" ) func GetUtilizerLatestBalance(sp *stader.SDUtilityPoolContractManager, address common.Address, opts *bind.CallOpts) (*big.Int, error) { - return big.NewInt(0), nil return sp.SDUtilityPool.GetUtilizerLatestBalance(opts, address) } -func GetPoolAvailableSDBalance(sp *stader.SDUtilityPoolContractManager, address common.Address, opts *bind.CallOpts) (*big.Int, error) { - return eth.EthToWei(1000), nil - // return sp.SDUtilityPool.GetPoolAvailableSDBalance(opts) +func GetPoolAvailableSDBalance(sp *stader.SDUtilityPoolContractManager, opts *bind.CallOpts) (*big.Int, error) { + return sp.SDUtilityPool.GetPoolAvailableSDBalance(opts) } // Estimate the gas of Utilize diff --git a/stader-lib/stader-config/stader-config.go b/stader-lib/stader-config/stader-config.go index 1cdb6911f..13c7af5f4 100644 --- a/stader-lib/stader-config/stader-config.go +++ b/stader-lib/stader-config/stader-config.go @@ -72,6 +72,6 @@ func GetOperatorRewardsCollectorAddress(sdConfig *stader.StaderConfigContractMan return sdConfig.StaderConfig.GetOperatorRewardsCollector(opts) } -func GetSDUtilityPool(sdConfig *stader.StaderConfigContractManager, opts *bind.CallOpts) (common.Address, error) { +func GetSDUtilityPoolAddress(sdConfig *stader.StaderConfigContractManager, opts *bind.CallOpts) (common.Address, error) { return sdConfig.StaderConfig.GetSDUtilityPool(opts) } diff --git a/stader/api/validator/commands.go b/stader/api/validator/commands.go index f83325a57..2be290d80 100644 --- a/stader/api/validator/commands.go +++ b/stader/api/validator/commands.go @@ -70,19 +70,19 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { Name: "deposit", Aliases: []string{"d"}, Usage: "Make a deposit and create a validator", - UsageText: "stader-cli api validator deposit amount utility num-validators reload-keys", + UsageText: "stader-cli api validator deposit-amount utility-amount num-validators reload-keys", Action: func(c *cli.Context) error { // Validate args if err := cliutils.ValidateArgCount(c, 4); err != nil { return err } - amountWei, err := cliutils.ValidateWeiAmount("deposit amount", c.Args().Get(0)) + baseAmountWei, err := cliutils.ValidateWeiAmount("deposit amount", c.Args().Get(0)) if err != nil { return err } - utilityAmount, err := cliutils.ValidateWeiAmount("utility amount", c.Args().Get(1)) + utilityAmountWei, err := cliutils.ValidateWeiAmount("utility amount", c.Args().Get(1)) if err != nil { return err } @@ -98,7 +98,7 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { } // Run - response, err := nodeDeposit(c, amountWei, utilityAmount, numValidators, reloadKeys) + response, err := nodeDeposit(c, baseAmountWei, utilityAmountWei, numValidators, reloadKeys) api.PrintResponse(response, err) return nil diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index 4185b23e7..81da98c94 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -35,7 +35,7 @@ func GetSDStatus( return nil, err } - poolAvailableSDBalance, err := sd_utility.GetPoolAvailableSDBalance(sdu, operatorAddress, nil) + poolAvailableSDBalance, err := sd_utility.GetPoolAvailableSDBalance(sdu, nil) if err != nil { return nil, err } @@ -282,7 +282,7 @@ func canNodeDeposit(c *cli.Context, amountWei *big.Int, numValidators *big.Int, return &canNodeDepositResponse, nil } -func nodeDeposit(c *cli.Context, amountWei *big.Int, amountUtility *big.Int, numValidators *big.Int, reloadKeys bool) (*api.NodeDepositResponse, error) { +func nodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidators *big.Int, reloadKeys bool) (*api.NodeDepositResponse, error) { cfg, err := services.GetConfig(c) if err != nil { return nil, err @@ -340,7 +340,7 @@ func nodeDeposit(c *cli.Context, amountWei *big.Int, amountUtility *big.Int, num preDepositSignatures := make([][]byte, numValidators.Int64()) depositSignatures := make([][]byte, numValidators.Int64()) - amountToSend := amountWei.Mul(amountWei, numValidators) + amountToSend := baseAmountWei.Mul(baseAmountWei, numValidators) opts.Value = amountToSend validatorKeyCount, err := node.GetTotalValidatorKeys(prn, operatorId, nil) @@ -426,7 +426,7 @@ func nodeDeposit(c *cli.Context, amountWei *big.Int, amountUtility *big.Int, num pubKeys, preDepositSignatures, depositSignatures, - amountUtility, + utilityAmountWei, opts) if err != nil { return nil, err From e258c3a2bda41d99e79b0a7780430d1b97b5ddd2 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Thu, 30 Nov 2023 16:40:47 +0700 Subject: [PATCH 011/159] Refactor --- .golangci.yml | 1 - shared/services/services.go | 1 + shared/services/stader/client.go | 1 - shared/services/stader/node.go | 25 ++++++++++++++++++- shared/types/api/node.go | 8 +++--- stader-cli/node/approve-sd.go | 1 - stader-cli/node/commands.go | 7 +----- stader-cli/node/deposit-sd.go | 4 +-- stader-cli/validator/deposit.go | 4 +-- .../sd_utility.go => sdutility/sd-utility.go} | 2 +- stader-lib/stader/stader.go | 1 + stader/api/node/commands.go | 14 ----------- stader/api/node/repay-sd.go | 6 ++--- stader/api/node/sd-status.go | 5 ++-- stader/api/node/utility-sd.go | 9 +++---- stader/api/validator/deposit.go | 7 +++--- 16 files changed, 48 insertions(+), 48 deletions(-) rename stader-lib/{sd_utility/sd_utility.go => sdutility/sd-utility.go} (98%) diff --git a/.golangci.yml b/.golangci.yml index 15f510047..aa68692b2 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -33,7 +33,6 @@ linters: - gocritic - gofmt - goimports - - gomnd - gocyclo - gosec - gosimple diff --git a/shared/services/services.go b/shared/services/services.go index da6e13eac..3c4294d6f 100644 --- a/shared/services/services.go +++ b/shared/services/services.go @@ -436,6 +436,7 @@ func GetSdUtilityContract(c *cli.Context) (*stader.SDUtilityPoolContractManager, if err != nil { return nil, err } + ec, err := getEthClient(c, cfg) if err != nil { return nil, err diff --git a/shared/services/stader/client.go b/shared/services/stader/client.go index 820bb387c..f17a2c632 100644 --- a/shared/services/stader/client.go +++ b/shared/services/stader/client.go @@ -795,7 +795,6 @@ func (c *Client) GetDockerContainerShutdownTime(container string) (time.Time, er } func (c *Client) UpdateGuardianConfiguration(contents []byte) error { - guardianTemplatePath, err := homedir.Expand(fmt.Sprintf("%s/%s/%s", c.configPath, templatesDir, GuardianFileTemplate)) if err != nil { return fmt.Errorf("error expanding Guardian template path: %w", err) diff --git a/shared/services/stader/node.go b/shared/services/stader/node.go index 1029cba90..72fed865e 100644 --- a/shared/services/stader/node.go +++ b/shared/services/stader/node.go @@ -207,7 +207,7 @@ func (c *Client) GetNodeDepositSdAllowance() (api.NodeDepositSdAllowanceResponse } // Check whether the node can make a deposit -func (c *Client) CanNodeDeposit(amountWei, amountUtilityWei *big.Int, numValidators *big.Int, reloadKeys bool) (api.CanNodeDepositResponse, error) { +func (c *Client) CanNodeDeposit(amountWei, amountUtilityWei, numValidators *big.Int, reloadKeys bool) (api.CanNodeDepositResponse, error) { responseBytes, err := c.callAPI(fmt.Sprintf("validator can-deposit %s %s %s %t", amountWei.String(), amountUtilityWei.String(), numValidators, reloadKeys)) if err != nil { return api.CanNodeDepositResponse{}, fmt.Errorf("could not get can validator deposit status: %w", err) @@ -625,13 +625,16 @@ func (c *Client) SetRewardAddress(operatorRewardAddress common.Address) (api.Set if err != nil { return api.SetRewardAddress{}, fmt.Errorf("could not get set-reward-address response: %w", err) } + var response api.SetRewardAddress if err := json.Unmarshal(responseBytes, &response); err != nil { return api.SetRewardAddress{}, fmt.Errorf("could not decode set-reward-address response: %w", err) } + if response.Error != "" { return api.SetRewardAddress{}, fmt.Errorf("could not get set-reward-address response: %s", response.Error) } + return response, nil } @@ -640,13 +643,16 @@ func (c *Client) NodeRepaySd(amountWei *big.Int) (api.NodeRepaySDResponse, error if err != nil { return api.NodeRepaySDResponse{}, fmt.Errorf("could not repay SD: %w", err) } + var response api.NodeRepaySDResponse if err := json.Unmarshal(responseBytes, &response); err != nil { return api.NodeRepaySDResponse{}, fmt.Errorf("could not decode repay node SD response: %w", err) } + if response.Error != "" { return api.NodeRepaySDResponse{}, fmt.Errorf("could not repay SD: %s", response.Error) } + return response, nil } @@ -655,13 +661,16 @@ func (c *Client) CanNodeRepaySd(amountWei *big.Int) (api.CanRepaySDResponse, err if err != nil { return api.CanRepaySDResponse{}, fmt.Errorf("could not get CanNodeRepaySd SD: %w", err) } + var response api.CanRepaySDResponse if err := json.Unmarshal(responseBytes, &response); err != nil { return api.CanRepaySDResponse{}, fmt.Errorf("could not decode CanNodeRepaySd response: %w", err) } + if response.Error != "" { return api.CanRepaySDResponse{}, fmt.Errorf("could not can-repay SD: %s", response.Error) } + return response, nil } @@ -670,13 +679,16 @@ func (c *Client) NodeUtilizeSd(amountWei *big.Int) (api.NodeUtilitySDResponse, e if err != nil { return api.NodeUtilitySDResponse{}, fmt.Errorf("could not utilize SD: %w", err) } + var response api.NodeUtilitySDResponse if err := json.Unmarshal(responseBytes, &response); err != nil { return api.NodeUtilitySDResponse{}, fmt.Errorf("could not decode utilize response: %w", err) } + if response.Error != "" { return api.NodeUtilitySDResponse{}, fmt.Errorf("could not utilize SD: %s", response.Error) } + return response, nil } @@ -685,13 +697,16 @@ func (c *Client) CanNodeUtilizeSd(amountWei *big.Int) (api.CanUtilitySDResponse, if err != nil { return api.CanUtilitySDResponse{}, fmt.Errorf("could not utilize SD: %w", err) } + var response api.CanUtilitySDResponse if err := json.Unmarshal(responseBytes, &response); err != nil { return api.CanUtilitySDResponse{}, fmt.Errorf("could not decode node SD utilize response: %w", err) } + if response.Error != "" { return api.CanUtilitySDResponse{}, fmt.Errorf("could not utilize SD: %s", response.Error) } + return response, nil } @@ -700,13 +715,16 @@ func (c *Client) NodeRepayExcessSd(amountWei *big.Int) (api.NodeRepaySDResponse, if err != nil { return api.NodeRepaySDResponse{}, fmt.Errorf("could not repay excess SD: %w", err) } + var response api.NodeRepaySDResponse if err := json.Unmarshal(responseBytes, &response); err != nil { return api.NodeRepaySDResponse{}, fmt.Errorf("could not decode repay excess response: %w", err) } + if response.Error != "" { return api.NodeRepaySDResponse{}, fmt.Errorf("could not repay excess SD: %s", response.Error) } + return response, nil } @@ -715,10 +733,12 @@ func (c *Client) CanRepayExcessSD(amountWei *big.Int) (api.CanRepayExcessSDRespo if err != nil { return api.CanRepayExcessSDResponse{}, fmt.Errorf("could not repay excess SD: %w", err) } + var response api.CanRepayExcessSDResponse if err := json.Unmarshal(responseBytes, &response); err != nil { return api.CanRepayExcessSDResponse{}, fmt.Errorf("could not decode node repay SD excess response: %w", err) } + if response.Error != "" { return api.CanRepayExcessSDResponse{}, fmt.Errorf("could not repay excess SD: %s", response.Error) } @@ -730,12 +750,15 @@ func (c *Client) GetSDStatus() (api.GetSdStatusResponse, error) { if err != nil { return api.GetSdStatusResponse{}, fmt.Errorf("could not get-sd-status: %w", err) } + var response api.GetSdStatusResponse if err := json.Unmarshal(responseBytes, &response); err != nil { return api.GetSdStatusResponse{}, fmt.Errorf("could not decode node get SD status response: %w", err) } + if response.Error != "" { return api.GetSdStatusResponse{}, fmt.Errorf("could not get SD status: %s", response.Error) } + return response, nil } diff --git a/shared/types/api/node.go b/shared/types/api/node.go index e414d8cac..af7430474 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -417,10 +417,10 @@ type NodeRepaySDResponse struct { } type CanRepaySDResponse struct { + SdStatusResponse *SdStatusResponse `json:"sdStatusResponse"` Status string `json:"status"` Error string `json:"error"` GasInfo stader.GasInfo `json:"gasInfo"` - SdStatusResponse *SdStatusResponse `json:"sdStatusResponse"` } type NodeUtilitySDResponse struct { @@ -436,19 +436,19 @@ type CanUtilitySDResponse struct { } type GetSdStatusResponse struct { + SDStatus *SdStatusResponse `json:"sdStatusResponse"` Status string `json:"status"` Error string `json:"error"` - SDStatus *SdStatusResponse `json:"sdStatusResponse"` } type SdStatusResponse struct { - NotEnoughSdCollateral bool `json:"notEnoughSdCollateral"` SdUtilizerLatestBalance *big.Int `json:"sdUtilizerLatestBalance"` SdCollateralCurrentAmount *big.Int `json:"sdCollateralCurrentAmount"` SdCollateralRequireAmount *big.Int `json:"sdCollateralRequireAmount"` SdBalance *big.Int `json:"sdBalance"` SdMaxCollateralAmount *big.Int `json:"sdMaxCollateralAmount"` PoolAvailableSDBalance *big.Int `json:"poolAvailableSDBalance"` + NotEnoughSdCollateral bool `json:"notEnoughSdCollateral"` } type NodeRepayExcessSDResponse struct { @@ -458,8 +458,8 @@ type NodeRepayExcessSDResponse struct { } type CanRepayExcessSDResponse struct { + SdStatusResponse *SdStatusResponse `json:"sdStatusResponse"` Status string `json:"status"` Error string `json:"error"` GasInfo stader.GasInfo `json:"gasInfo"` - SdStatusResponse *SdStatusResponse `json:"sdStatusResponse"` } diff --git a/stader-cli/node/approve-sd.go b/stader-cli/node/approve-sd.go index aed52420c..4c9d702d7 100644 --- a/stader-cli/node/approve-sd.go +++ b/stader-cli/node/approve-sd.go @@ -14,7 +14,6 @@ import ( ) func nodeApproveSd(c *cli.Context) error { - staderClient, err := stader.NewClientFromCtx(c) if err != nil { return err diff --git a/stader-cli/node/commands.go b/stader-cli/node/commands.go index 77b90443b..3da475ea2 100644 --- a/stader-cli/node/commands.go +++ b/stader-cli/node/commands.go @@ -359,7 +359,6 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { }, }, Action: func(c *cli.Context) error { - if _, err := cliutils.ValidatePositiveEthAmount("sd deposit amount", c.String("amount")); err != nil { return err } @@ -379,9 +378,7 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { Usage: "Automatically confirm SD utilize", }, }, - Action: func(c *cli.Context) error { - return utilizeSD(c) - }, + Action: utilizeSD, }, { Name: "repay-sd", @@ -399,7 +396,6 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { }, }, Action: func(c *cli.Context) error { - if _, err := cliutils.ValidatePositiveEthAmount("sd repay amount", c.String("amount")); err != nil { return err } @@ -424,7 +420,6 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { }, }, Action: func(c *cli.Context) error { - if _, err := cliutils.ValidatePositiveEthAmount("sd repay amount", c.String("amount")); err != nil { return err } diff --git a/stader-cli/node/deposit-sd.go b/stader-cli/node/deposit-sd.go index 3e66c92de..79bef72a7 100644 --- a/stader-cli/node/deposit-sd.go +++ b/stader-cli/node/deposit-sd.go @@ -45,10 +45,10 @@ func nodeDepositSd(c *cli.Context) error { amountWei := eth.EthToWei(amount) - return NodeDepositSdWithAmount(staderClient, amountWei, autoConfirm, nounce) + return DepositSdWithAmount(staderClient, amountWei, autoConfirm, nounce) } -func NodeDepositSdWithAmount(staderClient *stader.Client, amountWei *big.Int, autoConfirm bool, nounce uint64) error { +func DepositSdWithAmount(staderClient *stader.Client, amountWei *big.Int, autoConfirm bool, nounce uint64) error { // Check allowance allowance, err := staderClient.GetNodeDepositSdAllowance() if err != nil { diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 814493e6d..e4f3dc834 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -67,7 +67,7 @@ func nodeDeposit(c *cli.Context) error { log.ColorBlue, status.AccountAddress, log.ColorReset, - math.RoundDown(eth.WeiToEth(status.AccountBalances.Sd), 18)) + math.RoundDown(eth.WeiToEth(status.AccountBalances.Sd), Decimal)) canNodeDepositResponse, err := staderClient.CanNodeDeposit(baseAmount, big.NewInt(0), big.NewInt(int64(numValidators)), true) if err != nil { @@ -143,7 +143,7 @@ func nodeDeposit(c *cli.Context) error { return nil } - err = node.NodeDepositSdWithAmount(staderClient, amountToCollateral, autoConfirm, 0) + err = node.DepositSdWithAmount(staderClient, amountToCollateral, autoConfirm, 0) if err != nil { return err } diff --git a/stader-lib/sd_utility/sd_utility.go b/stader-lib/sdutility/sd-utility.go similarity index 98% rename from stader-lib/sd_utility/sd_utility.go rename to stader-lib/sdutility/sd-utility.go index 75280ba6f..8be135a74 100644 --- a/stader-lib/sd_utility/sd_utility.go +++ b/stader-lib/sdutility/sd-utility.go @@ -1,4 +1,4 @@ -package sd_utility +package sdutility import ( "math/big" diff --git a/stader-lib/stader/stader.go b/stader-lib/stader/stader.go index f165b3a5d..a0b80a1bc 100644 --- a/stader-lib/stader/stader.go +++ b/stader-lib/stader/stader.go @@ -468,6 +468,7 @@ func NewSDUtilityPool(client ExecutionClient, sdUtilizeAddress common.Address) ( if err != nil { return nil, err } + sdUtilizeContract := &Contract{ Contract: bind.NewBoundContract(sdUtilizeAddress, sdUtilizeAbi, client, client, client), Address: &sdUtilizeAddress, diff --git a/stader/api/node/commands.go b/stader/api/node/commands.go index becb2fe84..a6b2ebbe5 100644 --- a/stader/api/node/commands.go +++ b/stader/api/node/commands.go @@ -178,7 +178,6 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { Usage: "Utilize SD", UsageText: "stader-cli api node utilize-sd amount", Action: func(c *cli.Context) error { - // Validate args if err := cliutils.ValidateArgCount(c, 1); err != nil { return err @@ -191,7 +190,6 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { // Run api.PrintResponse(utilitySd(c, amountWei)) return nil - }, }, { @@ -199,7 +197,6 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { Usage: "Utilize SD", UsageText: "stader-cli api node can-utilize-sd amount", Action: func(c *cli.Context) error { - // Validate args if err := cliutils.ValidateArgCount(c, 1); err != nil { return err @@ -208,11 +205,9 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { if err != nil { return err } - // Run api.PrintResponse(canUtilitySd(c, amountWei)) return nil - }, }, { @@ -220,7 +215,6 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { Usage: "Utilize SD", UsageText: "stader-cli api node repay-sd amount", Action: func(c *cli.Context) error { - // Validate args if err := cliutils.ValidateArgCount(c, 1); err != nil { return err @@ -233,7 +227,6 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { // Run api.PrintResponse(repaySD(c, amountWei)) return nil - }, }, { @@ -241,7 +234,6 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { Usage: "Can repay SD", UsageText: "stader-cli api node can-repay-sd amount", Action: func(c *cli.Context) error { - // Validate args if err := cliutils.ValidateArgCount(c, 1); err != nil { return err @@ -254,17 +246,14 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { // Run api.PrintResponse(canRepaySD(c, amountWei)) return nil - }, }, - { Name: "wait-and-deposit-sd", Aliases: []string{"k2"}, Usage: "Deposit SD against the node, waiting for approval tx-hash to be included in a block first", UsageText: "stader-cli api node wait-and-deposit-sd amount tx-hash", Action: func(c *cli.Context) error { - // Validate args if err := cliutils.ValidateArgCount(c, 2); err != nil { return err @@ -792,7 +781,6 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { // Run api.PrintResponse(SetRewardAddress(c, operatorRewardAddress)) return nil - }, }, @@ -801,7 +789,6 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { Usage: "Get SD Status", UsageText: "stader-cli api node get-sd-status", Action: func(c *cli.Context) error { - // Validate args if err := cliutils.ValidateArgCount(c, 0); err != nil { return err @@ -809,7 +796,6 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { // Run api.PrintResponse(getSDStatus(c)) return nil - }, }, }, diff --git a/stader/api/node/repay-sd.go b/stader/api/node/repay-sd.go index 4032e15b8..c31bb457a 100644 --- a/stader/api/node/repay-sd.go +++ b/stader/api/node/repay-sd.go @@ -3,7 +3,7 @@ package node import ( "math/big" - "github.com/stader-labs/stader-node/stader-lib/sd_utility" + "github.com/stader-labs/stader-node/stader-lib/sdutility" "github.com/urfave/cli" @@ -36,7 +36,7 @@ func canRepaySD(c *cli.Context, amountWei *big.Int) (*api.CanRepaySDResponse, er return nil, err } - gasInfo, err := sd_utility.EstimateRepay(sdu, amountWei, opts) + gasInfo, err := sdutility.EstimateRepay(sdu, amountWei, opts) if err != nil { return nil, err } @@ -78,7 +78,7 @@ func repaySD(c *cli.Context, amountWei *big.Int) (*api.NodeRepaySDResponse, erro // Response response := api.NodeRepaySDResponse{} - tx, err := sd_utility.Repay(sdu, amountWei, opts) + tx, err := sdutility.Repay(sdu, amountWei, opts) if err != nil { return nil, err } diff --git a/stader/api/node/sd-status.go b/stader/api/node/sd-status.go index 951138630..304e9abf5 100644 --- a/stader/api/node/sd-status.go +++ b/stader/api/node/sd-status.go @@ -44,15 +44,16 @@ func getSDStatus(c *cli.Context) (*api.GetSdStatusResponse, error) { return nil, err } - operatorId, err := node.GetOperatorId(prn, nodeAccount.Address, nil) + operatorID, err := node.GetOperatorId(prn, nodeAccount.Address, nil) if err != nil { return nil, err } - totalValidatorKeys, err := node.GetTotalValidatorKeys(prn, operatorId, nil) + totalValidatorKeys, err := node.GetTotalValidatorKeys(prn, operatorID, nil) if err != nil { return nil, err } + totalValidatorNonTerminalKeys, err := node.GetTotalNonTerminalValidatorKeys(prn, nodeAccount.Address, totalValidatorKeys, nil) if err != nil { return nil, err diff --git a/stader/api/node/utility-sd.go b/stader/api/node/utility-sd.go index b47290e1f..a68a97ab9 100644 --- a/stader/api/node/utility-sd.go +++ b/stader/api/node/utility-sd.go @@ -7,11 +7,10 @@ import ( "github.com/stader-labs/stader-node/shared/services" "github.com/stader-labs/stader-node/shared/types/api" - "github.com/stader-labs/stader-node/stader-lib/sd_utility" + "github.com/stader-labs/stader-node/stader-lib/sdutility" ) func utilitySd(c *cli.Context, amountWei *big.Int) (*api.NodeUtilitySDResponse, error) { - // Get services if err := services.RequireNodeWallet(c); err != nil { return nil, err @@ -36,7 +35,7 @@ func utilitySd(c *cli.Context, amountWei *big.Int) (*api.NodeUtilitySDResponse, // Response response := api.NodeUtilitySDResponse{} - tx, err := sd_utility.Utilize(sdu, amountWei, opts) + tx, err := sdutility.Utilize(sdu, amountWei, opts) if err != nil { return nil, err } @@ -44,7 +43,6 @@ func utilitySd(c *cli.Context, amountWei *big.Int) (*api.NodeUtilitySDResponse, response.TxHash = tx.Hash() return &response, nil - } func canUtilitySd(c *cli.Context, amountWei *big.Int) (*api.CanUtilitySDResponse, error) { @@ -71,7 +69,7 @@ func canUtilitySd(c *cli.Context, amountWei *big.Int) (*api.CanUtilitySDResponse return nil, err } - gasInfo, err := sd_utility.EstimateUtilize(sdu, amountWei, opts) + gasInfo, err := sdutility.EstimateUtilize(sdu, amountWei, opts) if err != nil { return nil, err } @@ -79,5 +77,4 @@ func canUtilitySd(c *cli.Context, amountWei *big.Int) (*api.CanUtilitySDResponse response.GasInfo = gasInfo return &response, nil - } diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index 81da98c94..2e25d7ef3 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -7,7 +7,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/stader-labs/stader-node/stader-lib/node" sd_collateral "github.com/stader-labs/stader-node/stader-lib/sd-collateral" - "github.com/stader-labs/stader-node/stader-lib/sd_utility" + "github.com/stader-labs/stader-node/stader-lib/sdutility" "github.com/stader-labs/stader-node/stader-lib/stader" "github.com/stader-labs/stader-node/stader-lib/tokens" stadertypes "github.com/stader-labs/stader-node/stader-lib/types" @@ -29,13 +29,12 @@ func GetSDStatus( operatorAddress common.Address, totalValidatorsPostAddition *big.Int, ) (*api.SdStatusResponse, error) { - - sdUtilityBalance, err := sd_utility.GetUtilizerLatestBalance(sdu, operatorAddress, nil) + sdUtilityBalance, err := sdutility.GetUtilizerLatestBalance(sdu, operatorAddress, nil) if err != nil { return nil, err } - poolAvailableSDBalance, err := sd_utility.GetPoolAvailableSDBalance(sdu, nil) + poolAvailableSDBalance, err := sdutility.GetPoolAvailableSDBalance(sdu, nil) if err != nil { return nil, err } From 0d421061398cccfebcada378aea86254148c8259 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Thu, 30 Nov 2023 17:38:16 +0700 Subject: [PATCH 012/159] Refactor --- shared/services/services.go | 4 ++-- shared/services/stader/node.go | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/shared/services/services.go b/shared/services/services.go index 3c4294d6f..d53d15cb3 100644 --- a/shared/services/services.go +++ b/shared/services/services.go @@ -432,12 +432,12 @@ func GetStakePoolManager(c *cli.Context) (*stader.StakePoolManagerContractManage } func GetSdUtilityContract(c *cli.Context) (*stader.SDUtilityPoolContractManager, error) { - cfg, err := getConfig(c) + _cfg, err := getConfig(c) if err != nil { return nil, err } - ec, err := getEthClient(c, cfg) + ec, err := getEthClient(c, _cfg) if err != nil { return nil, err } diff --git a/shared/services/stader/node.go b/shared/services/stader/node.go index 72fed865e..d2eb22586 100644 --- a/shared/services/stader/node.go +++ b/shared/services/stader/node.go @@ -742,6 +742,7 @@ func (c *Client) CanRepayExcessSD(amountWei *big.Int) (api.CanRepayExcessSDRespo if response.Error != "" { return api.CanRepayExcessSDResponse{}, fmt.Errorf("could not repay excess SD: %s", response.Error) } + return response, nil } From 4a27fc873555ea8f3098ad30f48b37a54c8bf200 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Fri, 1 Dec 2023 16:30:45 +0700 Subject: [PATCH 013/159] Fix typo --- stader-cli/node/withdraw-sd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index 9d969cc92..dd644d3cc 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -42,7 +42,7 @@ func WithdrawSd(c *cli.Context) error { return nil } if canWithdrawSdResponse.InsufficientSdCollateral { - fmt.Println("SD collateral less tha 200%") + fmt.Println("SD collateral less than 200%") return nil } From 34825eabe8e50780202071abef2c802ba033257f Mon Sep 17 00:00:00 2001 From: batphonghan Date: Mon, 4 Dec 2023 12:58:59 +0700 Subject: [PATCH 014/159] Add metrics --- shared/services/state/network-state.go | 20 ++++++++ stader-cli/node/status.go | 46 ++++++++++++++++++- stader-cli/validator/deposit.go | 41 +---------------- stader-lib/utils/eth/units.go | 1 + stader/guardian/collector/constants.go | 1 + .../guardian/collector/operator-collector.go | 6 ++- stader/guardian/collector/state-locker.go | 13 ++++-- 7 files changed, 81 insertions(+), 47 deletions(-) diff --git a/shared/services/state/network-state.go b/shared/services/state/network-state.go index cc75a468c..2778a63c1 100644 --- a/shared/services/state/network-state.go +++ b/shared/services/state/network-state.go @@ -8,6 +8,7 @@ import ( "github.com/stader-labs/stader-node/shared/services" "github.com/stader-labs/stader-node/shared/utils/stdr" "github.com/stader-labs/stader-node/stader-lib/contracts" + "github.com/stader-labs/stader-node/stader-lib/sdutility" "github.com/urfave/cli" "github.com/stader-labs/stader-node/shared/utils/math" @@ -114,6 +115,9 @@ type MetricDetails struct { OperatorStakedSdInEth float64 // done OperatorEthCollateral float64 + + // done + OperatorSDUtilized float64 } type MetricsCache struct { @@ -153,6 +157,11 @@ func CreateMetricsCache( if err != nil { return nil, err } + + sduAddress, err := services.GetSdUtilityAddress(c) + // if err != nil { + // return nil, err + // } ethxAddress, err := services.GetEthxTokenAddress(c) if err != nil { return nil, err @@ -212,6 +221,11 @@ func CreateMetricsCache( return nil, err } + sdu, err := stader.NewSDUtilityPool(ec, sduAddress) + if err != nil { + return nil, err + } + // Get the execution block for the given slot beaconBlock, exists, err := bc.GetBeaconBlock(fmt.Sprintf("%d", slotNumber)) if err != nil { @@ -449,6 +463,11 @@ func CreateMetricsCache( return nil, err } + sdUtilized, err := sdutility.GetUtilizerLatestBalance(sdu, nodeAddress, nil) + if err != nil { + return nil, err + } + minThreshold := math.RoundDown(eth.WeiToEth(permissionlessPoolThreshold.MinThreshold), 2) sdPriceFormatted := math.RoundDown(eth.WeiToEth(sdPrice), 2) collateralRatioInSd := minThreshold * sdPriceFormatted @@ -497,6 +516,7 @@ func CreateMetricsCache( metricsDetails.UnclaimedSocializingPoolElRewards = math.RoundDown(eth.WeiToEth(rewardClaimData.unclaimedEth), SixDecimalRound) metricsDetails.UnclaimedSocializingPoolSDRewards = math.RoundDown(eth.WeiToEth(rewardClaimData.unclaimedSd), SixDecimalRound) + metricsDetails.OperatorSDUtilized = math.RoundDown(eth.WeiToEth(sdUtilized), SixDecimalRound) state.StaderNetworkDetails = metricsDetails state.logLine("Retrieved Stader Network Details (total time: %s)", time.Since(start)) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 5aa2cc932..3e81fb93a 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -2,13 +2,14 @@ package node import ( "fmt" + "math/big" + "github.com/stader-labs/stader-node/shared/services/stader" cliutils "github.com/stader-labs/stader-node/shared/utils/cli" "github.com/stader-labs/stader-node/shared/utils/log" "github.com/stader-labs/stader-node/shared/utils/math" "github.com/stader-labs/stader-node/stader-lib/utils/eth" "github.com/urfave/cli" - "math/big" ) func getNodeStatus(c *cli.Context) error { @@ -160,5 +161,48 @@ func getNodeStatus(c *cli.Context) error { fmt.Printf("To view details of each validator, please use the %sstader-cli validator status%s command\n\n", log.ColorGreen, log.ColorReset) + // Get node SD status + sdStatusResp, err := staderClient.GetSDStatus() + if err != nil { + return err + } + + fmt.Printf("%s=== SD utilization Details ===%s\n", log.ColorGreen, log.ColorReset) + + sdStatus := sdStatusResp.SDStatus + + fmt.Printf( + "The node %s%s%s current utilized %.6f SD.\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, + math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizerLatestBalance), eth.Decimal)) + + fmt.Printf( + "The node %s%s%s current had %.6f SD in collateral.\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, + math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralCurrentAmount), eth.Decimal)) + + selfBond := new(big.Int).Sub(sdStatus.SdCollateralCurrentAmount, sdStatus.SdUtilizerLatestBalance) + + fmt.Printf( + "The node %s%s%s current had %.6f SD in self bond.\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, + math.RoundDown(eth.WeiToEth(selfBond), eth.Decimal)) + + cur := eth.WeiToEth(sdStatus.SdCollateralCurrentAmount) + min := eth.WeiToEth(sdStatus.SdCollateralRequireAmount) + + fmt.Printf( + "The node %s%s%s current had %.6f%s Collateral.\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, + cur/min*100, "%") + return nil } diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index e4f3dc834..42836fb0d 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -15,8 +15,6 @@ import ( "github.com/urfave/cli" ) -const Decimal = 18 - func nodeDeposit(c *cli.Context) error { staderClient, err := stader.NewClientFromCtx(c) @@ -67,7 +65,7 @@ func nodeDeposit(c *cli.Context) error { log.ColorBlue, status.AccountAddress, log.ColorReset, - math.RoundDown(eth.WeiToEth(status.AccountBalances.Sd), Decimal)) + math.RoundDown(eth.WeiToEth(status.AccountBalances.Sd), eth.Decimal)) canNodeDepositResponse, err := staderClient.CanNodeDeposit(baseAmount, big.NewInt(0), big.NewInt(int64(numValidators)), true) if err != nil { @@ -86,43 +84,6 @@ func nodeDeposit(c *cli.Context) error { sdStatus := canNodeDepositResponse.SdStatusResponse amountToCollateral := new(big.Int).Sub(sdStatus.SdCollateralRequireAmount, sdStatus.SdCollateralCurrentAmount) - fmt.Printf( - "The node %s%s%s current had %.6f SD in collateral.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralCurrentAmount), Decimal)) - - fmt.Printf( - "The node %s%s%s need %.6f SD in collateral after deposit.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralRequireAmount), Decimal)) - - fmt.Printf( - "The node %s%s%s can had max %.6f SD in collateral after deposit.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - math.RoundDown(eth.WeiToEth(sdStatus.SdMaxCollateralAmount), Decimal)) - - fmt.Printf( - "The node %s%s%s current utility %.6f SD.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizerLatestBalance), Decimal)) - - if amountToCollateral.Cmp(big.NewInt(0)) >= 1 { - fmt.Printf( - "The node %s%s%s need %.6f SD to meet collateral require.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - math.RoundDown(eth.WeiToEth(amountToCollateral), Decimal)) - } - utilityAmount := big.NewInt(0) if sdStatus.NotEnoughSdCollateral { diff --git a/stader-lib/utils/eth/units.go b/stader-lib/utils/eth/units.go index eda29ab34..674510451 100644 --- a/stader-lib/utils/eth/units.go +++ b/stader-lib/utils/eth/units.go @@ -28,6 +28,7 @@ import ( const ( WeiPerEth float64 = 1e18 WeiPerGwei float64 = 1e9 + Decimal = 18 ) // Convert wei to eth diff --git a/stader/guardian/collector/constants.go b/stader/guardian/collector/constants.go index be3403dae..2761e1362 100644 --- a/stader/guardian/collector/constants.go +++ b/stader/guardian/collector/constants.go @@ -29,6 +29,7 @@ const UnclaimedSocializingPoolELRewards = "unclaimed_socializing_pool_el_rewards const UnclaimedSocializingPoolSdRewards = "unclaimed_socializing_pool_sd_rewards" const UnclaimedCLRewards = "unclaimed_cl_rewards" const NextRewardCycleTime = "next_reward_cycle_time" +const SDUtilized = "sd_utilized" // Node Health => stader_node_health+ key const NodeSub = "node_health" diff --git a/stader/guardian/collector/operator-collector.go b/stader/guardian/collector/operator-collector.go index b06638e97..8233e131c 100644 --- a/stader/guardian/collector/operator-collector.go +++ b/stader/guardian/collector/operator-collector.go @@ -33,6 +33,7 @@ type OperatorCollector struct { TotalSdCollateral *prometheus.Desc TotalSdCollateralInEth *prometheus.Desc TotalEthColateral *prometheus.Desc + TotalSDUtilized *prometheus.Desc // The beacon client bc beacon.Client @@ -112,6 +113,8 @@ func NewOperatorCollector( prometheus.BuildFQName(namespace, OperatorSub, SdCollateralInEth), "", nil, nil), TotalEthColateral: prometheus.NewDesc( prometheus.BuildFQName(namespace, OperatorSub, EthCollateral), "", nil, nil), + TotalSDUtilized: prometheus.NewDesc( + prometheus.BuildFQName(namespace, OperatorSub, SDUtilized), "", nil, nil), bc: bc, ec: ec, nodeAddress: nodeAddress, @@ -142,6 +145,7 @@ func (collector *OperatorCollector) Describe(channel chan<- *prometheus.Desc) { channel <- collector.TotalSdCollateral channel <- collector.TotalSdCollateralInEth channel <- collector.TotalEthColateral + channel <- collector.TotalSDUtilized } // Collect the latest metric values and pass them to Prometheus @@ -169,7 +173,7 @@ func (collector *OperatorCollector) Collect(channel chan<- prometheus.Metric) { channel <- prometheus.MustNewConstMetric(collector.TotalSdCollateral, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorStakedSd) channel <- prometheus.MustNewConstMetric(collector.TotalSdCollateralInEth, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorStakedSdInEth) channel <- prometheus.MustNewConstMetric(collector.TotalEthColateral, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorEthCollateral) - + channel <- prometheus.MustNewConstMetric(collector.TotalSDUtilized, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorSDUtilized) } // Log error messages diff --git a/stader/guardian/collector/state-locker.go b/stader/guardian/collector/state-locker.go index 4ca54f637..7ca04e04b 100644 --- a/stader/guardian/collector/state-locker.go +++ b/stader/guardian/collector/state-locker.go @@ -1,10 +1,11 @@ package collector import ( - "github.com/stader-labs/stader-node/stader-lib/contracts" "math/big" "sync" + "github.com/stader-labs/stader-node/stader-lib/contracts" + "github.com/stader-labs/stader-node/shared/services/beacon" "github.com/stader-labs/stader-node/shared/services/state" "github.com/stader-labs/stader-node/stader-lib/types" @@ -53,10 +54,12 @@ func NewMetricsCacheContainer() *MetricsCacheContainer { CurrentStartBlock: big.NewInt(0), CurrentEndBlock: big.NewInt(0), }, - ValidatorStatusMap: make(map[types.ValidatorPubkey]beacon.ValidatorStatus), - ValidatorInfoMap: make(map[types.ValidatorPubkey]contracts.Validator), - CollateralRatio: 0, - CollateralRatioInSd: 0, + ValidatorStatusMap: make(map[types.ValidatorPubkey]beacon.ValidatorStatus), + ValidatorInfoMap: make(map[types.ValidatorPubkey]contracts.Validator), + CollateralRatio: 0, + CollateralRatioInSd: 0, + OperatorSDUtilized: 0, + StaderQueuedValidators: big.NewInt(0), }, }, } From 9dee647dd072daed0d13352e0371c90fe90809ce Mon Sep 17 00:00:00 2001 From: batphonghan Date: Mon, 4 Dec 2023 13:00:36 +0700 Subject: [PATCH 015/159] Refactor --- shared/services/state/network-state.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shared/services/state/network-state.go b/shared/services/state/network-state.go index 2778a63c1..f3bb1ca6f 100644 --- a/shared/services/state/network-state.go +++ b/shared/services/state/network-state.go @@ -159,9 +159,9 @@ func CreateMetricsCache( } sduAddress, err := services.GetSdUtilityAddress(c) - // if err != nil { - // return nil, err - // } + if err != nil { + return nil, err + } ethxAddress, err := services.GetEthxTokenAddress(c) if err != nil { return nil, err From eb8f863b9ef49284092e3607fd7506d9de2765e9 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Mon, 4 Dec 2023 22:13:21 +0700 Subject: [PATCH 016/159] Refactoring --- shared/types/api/node.go | 3 ++- stader-cli/node/repay-sd.go | 2 +- stader-cli/node/utilize-sd.go | 6 +++--- stader-cli/validator/deposit.go | 2 +- stader/api/validator/deposit.go | 14 +++++++++++--- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/shared/types/api/node.go b/shared/types/api/node.go index af7430474..3cf6564df 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -445,8 +445,9 @@ type SdStatusResponse struct { SdUtilizerLatestBalance *big.Int `json:"sdUtilizerLatestBalance"` SdCollateralCurrentAmount *big.Int `json:"sdCollateralCurrentAmount"` SdCollateralRequireAmount *big.Int `json:"sdCollateralRequireAmount"` - SdBalance *big.Int `json:"sdBalance"` + SdMaxUtilizableAmount *big.Int `json:"sdMaxUtilizableAmount"` SdMaxCollateralAmount *big.Int `json:"sdMaxCollateralAmount"` + SdBalance *big.Int `json:"sdBalance"` PoolAvailableSDBalance *big.Int `json:"poolAvailableSDBalance"` NotEnoughSdCollateral bool `json:"notEnoughSdCollateral"` } diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index e1d2bb9ba..de60e9bde 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -46,7 +46,7 @@ func repaySD(c *cli.Context) error { } // 1. Check if repay more than need - if amountWei.Cmp(canClaimElRewardsResponse.SdStatusResponse.SdUtilizerLatestBalance) >= 1 { + if amountWei.Cmp(canClaimElRewardsResponse.SdStatusResponse.SdUtilizerLatestBalance) > 0 { cliutils.PrintError(fmt.Sprintf("Repayment amount greater than the Utilization position: %s \n", canClaimElRewardsResponse.SdStatusResponse.SdUtilizerLatestBalance.String())) return nil } diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index 1f508ea4e..693d9b74a 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -38,7 +38,7 @@ func utilizeSD(c *cli.Context) error { return err } - amountWei := PromChooseUtilityAmount(sdStatusResponse.SDStatus) + amountWei := PromptChooseUtilityAmount(sdStatusResponse.SDStatus) canNodeUtilizeSdResponse, err := staderClient.CanNodeUtilizeSd(amountWei) if err != nil { @@ -82,7 +82,7 @@ func GetMinUtility(sdStatus *api.SdStatusResponse) *big.Int { } func GetMaxUtility(sdStatus *api.SdStatusResponse) *big.Int { - maxUtility := new(big.Int).Sub(sdStatus.SdMaxCollateralAmount, sdStatus.SdUtilizerLatestBalance) + maxUtility := new(big.Int).Sub(sdStatus.SdMaxUtilizableAmount, sdStatus.SdUtilizerLatestBalance) if maxUtility.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { maxUtility = sdStatus.PoolAvailableSDBalance @@ -91,7 +91,7 @@ func GetMaxUtility(sdStatus *api.SdStatusResponse) *big.Int { return maxUtility } -func PromChooseUtilityAmount(sdStatus *api.SdStatusResponse) *big.Int { +func PromptChooseUtilityAmount(sdStatus *api.SdStatusResponse) *big.Int { minUtility := GetMinUtility(sdStatus) maxUtility := GetMaxUtility(sdStatus) diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index e4f3dc834..b38676ac2 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -151,7 +151,7 @@ func nodeDeposit(c *cli.Context) error { return nodeDeposit(c) case 1: - utilityAmount = node.PromChooseUtilityAmount(sdStatus) + utilityAmount = node.PromptChooseUtilityAmount(sdStatus) if !cliutils.Confirm(fmt.Sprintf("You're about to utility %f SD: ", eth.WeiToEth(utilityAmount))) { fmt.Printf("Cancel \n") diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index 2e25d7ef3..4da4163a3 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -20,7 +20,11 @@ import ( "github.com/stader-labs/stader-node/shared/utils/validator" ) -const MaxBondThreshold = 2 +const ( + MaxBondThreshold = 20 + MinToUtilizeRatioNum = 5 + MinToUtilizeRatioDenom = 2 +) func GetSDStatus( sdc *stader.SdCollateralContractManager, @@ -55,7 +59,10 @@ func GetSDStatus( return nil, err } - maxSDToBound := new(big.Int).Mul(minimumSDToBond, big.NewInt(MaxBondThreshold)) + sdMaxCollateralAmount := new(big.Int).Mul(minimumSDToBond, big.NewInt(MaxBondThreshold)) + + maxSDToUtilize := new(big.Int).Mul(minimumSDToBond, big.NewInt(MinToUtilizeRatioNum)) + maxSDToUtilize = maxSDToUtilize.Div(maxSDToUtilize, big.NewInt(MinToUtilizeRatioDenom)) hasEnoughSdCollateral, err := sd_collateral.HasEnoughSdCollateral(sdc, operatorAddress, 1, totalValidatorsPostAddition, nil) if err != nil { @@ -68,7 +75,8 @@ func GetSDStatus( SdBalance: sdBalance, SdCollateralCurrentAmount: sdCollateralCurrentAmount, SdCollateralRequireAmount: minimumSDToBond, - SdMaxCollateralAmount: maxSDToBound, + SdMaxUtilizableAmount: sdMaxCollateralAmount, + SdMaxCollateralAmount: maxSDToUtilize, PoolAvailableSDBalance: poolAvailableSDBalance, }, nil } From 3ea3bb02837144b129d65bc404fbbe0f9ddeb409 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 5 Dec 2023 11:04:35 +0700 Subject: [PATCH 017/159] Update deposit command --- shared/services/stader/node.go | 4 ++-- stader-cli/validator/deposit.go | 26 ++++++++++++++------------ stader/api/validator/commands.go | 16 ++++++++++------ stader/api/validator/deposit.go | 4 ++-- 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/shared/services/stader/node.go b/shared/services/stader/node.go index d2eb22586..5d5006dcb 100644 --- a/shared/services/stader/node.go +++ b/shared/services/stader/node.go @@ -207,8 +207,8 @@ func (c *Client) GetNodeDepositSdAllowance() (api.NodeDepositSdAllowanceResponse } // Check whether the node can make a deposit -func (c *Client) CanNodeDeposit(amountWei, amountUtilityWei, numValidators *big.Int, reloadKeys bool) (api.CanNodeDepositResponse, error) { - responseBytes, err := c.callAPI(fmt.Sprintf("validator can-deposit %s %s %s %t", amountWei.String(), amountUtilityWei.String(), numValidators, reloadKeys)) +func (c *Client) CanNodeDeposit(amountBasedWei, amountUtilityWei, numValidators *big.Int, reloadKeys bool) (api.CanNodeDepositResponse, error) { + responseBytes, err := c.callAPI(fmt.Sprintf("validator can-deposit %s %s %s %t", amountBasedWei.String(), amountUtilityWei.String(), numValidators, reloadKeys)) if err != nil { return api.CanNodeDepositResponse{}, fmt.Errorf("could not get can validator deposit status: %w", err) } diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index f9917b65a..7a524160e 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -67,21 +67,13 @@ func nodeDeposit(c *cli.Context) error { log.ColorReset, math.RoundDown(eth.WeiToEth(status.AccountBalances.Sd), eth.Decimal)) - canNodeDepositResponse, err := staderClient.CanNodeDeposit(baseAmount, big.NewInt(0), big.NewInt(int64(numValidators)), true) + // Get node SD status + sdStatusResp, err := staderClient.GetSDStatus() if err != nil { return err } - if canNodeDepositResponse.InsufficientBalance { - fmt.Printf("Account does not have enough ETH balance!") - return nil - } - if canNodeDepositResponse.DepositPaused { - fmt.Printf("Deposit is paused") - return nil - } - - sdStatus := canNodeDepositResponse.SdStatusResponse + sdStatus := sdStatusResp.SDStatus amountToCollateral := new(big.Int).Sub(sdStatus.SdCollateralRequireAmount, sdStatus.SdCollateralCurrentAmount) utilityAmount := big.NewInt(0) @@ -123,11 +115,21 @@ func nodeDeposit(c *cli.Context) error { } } - canNodeDepositResponse, err = staderClient.CanNodeDeposit(baseAmount, utilityAmount, big.NewInt(int64(numValidators)), true) + canNodeDepositResponse, err := staderClient.CanNodeDeposit(baseAmount, utilityAmount, big.NewInt(int64(numValidators)), true) if err != nil { return err } + if canNodeDepositResponse.InsufficientBalance { + fmt.Printf("Account does not have enough ETH balance!") + return nil + } + + if canNodeDepositResponse.DepositPaused { + fmt.Printf("Deposit is paused") + return nil + } + if canNodeDepositResponse.MaxValidatorLimitReached { fmt.Printf("Max validator limit reached") return nil diff --git a/stader/api/validator/commands.go b/stader/api/validator/commands.go index 2be290d80..0c16d9655 100644 --- a/stader/api/validator/commands.go +++ b/stader/api/validator/commands.go @@ -40,27 +40,31 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { UsageText: "stader-cli api validator can-deposit amount salt num-validators reload-keys", Action: func(c *cli.Context) error { - //// Validate args // Validate args - if err := cliutils.ValidateArgCount(c, 3); err != nil { + if err := cliutils.ValidateArgCount(c, 4); err != nil { return err } - amountWei, err := cliutils.ValidateWeiAmount("deposit amount", c.Args().Get(0)) + baseAmountWei, err := cliutils.ValidateWeiAmount("deposit amount", c.Args().Get(0)) if err != nil { return err } - numValidators, err := cliutils.ValidateBigInt("num-validators", c.Args().Get(1)) + utilityAmountWei, err := cliutils.ValidateWeiAmount("utility amount", c.Args().Get(1)) if err != nil { return err } - reloadKeys, err := cliutils.ValidateBool("reload-keys", c.Args().Get(2)) + numValidators, err := cliutils.ValidateBigInt("num-validators", c.Args().Get(2)) + if err != nil { + return err + } + + reloadKeys, err := cliutils.ValidateBool("reload-keys", c.Args().Get(3)) if err != nil { return err } - api.PrintResponse(canNodeDeposit(c, amountWei, numValidators, reloadKeys)) + api.PrintResponse(canNodeDeposit(c, baseAmountWei, utilityAmountWei, numValidators, reloadKeys)) return nil diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index 4da4163a3..26199317f 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -81,7 +81,7 @@ func GetSDStatus( }, nil } -func canNodeDeposit(c *cli.Context, amountWei *big.Int, numValidators *big.Int, reloadKeys bool) (*api.CanNodeDepositResponse, error) { +func canNodeDeposit(c *cli.Context, amountBaseWei, amountUtilityWei *big.Int, numValidators *big.Int, reloadKeys bool) (*api.CanNodeDepositResponse, error) { if err := services.RequireNodeWallet(c); err != nil { return nil, err } @@ -135,7 +135,7 @@ func canNodeDeposit(c *cli.Context, amountWei *big.Int, numValidators *big.Int, return nil, err } - amountToSend := amountWei.Mul(amountWei, numValidators) + amountToSend := amountBaseWei.Mul(amountBaseWei, numValidators) opts, err := w.GetNodeAccountTransactor() if err != nil { From a1c1b5563ce05597568d5ca9f7f7ec3278da36c2 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 5 Dec 2023 11:16:54 +0700 Subject: [PATCH 018/159] Refactor repay excess SD --- shared/services/stader/node.go | 40 ++----------------------------- stader-cli/node/repay-exess-sd.go | 15 ++++-------- stader-cli/node/repay-sd.go | 4 ++-- 3 files changed, 9 insertions(+), 50 deletions(-) diff --git a/shared/services/stader/node.go b/shared/services/stader/node.go index 5d5006dcb..c07ce6852 100644 --- a/shared/services/stader/node.go +++ b/shared/services/stader/node.go @@ -638,7 +638,7 @@ func (c *Client) SetRewardAddress(operatorRewardAddress common.Address) (api.Set return response, nil } -func (c *Client) NodeRepaySd(amountWei *big.Int) (api.NodeRepaySDResponse, error) { +func (c *Client) RepaySd(amountWei *big.Int) (api.NodeRepaySDResponse, error) { responseBytes, err := c.callAPI(fmt.Sprintf("node repay-sd %s", amountWei.String())) if err != nil { return api.NodeRepaySDResponse{}, fmt.Errorf("could not repay SD: %w", err) @@ -656,7 +656,7 @@ func (c *Client) NodeRepaySd(amountWei *big.Int) (api.NodeRepaySDResponse, error return response, nil } -func (c *Client) CanNodeRepaySd(amountWei *big.Int) (api.CanRepaySDResponse, error) { +func (c *Client) CanRepaySd(amountWei *big.Int) (api.CanRepaySDResponse, error) { responseBytes, err := c.callAPI(fmt.Sprintf("node can-repay-sd %s", amountWei.String())) if err != nil { return api.CanRepaySDResponse{}, fmt.Errorf("could not get CanNodeRepaySd SD: %w", err) @@ -710,42 +710,6 @@ func (c *Client) CanNodeUtilizeSd(amountWei *big.Int) (api.CanUtilitySDResponse, return response, nil } -func (c *Client) NodeRepayExcessSd(amountWei *big.Int) (api.NodeRepaySDResponse, error) { - responseBytes, err := c.callAPI(fmt.Sprintf("no repay-excess-sd %s", amountWei.String())) - if err != nil { - return api.NodeRepaySDResponse{}, fmt.Errorf("could not repay excess SD: %w", err) - } - - var response api.NodeRepaySDResponse - if err := json.Unmarshal(responseBytes, &response); err != nil { - return api.NodeRepaySDResponse{}, fmt.Errorf("could not decode repay excess response: %w", err) - } - - if response.Error != "" { - return api.NodeRepaySDResponse{}, fmt.Errorf("could not repay excess SD: %s", response.Error) - } - - return response, nil -} - -func (c *Client) CanRepayExcessSD(amountWei *big.Int) (api.CanRepayExcessSDResponse, error) { - responseBytes, err := c.callAPI(fmt.Sprintf("node can-repay-excess-sd %s", amountWei.String())) - if err != nil { - return api.CanRepayExcessSDResponse{}, fmt.Errorf("could not repay excess SD: %w", err) - } - - var response api.CanRepayExcessSDResponse - if err := json.Unmarshal(responseBytes, &response); err != nil { - return api.CanRepayExcessSDResponse{}, fmt.Errorf("could not decode node repay SD excess response: %w", err) - } - - if response.Error != "" { - return api.CanRepayExcessSDResponse{}, fmt.Errorf("could not repay excess SD: %s", response.Error) - } - - return response, nil -} - func (c *Client) GetSDStatus() (api.GetSdStatusResponse, error) { responseBytes, err := c.callAPI("node get-sd-status") if err != nil { diff --git a/stader-cli/node/repay-exess-sd.go b/stader-cli/node/repay-exess-sd.go index b39fb205a..48513edfb 100644 --- a/stader-cli/node/repay-exess-sd.go +++ b/stader-cli/node/repay-exess-sd.go @@ -41,12 +41,12 @@ func repayExcessSD(c *cli.Context) error { amountWei := eth.EthToWei(amount) - canRepayExcessSdResponse, err := staderClient.CanRepayExcessSD(amountWei) + canRepaySdResponse, err := staderClient.CanRepaySd(amountWei) if err != nil { return err } - sdStatus := canRepayExcessSdResponse.SdStatusResponse + sdStatus := canRepaySdResponse.SdStatusResponse // Do not had position if sdStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) <= 0 { @@ -61,24 +61,19 @@ func repayExcessSD(c *cli.Context) error { return nil } - err = gas.AssignMaxFeeAndLimit(canRepayExcessSdResponse.GasInfo, staderClient, c.Bool("yes")) + err = gas.AssignMaxFeeAndLimit(canRepaySdResponse.GasInfo, staderClient, c.Bool("yes")) if err != nil { return err } // Prompt for confirmation if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintln( - "Are you sure you want to repay SD?"))) { + "Are you sure you want to repay excess SD?"))) { fmt.Println("Cancelled.") return nil } - _, err = staderClient.CanNodeRepaySd(amountWei) - if err != nil { - return err - } - - res, err := staderClient.NodeRepaySd(amountWei) + res, err := staderClient.RepaySd(amountWei) if err != nil { return err } diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index de60e9bde..762ec2e96 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -40,7 +40,7 @@ func repaySD(c *cli.Context) error { amountWei := eth.EthToWei(amount) - canClaimElRewardsResponse, err := staderClient.CanNodeRepaySd(amountWei) + canClaimElRewardsResponse, err := staderClient.CanRepaySd(amountWei) if err != nil { return err } @@ -69,7 +69,7 @@ func repaySD(c *cli.Context) error { return nil } - res, err := staderClient.NodeRepaySd(amountWei) + res, err := staderClient.RepaySd(amountWei) if err != nil { return err } From 17b72da4e274255fab32be52531511a9501fe92a Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 5 Dec 2023 11:23:06 +0700 Subject: [PATCH 019/159] Remove unused sd status --- shared/types/api/node.go | 21 ++++++++++----------- stader/api/validator/deposit.go | 25 ------------------------- 2 files changed, 10 insertions(+), 36 deletions(-) diff --git a/shared/types/api/node.go b/shared/types/api/node.go index 3cf6564df..87ab6a3fd 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -92,17 +92,16 @@ type NodeDepositSdAllowanceResponse struct { } type CanNodeDepositResponse struct { - Status string `json:"status"` - Error string `json:"error"` - CanDeposit bool `json:"CanDeposit"` - InsufficientBalance bool `json:"insufficientBalance"` - InvalidAmount bool `json:"invalidAmount"` - DepositPaused bool `json:"depositPaused"` - MaxValidatorLimitReached bool `json:"maxValidatorLimitReached"` - InputKeyLimitReached bool `json:"inputKeyLimitReached"` - InputKeyLimit uint16 `json:"inputKeyLimit"` - SdStatusResponse *SdStatusResponse `json:"sdStatusResponse"` - GasInfo stader.GasInfo `json:"gasInfo"` + Status string `json:"status"` + Error string `json:"error"` + CanDeposit bool `json:"CanDeposit"` + InsufficientBalance bool `json:"insufficientBalance"` + InvalidAmount bool `json:"invalidAmount"` + DepositPaused bool `json:"depositPaused"` + MaxValidatorLimitReached bool `json:"maxValidatorLimitReached"` + InputKeyLimitReached bool `json:"inputKeyLimitReached"` + InputKeyLimit uint16 `json:"inputKeyLimit"` + GasInfo stader.GasInfo `json:"gasInfo"` } type NodeDepositResponse struct { diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index 26199317f..fb3e265ff 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -103,20 +103,6 @@ func canNodeDeposit(c *cli.Context, amountBaseWei, amountUtilityWei *big.Int, nu if err != nil { return nil, err } - sdc, err := services.GetSdCollateralContract(c) - if err != nil { - return nil, err - } - - sdt, err := services.GetSdTokenContract(c) - if err != nil { - return nil, err - } - - sdu, err := services.GetSdUtilityContract(c) - if err != nil { - return nil, err - } bc, err := services.GetBeaconClient(c) if err != nil { @@ -183,17 +169,6 @@ func canNodeDeposit(c *cli.Context, amountBaseWei, amountUtilityWei *big.Int, nu totalValidatorsPostAddition := totalValidatorNonTerminalKeys + numValidators.Uint64() - sdStatus, err := GetSDStatus(sdc, sdu, sdt, nodeAccount.Address, big.NewInt(int64(totalValidatorsPostAddition))) - if err != nil { - return nil, err - } - - canNodeDepositResponse.SdStatusResponse = sdStatus - - if canNodeDepositResponse.SdStatusResponse.NotEnoughSdCollateral { - return &canNodeDepositResponse, nil - } - inputKeyLimitCount, err := node.GetInputKeyLimitCount(prn, nil) if err != nil { return nil, err From 7cd195464f09cb864ff5025730ef47532e3d21cd Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 5 Dec 2023 11:25:29 +0700 Subject: [PATCH 020/159] Fix linter --- stader/api/validator/deposit.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index fb3e265ff..e91a9b919 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -81,7 +81,7 @@ func GetSDStatus( }, nil } -func canNodeDeposit(c *cli.Context, amountBaseWei, amountUtilityWei *big.Int, numValidators *big.Int, reloadKeys bool) (*api.CanNodeDepositResponse, error) { +func canNodeDeposit(c *cli.Context, amountBaseWei, amountUtilityWei, numValidators *big.Int, reloadKeys bool) (*api.CanNodeDepositResponse, error) { if err := services.RequireNodeWallet(c); err != nil { return nil, err } From 95d7143cd72219de25a59a96149f44aadf058b55 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Tue, 5 Dec 2023 12:31:08 +0530 Subject: [PATCH 021/159] add auto-deposit feature --- abis/SocializingPool.abi.json | 1889 +++++++++++----------- shared/services/stader/node.go | 8 +- stader-cli/node/claim-sp-rewards.go | 78 +- stader-lib/contracts/socializing-pool.go | 44 +- stader-lib/socializing-pool/rewards.go | 16 +- stader/api/node/claim-sp-rewards.go | 38 +- stader/api/node/commands.go | 25 +- 7 files changed, 1140 insertions(+), 958 deletions(-) diff --git a/abis/SocializingPool.abi.json b/abis/SocializingPool.abi.json index 397b322b3..2cc95528d 100644 --- a/abis/SocializingPool.abi.json +++ b/abis/SocializingPool.abi.json @@ -1,929 +1,964 @@ [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "CallerNotManager", - "type": "error" - }, - { - "inputs": [], - "name": "CallerNotStaderContract", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "ETHTransferFailed", - "type": "error" - }, - { - "inputs": [], - "name": "FutureCycleIndex", - "type": "error" - }, - { - "inputs": [], - "name": "InsufficientETHRewards", - "type": "error" - }, - { - "inputs": [], - "name": "InsufficientSDRewards", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidAmount", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidCycleIndex", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "cycle", - "type": "uint256" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "InvalidProof", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "uint256", - "name": "cycle", - "type": "uint256" - } - ], - "name": "RewardAlreadyClaimed", - "type": "error" - }, - { - "inputs": [], - "name": "RewardAlreadyHandled", - "type": "error" - }, - { - "inputs": [], - "name": "SDTransferFailed", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "ETHReceived", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "ethRewards", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sdRewards", - "type": "uint256" - } - ], - "name": "OperatorRewardsClaimed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "ethRewards", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalETHRewards", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sdRewards", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSDRewards", - "type": "uint256" - } - ], - "name": "OperatorRewardsUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Paused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "ethRewards", - "type": "uint256" - } - ], - "name": "ProtocolETHRewardsTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Unpaused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staderConfig", - "type": "address" - } - ], - "name": "UpdatedStaderConfig", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staderOperatorRegistry", - "type": "address" - } - ], - "name": "UpdatedStaderOperatorRegistry", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staderValidatorRegistry", - "type": "address" - } - ], - "name": "UpdatedStaderValidatorRegistry", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "ethRewards", - "type": "uint256" - } - ], - "name": "UserETHRewardsTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256[]", - "name": "_index", - "type": "uint256[]" - }, - { - "internalType": "uint256[]", - "name": "_amountSD", - "type": "uint256[]" - }, - { - "internalType": "uint256[]", - "name": "_amountETH", - "type": "uint256[]" - }, - { - "internalType": "bytes32[][]", - "name": "_merkleProof", - "type": "bytes32[][]" - } - ], - "name": "claim", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "claimedRewards", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getCurrentRewardsIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "getRewardCycleDetails", - "outputs": [ - { - "internalType": "uint256", - "name": "_startBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_endBlock", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getRewardDetails", - "outputs": [ - { - "internalType": "uint256", - "name": "currentIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "currentStartBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "currentEndBlock", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "reportingBlockNumber", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "merkleRoot", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "poolId", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "operatorETHRewards", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "userETHRewards", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "protocolETHRewards", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "operatorSDRewards", - "type": "uint256" - } - ], - "internalType": "struct RewardsData", - "name": "_rewardsData", - "type": "tuple" - } - ], - "name": "handleRewards", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "handledRewards", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initialBlock", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_admin", - "type": "address" - }, - { - "internalType": "address", - "name": "_staderConfig", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "lastReportedRewardsData", - "outputs": [ - { - "internalType": "uint256", - "name": "reportingBlockNumber", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "merkleRoot", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "poolId", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "operatorETHRewards", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "userETHRewards", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "protocolETHRewards", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "operatorSDRewards", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "rewardsDataMap", - "outputs": [ - { - "internalType": "uint256", - "name": "reportingBlockNumber", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "merkleRoot", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "poolId", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "operatorETHRewards", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "userETHRewards", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "protocolETHRewards", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "operatorSDRewards", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "staderConfig", - "outputs": [ - { - "internalType": "contract IStaderConfig", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalOperatorETHRewardsRemaining", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalOperatorSDRewardsRemaining", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "unpause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_staderConfig", - "type": "address" - } - ], - "name": "updateStaderConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_operator", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amountSD", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_amountETH", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "_merkleProof", - "type": "bytes32[]" - } - ], - "name": "verifyProof", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "CallerNotManager", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotStaderContract", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ETHTransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "FutureCycleIndex", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientETHRewards", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientSDRewards", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAmount", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidCycleIndex", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "cycle", + "type": "uint256" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "InvalidProof", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "cycle", + "type": "uint256" + } + ], + "name": "RewardAlreadyClaimed", + "type": "error" + }, + { + "inputs": [], + "name": "RewardAlreadyHandled", + "type": "error" + }, + { + "inputs": [], + "name": "SDTransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ETHReceived", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "ethRewards", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdRewards", + "type": "uint256" + } + ], + "name": "OperatorRewardsClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "ethRewards", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalETHRewards", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdRewards", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSDRewards", + "type": "uint256" + } + ], + "name": "OperatorRewardsUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "ethRewards", + "type": "uint256" + } + ], + "name": "ProtocolETHRewardsTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staderConfig", + "type": "address" + } + ], + "name": "UpdatedStaderConfig", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staderOperatorRegistry", + "type": "address" + } + ], + "name": "UpdatedStaderOperatorRegistry", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staderValidatorRegistry", + "type": "address" + } + ], + "name": "UpdatedStaderValidatorRegistry", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "ethRewards", + "type": "uint256" + } + ], + "name": "UserETHRewardsTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "_index", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "_amountSD", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "_amountETH", + "type": "uint256[]" + }, + { + "internalType": "bytes32[][]", + "name": "_merkleProof", + "type": "bytes32[][]" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "_index", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "_amountSD", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "_amountETH", + "type": "uint256[]" + }, + { + "internalType": "bytes32[][]", + "name": "_merkleProof", + "type": "bytes32[][]" + } + ], + "name": "claimAndDepositSD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "claimedRewards", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getCurrentRewardsIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + } + ], + "name": "getRewardCycleDetails", + "outputs": [ + { + "internalType": "uint256", + "name": "_startBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_endBlock", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRewardDetails", + "outputs": [ + { + "internalType": "uint256", + "name": "currentIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "currentStartBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "currentEndBlock", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "reportingBlockNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "merkleRoot", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "poolId", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "operatorETHRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "userETHRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "protocolETHRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "operatorSDRewards", + "type": "uint256" + } + ], + "internalType": "struct RewardsData", + "name": "_rewardsData", + "type": "tuple" + } + ], + "name": "handleRewards", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "handledRewards", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_admin", + "type": "address" + }, + { + "internalType": "address", + "name": "_staderConfig", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lastReportedRewardsData", + "outputs": [ + { + "internalType": "uint256", + "name": "reportingBlockNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "merkleRoot", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "poolId", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "operatorETHRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "userETHRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "protocolETHRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "operatorSDRewards", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxApproveSD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewardsDataMap", + "outputs": [ + { + "internalType": "uint256", + "name": "reportingBlockNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "merkleRoot", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "poolId", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "operatorETHRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "userETHRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "protocolETHRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "operatorSDRewards", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "staderConfig", + "outputs": [ + { + "internalType": "contract IStaderConfig", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalOperatorETHRewardsRemaining", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalOperatorSDRewardsRemaining", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staderConfig", + "type": "address" + } + ], + "name": "updateStaderConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_operator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amountSD", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_amountETH", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "_merkleProof", + "type": "bytes32[]" + } + ], + "name": "verifyProof", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } ] \ No newline at end of file diff --git a/shared/services/stader/node.go b/shared/services/stader/node.go index c07ce6852..e20b258ad 100644 --- a/shared/services/stader/node.go +++ b/shared/services/stader/node.go @@ -541,9 +541,9 @@ func (c *Client) CanClaimSpRewards() (api.CanClaimSpRewardsResponse, error) { return response, nil } -func (c *Client) EstimateClaimSpRewardsGas(cycles []*big.Int) (api.EstimateClaimSpRewardsGasResponse, error) { +func (c *Client) EstimateClaimSpRewardsGas(cycles []*big.Int, depositSd bool) (api.EstimateClaimSpRewardsGasResponse, error) { stringifiedCycleList := string_utils.StringifyArray(cycles) - responseBytes, err := c.callAPI(fmt.Sprintf("node estimate-claim-sp-rewards-gas %s", stringifiedCycleList)) + responseBytes, err := c.callAPI(fmt.Sprintf("node estimate-claim-sp-rewards-gas %s %s", stringifiedCycleList, strconv.FormatBool(depositSd))) if err != nil { return api.EstimateClaimSpRewardsGasResponse{}, fmt.Errorf("could not get node estimate-claim-sp-rewards-gas response: %w", err) } @@ -558,9 +558,9 @@ func (c *Client) EstimateClaimSpRewardsGas(cycles []*big.Int) (api.EstimateClaim return response, nil } -func (c *Client) ClaimSpRewards(cycles []*big.Int) (api.ClaimSpRewardsResponse, error) { +func (c *Client) ClaimSpRewards(cycles []*big.Int, depositSd bool) (api.ClaimSpRewardsResponse, error) { stringifiedCycleList := string_utils.StringifyArray(cycles) - responseBytes, err := c.callAPI(fmt.Sprintf("node claim-sp-rewards %s", stringifiedCycleList)) + responseBytes, err := c.callAPI(fmt.Sprintf("node claim-sp-rewards %s %s", stringifiedCycleList, strconv.FormatBool(depositSd))) if err != nil { return api.ClaimSpRewardsResponse{}, fmt.Errorf("could not get node claim-sp-rewards response: %w", err) } diff --git a/stader-cli/node/claim-sp-rewards.go b/stader-cli/node/claim-sp-rewards.go index e11d55f85..4d58a38b4 100644 --- a/stader-cli/node/claim-sp-rewards.go +++ b/stader-cli/node/claim-sp-rewards.go @@ -8,6 +8,7 @@ import ( "github.com/stader-labs/stader-node/shared/services/gas" "github.com/stader-labs/stader-node/shared/services/stader" + stader_backend "github.com/stader-labs/stader-node/shared/types/stader-backend" cliutils "github.com/stader-labs/stader-node/shared/utils/cli" "github.com/stader-labs/stader-node/shared/utils/math" "github.com/stader-labs/stader-node/stader-lib/utils/eth" @@ -61,6 +62,11 @@ func ClaimSpRewards(c *cli.Context) error { return nil } + indexedDetailedCyclesInfo := map[int64]stader_backend.CycleMerkleProofs{} + for _, cycleInfo := range detailedCyclesInfo.DetailedCyclesInfo { + indexedDetailedCyclesInfo[cycleInfo.MerkleProofInfo.Cycle] = cycleInfo.MerkleProofInfo + } + cycleIndexes := []*big.Int{} for _, cycleInfo := range detailedCyclesInfo.DetailedCyclesInfo { cycleIndexes = append(cycleIndexes, big.NewInt(cycleInfo.MerkleProofInfo.Cycle)) @@ -134,9 +140,59 @@ func ClaimSpRewards(c *cli.Context) error { cyclesToClaimArray = append(cyclesToClaimArray, big.NewInt(cycle)) } + totalClaimableEth := big.NewInt(0) + totalClaimableSd := big.NewInt(0) + for _, cycle := range cyclesToClaimArray { + cycleInfo := indexedDetailedCyclesInfo[cycle.Int64()] + ethRewards, ok := big.NewInt(0).SetString(cycleInfo.Eth, 10) + if !ok { + return fmt.Errorf("Unable to parse eth rewards: %s", cycleInfo.Eth) + } + totalClaimableEth = totalClaimableEth.Add(totalClaimableEth, ethRewards) + sdRewards, ok := big.NewInt(0).SetString(cycleInfo.Sd, 10) + if !ok { + return fmt.Errorf("Unable to parse sd rewards: %s", cycleInfo.Sd) + } + totalClaimableSd = totalClaimableSd.Add(totalClaimableSd, sdRewards) + } + + depositSd := false + if totalClaimableSd.Cmp(big.NewInt(0)) > 0 { + fmt.Printf("You will claim %f SD and %f ETH with the following selection - cycles %v\n\n", eth.WeiToEth(totalClaimableSd), eth.WeiToEth(totalClaimableEth), cyclesToClaimArray) + fmt.Printf("Your ETH rewards will be sent to your Reward Address\n") + fmt.Printf("For SD rewards, you can claim all the rewards to your Reward Address or redeposit them as SD collateral to earn more rewards\n") + + fmt.Printf("Please select one of the following options:\n") + fmt.Printf("1. Claim all SD rewards to your Reward Address\n") + fmt.Printf("2. Redeposit all the SD rewards as SD collateral for additional earnings\n") + + option := cliutils.Prompt("", "^(1|2)$", "Please enter a valid option") + if option == "1" { + if cliutils.Confirm(fmt.Sprintf( + "Are you sure you want to claim %f ETH and %f SD for cycles %v to your reward address?", eth.WeiToEth(totalClaimableEth), eth.WeiToEth(totalClaimableSd), cyclesToClaimArray)) { + fmt.Println("Claim Cancelled.") + return nil + } + } else if option == "2" { + if cliutils.Confirm(fmt.Sprintf( + "Your %f ETH rewards will be sent to your Reward Address.\n For your %f SD rewards, are you sure you want to re-deposit it as SD collateral for additional earnings?", eth.WeiToEth(totalClaimableEth), eth.WeiToEth(totalClaimableSd))) { + fmt.Println("Claim Cancelled.") + return nil + } + depositSd = true + } + + } else { + if cliutils.Confirm(fmt.Sprintf( + "Are you sure you want to claim %s ETH for cycles %v to your reward address?", totalClaimableEth.String(), cyclesToClaimArray)) { + fmt.Println("Cancelled.") + return nil + } + } + // estimate gas fmt.Println("Estimating gas...") - estimateGasResponse, err := staderClient.EstimateClaimSpRewardsGas(cyclesToClaimArray) + estimateGasResponse, err := staderClient.EstimateClaimSpRewardsGas(cyclesToClaimArray, depositSd) if err != nil { return err } @@ -147,14 +203,8 @@ func ClaimSpRewards(c *cli.Context) error { return err } - if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( - "Are you sure you want to claim the rewards for cycles %v?", cyclesToClaimArray))) { - fmt.Println("Cancelled.") - return nil - } - fmt.Printf("Claiming rewards for cycles %v\n", cyclesToClaimArray) - res, err := staderClient.ClaimSpRewards(cyclesToClaimArray) + res, err := staderClient.ClaimSpRewards(cyclesToClaimArray, depositSd) if err != nil { return err } @@ -165,8 +215,16 @@ func ClaimSpRewards(c *cli.Context) error { return err } - fmt.Printf("Rewards Claim successful for cycles: %v\n", cyclesToClaimArray) - fmt.Printf("Please check your Operator Reward Address for the claimed rewards\n") + fmt.Printf("Transaction Successful\n") + if depositSd { + fmt.Printf("%f ETH rewards have been sent to your Reward Address and %f SD rewards have been re-deposited as SD collateral\n", eth.WeiToEth(totalClaimableEth), eth.WeiToEth(totalClaimableSd)) + } else { + if totalClaimableSd.Cmp(big.NewInt(0)) <= 0 { + fmt.Printf("%f ETH rewards have been sent to your Reward Address\n", eth.WeiToEth(totalClaimableEth)) + } else { + fmt.Printf("%f SD rewards and %f ETH rewards have been sent to your Reward Address\n", eth.WeiToEth(totalClaimableSd), eth.WeiToEth(totalClaimableEth)) + } + } return nil } diff --git a/stader-lib/contracts/socializing-pool.go b/stader-lib/contracts/socializing-pool.go index b0c619251..eeb9d6f46 100644 --- a/stader-lib/contracts/socializing-pool.go +++ b/stader-lib/contracts/socializing-pool.go @@ -43,7 +43,7 @@ type RewardsData struct { // SocializingPoolMetaData contains all meta data concerning the SocializingPool contract. var SocializingPoolMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CallerNotManager\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotStaderContract\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"ETHTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FutureCycleIndex\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientETHRewards\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientSDRewards\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidCycleIndex\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"cycle\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"InvalidProof\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"cycle\",\"type\":\"uint256\"}],\"name\":\"RewardAlreadyClaimed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RewardAlreadyHandled\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"ETHReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ethRewards\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdRewards\",\"type\":\"uint256\"}],\"name\":\"OperatorRewardsClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ethRewards\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalETHRewards\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdRewards\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalSDRewards\",\"type\":\"uint256\"}],\"name\":\"OperatorRewardsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ethRewards\",\"type\":\"uint256\"}],\"name\":\"ProtocolETHRewardsTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"staderOperatorRegistry\",\"type\":\"address\"}],\"name\":\"UpdatedStaderOperatorRegistry\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"staderValidatorRegistry\",\"type\":\"address\"}],\"name\":\"UpdatedStaderValidatorRegistry\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ethRewards\",\"type\":\"uint256\"}],\"name\":\"UserETHRewardsTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_index\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amountSD\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amountETH\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes32[][]\",\"name\":\"_merkleProof\",\"type\":\"bytes32[][]\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"claimedRewards\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCurrentRewardsIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getRewardCycleDetails\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_startBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_endBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRewardDetails\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"currentIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"currentStartBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"currentEndBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"reportingBlockNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"merkleRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint8\",\"name\":\"poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"operatorETHRewards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"userETHRewards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"protocolETHRewards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"operatorSDRewards\",\"type\":\"uint256\"}],\"internalType\":\"structRewardsData\",\"name\":\"_rewardsData\",\"type\":\"tuple\"}],\"name\":\"handleRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"handledRewards\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastReportedRewardsData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"reportingBlockNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"merkleRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint8\",\"name\":\"poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"operatorETHRewards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"userETHRewards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"protocolETHRewards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"operatorSDRewards\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rewardsDataMap\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"reportingBlockNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"merkleRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint8\",\"name\":\"poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"operatorETHRewards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"userETHRewards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"protocolETHRewards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"operatorSDRewards\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"staderConfig\",\"outputs\":[{\"internalType\":\"contractIStaderConfig\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalOperatorETHRewardsRemaining\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalOperatorSDRewardsRemaining\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountSD\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_amountETH\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"_merkleProof\",\"type\":\"bytes32[]\"}],\"name\":\"verifyProof\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CallerNotManager\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotStaderContract\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"ETHTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FutureCycleIndex\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientETHRewards\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientSDRewards\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidCycleIndex\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"cycle\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"InvalidProof\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"cycle\",\"type\":\"uint256\"}],\"name\":\"RewardAlreadyClaimed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RewardAlreadyHandled\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"ETHReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ethRewards\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdRewards\",\"type\":\"uint256\"}],\"name\":\"OperatorRewardsClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ethRewards\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalETHRewards\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdRewards\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalSDRewards\",\"type\":\"uint256\"}],\"name\":\"OperatorRewardsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ethRewards\",\"type\":\"uint256\"}],\"name\":\"ProtocolETHRewardsTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"staderOperatorRegistry\",\"type\":\"address\"}],\"name\":\"UpdatedStaderOperatorRegistry\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"staderValidatorRegistry\",\"type\":\"address\"}],\"name\":\"UpdatedStaderValidatorRegistry\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ethRewards\",\"type\":\"uint256\"}],\"name\":\"UserETHRewardsTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_index\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amountSD\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amountETH\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes32[][]\",\"name\":\"_merkleProof\",\"type\":\"bytes32[][]\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_index\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amountSD\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amountETH\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes32[][]\",\"name\":\"_merkleProof\",\"type\":\"bytes32[][]\"}],\"name\":\"claimAndDepositSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"claimedRewards\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCurrentRewardsIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getRewardCycleDetails\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_startBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_endBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRewardDetails\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"currentIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"currentStartBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"currentEndBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"reportingBlockNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"merkleRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint8\",\"name\":\"poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"operatorETHRewards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"userETHRewards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"protocolETHRewards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"operatorSDRewards\",\"type\":\"uint256\"}],\"internalType\":\"structRewardsData\",\"name\":\"_rewardsData\",\"type\":\"tuple\"}],\"name\":\"handleRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"handledRewards\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastReportedRewardsData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"reportingBlockNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"merkleRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint8\",\"name\":\"poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"operatorETHRewards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"userETHRewards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"protocolETHRewards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"operatorSDRewards\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxApproveSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rewardsDataMap\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"reportingBlockNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"merkleRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint8\",\"name\":\"poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"operatorETHRewards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"userETHRewards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"protocolETHRewards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"operatorSDRewards\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"staderConfig\",\"outputs\":[{\"internalType\":\"contractIStaderConfig\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalOperatorETHRewardsRemaining\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalOperatorSDRewardsRemaining\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountSD\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_amountETH\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"_merkleProof\",\"type\":\"bytes32[]\"}],\"name\":\"verifyProof\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", } // SocializingPoolABI is the input ABI used to generate the binding from. @@ -861,6 +861,27 @@ func (_SocializingPool *SocializingPoolTransactorSession) Claim(_index []*big.In return _SocializingPool.Contract.Claim(&_SocializingPool.TransactOpts, _index, _amountSD, _amountETH, _merkleProof) } +// ClaimAndDepositSD is a paid mutator transaction binding the contract method 0x9cf5df42. +// +// Solidity: function claimAndDepositSD(uint256[] _index, uint256[] _amountSD, uint256[] _amountETH, bytes32[][] _merkleProof) returns() +func (_SocializingPool *SocializingPoolTransactor) ClaimAndDepositSD(opts *bind.TransactOpts, _index []*big.Int, _amountSD []*big.Int, _amountETH []*big.Int, _merkleProof [][][32]byte) (*types.Transaction, error) { + return _SocializingPool.contract.Transact(opts, "claimAndDepositSD", _index, _amountSD, _amountETH, _merkleProof) +} + +// ClaimAndDepositSD is a paid mutator transaction binding the contract method 0x9cf5df42. +// +// Solidity: function claimAndDepositSD(uint256[] _index, uint256[] _amountSD, uint256[] _amountETH, bytes32[][] _merkleProof) returns() +func (_SocializingPool *SocializingPoolSession) ClaimAndDepositSD(_index []*big.Int, _amountSD []*big.Int, _amountETH []*big.Int, _merkleProof [][][32]byte) (*types.Transaction, error) { + return _SocializingPool.Contract.ClaimAndDepositSD(&_SocializingPool.TransactOpts, _index, _amountSD, _amountETH, _merkleProof) +} + +// ClaimAndDepositSD is a paid mutator transaction binding the contract method 0x9cf5df42. +// +// Solidity: function claimAndDepositSD(uint256[] _index, uint256[] _amountSD, uint256[] _amountETH, bytes32[][] _merkleProof) returns() +func (_SocializingPool *SocializingPoolTransactorSession) ClaimAndDepositSD(_index []*big.Int, _amountSD []*big.Int, _amountETH []*big.Int, _merkleProof [][][32]byte) (*types.Transaction, error) { + return _SocializingPool.Contract.ClaimAndDepositSD(&_SocializingPool.TransactOpts, _index, _amountSD, _amountETH, _merkleProof) +} + // GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. // // Solidity: function grantRole(bytes32 role, address account) returns() @@ -924,6 +945,27 @@ func (_SocializingPool *SocializingPoolTransactorSession) Initialize(_admin comm return _SocializingPool.Contract.Initialize(&_SocializingPool.TransactOpts, _admin, _staderConfig) } +// MaxApproveSD is a paid mutator transaction binding the contract method 0x3e04cd35. +// +// Solidity: function maxApproveSD() returns() +func (_SocializingPool *SocializingPoolTransactor) MaxApproveSD(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SocializingPool.contract.Transact(opts, "maxApproveSD") +} + +// MaxApproveSD is a paid mutator transaction binding the contract method 0x3e04cd35. +// +// Solidity: function maxApproveSD() returns() +func (_SocializingPool *SocializingPoolSession) MaxApproveSD() (*types.Transaction, error) { + return _SocializingPool.Contract.MaxApproveSD(&_SocializingPool.TransactOpts) +} + +// MaxApproveSD is a paid mutator transaction binding the contract method 0x3e04cd35. +// +// Solidity: function maxApproveSD() returns() +func (_SocializingPool *SocializingPoolTransactorSession) MaxApproveSD() (*types.Transaction, error) { + return _SocializingPool.Contract.MaxApproveSD(&_SocializingPool.TransactOpts) +} + // Pause is a paid mutator transaction binding the contract method 0x8456cb59. // // Solidity: function pause() returns() diff --git a/stader-lib/socializing-pool/rewards.go b/stader-lib/socializing-pool/rewards.go index f3573d6c1..3779e7771 100644 --- a/stader-lib/socializing-pool/rewards.go +++ b/stader-lib/socializing-pool/rewards.go @@ -1,12 +1,13 @@ package socializing_pool import ( + "math/big" + "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/stader-labs/stader-node/stader-lib/stader" types2 "github.com/stader-labs/stader-node/stader-lib/types" - "math/big" ) func EstimateClaimRewards(sp *stader.SocializingPoolContractManager, index []*big.Int, amountSd []*big.Int, amountEth []*big.Int, merkleProof [][][32]byte, opts *bind.TransactOpts) (stader.GasInfo, error) { @@ -22,6 +23,19 @@ func ClaimRewards(sp *stader.SocializingPoolContractManager, index []*big.Int, a return tx, nil } +func EstimateClaimRewardsAndDepositSD(sp *stader.SocializingPoolContractManager, index []*big.Int, amountSd []*big.Int, amountEth []*big.Int, merkleProof [][][32]byte, opts *bind.TransactOpts) (stader.GasInfo, error) { + return sp.SocializingPoolContract.GetTransactionGasInfo(opts, "claimAndDepositSD", index, amountSd, amountEth, merkleProof) +} + +func ClaimRewardsAndDepositSD(sp *stader.SocializingPoolContractManager, index []*big.Int, amountSd []*big.Int, amountEth []*big.Int, merkleProof [][][32]byte, opts *bind.TransactOpts) (*types.Transaction, error) { + tx, err := sp.SocializingPool.ClaimAndDepositSD(opts, index, amountSd, amountEth, merkleProof) + if err != nil { + return nil, err + } + + return tx, nil +} + func GetRewardDetails(sp *stader.SocializingPoolContractManager, opts *bind.CallOpts) (types2.RewardCycleDetails, error) { return sp.SocializingPool.GetRewardDetails(opts) } diff --git a/stader/api/node/claim-sp-rewards.go b/stader/api/node/claim-sp-rewards.go index 66c07a06e..c83d68329 100644 --- a/stader/api/node/claim-sp-rewards.go +++ b/stader/api/node/claim-sp-rewards.go @@ -1,13 +1,16 @@ package node import ( + "math/big" + + "github.com/ethereum/go-ethereum/core/types" "github.com/stader-labs/stader-node/shared/services" "github.com/stader-labs/stader-node/shared/types/api" "github.com/stader-labs/stader-node/shared/utils/eth1" string_utils "github.com/stader-labs/stader-node/shared/utils/string-utils" socializing_pool "github.com/stader-labs/stader-node/stader-lib/socializing-pool" + "github.com/stader-labs/stader-node/stader-lib/stader" "github.com/urfave/cli" - "math/big" ) func GetCyclesDetailedInfo(c *cli.Context, stringifiedCycles string) (*api.CyclesDetailedInfo, error) { @@ -136,7 +139,7 @@ func canClaimSpRewards(c *cli.Context) (*api.CanClaimSpRewardsResponse, error) { return &response, nil } -func estimateSpRewardsGas(c *cli.Context, stringifiedCycles string) (*api.EstimateClaimSpRewardsGasResponse, error) { +func estimateSpRewardsGas(c *cli.Context, stringifiedCycles string, depositSd bool) (*api.EstimateClaimSpRewardsGasResponse, error) { sp, err := services.GetSocializingPoolContract(c) if err != nil { return nil, err @@ -166,9 +169,17 @@ func estimateSpRewardsGas(c *cli.Context, stringifiedCycles string) (*api.Estima return nil, err } - gasInfo, err := socializing_pool.EstimateClaimRewards(sp, cycles, amountSd, amountEth, merkleProofs, opts) - if err != nil { - return nil, err + gasInfo := stader.GasInfo{} + if depositSd { + gasInfo, err = socializing_pool.EstimateClaimRewardsAndDepositSD(sp, cycles, amountSd, amountEth, merkleProofs, opts) + if err != nil { + return nil, err + } + } else { + gasInfo, err = socializing_pool.EstimateClaimRewards(sp, cycles, amountSd, amountEth, merkleProofs, opts) + if err != nil { + return nil, err + } } response.GasInfo = gasInfo @@ -176,7 +187,7 @@ func estimateSpRewardsGas(c *cli.Context, stringifiedCycles string) (*api.Estima return &response, nil } -func claimSpRewards(c *cli.Context, stringifiedCycles string) (*api.ClaimSpRewardsResponse, error) { +func claimSpRewards(c *cli.Context, stringifiedCycles string, depositSd bool) (*api.ClaimSpRewardsResponse, error) { sp, err := services.GetSocializingPoolContract(c) if err != nil { return nil, err @@ -207,9 +218,18 @@ func claimSpRewards(c *cli.Context, stringifiedCycles string) (*api.ClaimSpRewar return nil, err } - tx, err := socializing_pool.ClaimRewards(sp, cycles, amountSd, amountEth, merkleProofs, opts) - if err != nil { - return nil, err + tx := &types.Transaction{} + + if depositSd { + tx, err = socializing_pool.ClaimRewardsAndDepositSD(sp, cycles, amountSd, amountEth, merkleProofs, opts) + if err != nil { + return nil, err + } + } else { + tx, err = socializing_pool.ClaimRewards(sp, cycles, amountSd, amountEth, merkleProofs, opts) + if err != nil { + return nil, err + } } response.TxHash = tx.Hash() diff --git a/stader/api/node/commands.go b/stader/api/node/commands.go index a6b2ebbe5..bb3744698 100644 --- a/stader/api/node/commands.go +++ b/stader/api/node/commands.go @@ -95,6 +95,9 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { } socializeMev, err := cliutils.ValidateBool("socialize-mev", c.Args().Get(2)) + if err != nil { + return err + } // Run api.PrintResponse(canRegisterNode(c, operatorName, operatorRewardAddress, socializeMev)) @@ -122,6 +125,9 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { } socializeMev, err := cliutils.ValidateBool("socialize-mev", c.Args().Get(2)) + if err != nil { + return err + } // Run api.PrintResponse(registerNode(c, operatorName, operatorRewardAddress, socializeMev)) @@ -668,18 +674,21 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { { Name: "claim-sp-rewards", Usage: "Claim the SP rewards", - UsageText: "stader-cli api node claim-sp-rewards cycles", + UsageText: "stader-cli api node claim-sp-rewards cycles deposit-sd", Action: func(c *cli.Context) error { // Validate args - if err := cliutils.ValidateArgCount(c, 1); err != nil { + if err := cliutils.ValidateArgCount(c, 2); err != nil { return err } cycles := c.Args().Get(0) - //fmt.Printf("cycles is %s\n", cycles) + depositSd, err := cliutils.ValidateBool("deposit-sd", c.Args().Get(1)) + if err != nil { + return err + } // Run - api.PrintResponse(claimSpRewards(c, cycles)) + api.PrintResponse(claimSpRewards(c, cycles, depositSd)) return nil }, @@ -691,13 +700,17 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { Action: func(c *cli.Context) error { // Validate args - if err := cliutils.ValidateArgCount(c, 1); err != nil { + if err := cliutils.ValidateArgCount(c, 2); err != nil { return err } cycles := c.Args().Get(0) + depositSd, err := cliutils.ValidateBool("deposit-sd", c.Args().Get(1)) + if err != nil { + return err + } // Run - api.PrintResponse(estimateSpRewardsGas(c, cycles)) + api.PrintResponse(estimateSpRewardsGas(c, cycles, depositSd)) return nil }, From 5e06938bb009797c3330eddce151ce5e1543fbc5 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 5 Dec 2023 16:24:34 +0700 Subject: [PATCH 022/159] Update get SD status --- shared/services/stader/node.go | 4 ++-- stader-cli/node/status.go | 9 ++++++++- stader-cli/node/utilize-sd.go | 2 +- stader-cli/validator/deposit.go | 2 +- stader/api/node/claim-rewards.go | 2 +- stader/api/node/commands.go | 11 ++++++++--- stader/api/node/repay-sd.go | 2 +- stader/api/node/sd-status.go | 12 +++++++++++- stader/api/node/withdraw-sd.go | 2 +- 9 files changed, 34 insertions(+), 12 deletions(-) diff --git a/shared/services/stader/node.go b/shared/services/stader/node.go index e20b258ad..d9a53d3ab 100644 --- a/shared/services/stader/node.go +++ b/shared/services/stader/node.go @@ -710,8 +710,8 @@ func (c *Client) CanNodeUtilizeSd(amountWei *big.Int) (api.CanUtilitySDResponse, return response, nil } -func (c *Client) GetSDStatus() (api.GetSdStatusResponse, error) { - responseBytes, err := c.callAPI("node get-sd-status") +func (c *Client) GetSDStatus(numValidators *big.Int) (api.GetSdStatusResponse, error) { + responseBytes, err := c.callAPI(fmt.Sprintf("node get-sd-status %s", numValidators)) if err != nil { return api.GetSdStatusResponse{}, fmt.Errorf("could not get-sd-status: %w", err) } diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 3e81fb93a..54437f208 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -162,7 +162,7 @@ func getNodeStatus(c *cli.Context) error { fmt.Printf("To view details of each validator, please use the %sstader-cli validator status%s command\n\n", log.ColorGreen, log.ColorReset) // Get node SD status - sdStatusResp, err := staderClient.GetSDStatus() + sdStatusResp, err := staderClient.GetSDStatus(big.NewInt(0)) if err != nil { return err } @@ -194,6 +194,13 @@ func getNodeStatus(c *cli.Context) error { log.ColorReset, math.RoundDown(eth.WeiToEth(selfBond), eth.Decimal)) + fmt.Printf( + "The node %s%s%s can utilize max of %.6f SD.\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, + math.RoundDown(eth.WeiToEth(sdStatus.SdMaxCollateralAmount), eth.Decimal)) + cur := eth.WeiToEth(sdStatus.SdCollateralCurrentAmount) min := eth.WeiToEth(sdStatus.SdCollateralRequireAmount) diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index 693d9b74a..dd7a112c4 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -33,7 +33,7 @@ func utilizeSD(c *cli.Context) error { return err } - sdStatusResponse, err := staderClient.GetSDStatus() + sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0)) if err != nil { return err } diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 7a524160e..d810d7d04 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -68,7 +68,7 @@ func nodeDeposit(c *cli.Context) error { math.RoundDown(eth.WeiToEth(status.AccountBalances.Sd), eth.Decimal)) // Get node SD status - sdStatusResp, err := staderClient.GetSDStatus() + sdStatusResp, err := staderClient.GetSDStatus(big.NewInt(int64(numValidators))) if err != nil { return err } diff --git a/stader/api/node/claim-rewards.go b/stader/api/node/claim-rewards.go index 44290ef48..b1d9605a2 100644 --- a/stader/api/node/claim-rewards.go +++ b/stader/api/node/claim-rewards.go @@ -40,7 +40,7 @@ func CanClaimRewards(c *cli.Context) (*api.CanClaimRewards, error) { return &response, nil } - sdStatus, err := getSDStatus(c) + sdStatus, err := getSDStatus(c, big.NewInt(0)) if err != nil { return nil, err } diff --git a/stader/api/node/commands.go b/stader/api/node/commands.go index bb3744698..b4bd58a8a 100644 --- a/stader/api/node/commands.go +++ b/stader/api/node/commands.go @@ -800,14 +800,19 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { { Name: "get-sd-status", Usage: "Get SD Status", - UsageText: "stader-cli api node get-sd-status", + Aliases: []string{"gsd"}, + UsageText: "stader-cli api node get-sd-status num-validators", Action: func(c *cli.Context) error { // Validate args - if err := cliutils.ValidateArgCount(c, 0); err != nil { + if err := cliutils.ValidateArgCount(c, 1); err != nil { + return err + } + numValidators, err := cliutils.ValidateBigInt("num-validators", c.Args().Get(0)) + if err != nil { return err } // Run - api.PrintResponse(getSDStatus(c)) + api.PrintResponse(getSDStatus(c, numValidators)) return nil }, }, diff --git a/stader/api/node/repay-sd.go b/stader/api/node/repay-sd.go index c31bb457a..19556d62e 100644 --- a/stader/api/node/repay-sd.go +++ b/stader/api/node/repay-sd.go @@ -41,7 +41,7 @@ func canRepaySD(c *cli.Context, amountWei *big.Int) (*api.CanRepaySDResponse, er return nil, err } - sdStatus, err := getSDStatus(c) + sdStatus, err := getSDStatus(c, big.NewInt(0)) if err != nil { return nil, err } diff --git a/stader/api/node/sd-status.go b/stader/api/node/sd-status.go index 304e9abf5..1cc6b78ee 100644 --- a/stader/api/node/sd-status.go +++ b/stader/api/node/sd-status.go @@ -4,6 +4,7 @@ import ( "math/big" "github.com/stader-labs/stader-node/stader-lib/node" + sd_collateral "github.com/stader-labs/stader-node/stader-lib/sd-collateral" "github.com/stader-labs/stader-node/stader/api/validator" "github.com/urfave/cli" @@ -12,7 +13,7 @@ import ( "github.com/stader-labs/stader-node/shared/types/api" ) -func getSDStatus(c *cli.Context) (*api.GetSdStatusResponse, error) { +func getSDStatus(c *cli.Context, numValidators *big.Int) (*api.GetSdStatusResponse, error) { sdc, err := services.GetSdCollateralContract(c) if err != nil { return nil, err @@ -64,6 +65,15 @@ func getSDStatus(c *cli.Context) (*api.GetSdStatusResponse, error) { return nil, err } + numValidators = numValidators.Add(numValidators, big.NewInt(int64(totalValidatorNonTerminalKeys))) + + hasEnoughSdCollateral, err := sd_collateral.HasEnoughSdCollateral(sdc, nodeAccount.Address, 1, numValidators, nil) + + if err != nil { + return nil, err + } + + sdStatus.NotEnoughSdCollateral = !hasEnoughSdCollateral return &api.GetSdStatusResponse{ SDStatus: sdStatus, }, nil diff --git a/stader/api/node/withdraw-sd.go b/stader/api/node/withdraw-sd.go index ce11e5328..a64b6fb75 100644 --- a/stader/api/node/withdraw-sd.go +++ b/stader/api/node/withdraw-sd.go @@ -46,7 +46,7 @@ func canWithdrawSd(c *cli.Context, amountWei *big.Int) (*api.CanWithdrawSdRespon return nil, err } - sdStatus, err := getSDStatus(c) + sdStatus, err := getSDStatus(c, big.NewInt(0)) if err != nil { return nil, err } From 58b532c7ea1663e26bb0c7b390e413634bd13801 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 5 Dec 2023 16:28:29 +0700 Subject: [PATCH 023/159] Update ABI --- abis/PermissionlessNodeRegistry.abi.json | 3045 ++++++++-------- abis/SDUtilityPool.abi.json | 911 +++++ abis/StaderConfig.abi.json | 4007 +++++++++++----------- 3 files changed, 4356 insertions(+), 3607 deletions(-) create mode 100644 abis/SDUtilityPool.abi.json diff --git a/abis/PermissionlessNodeRegistry.abi.json b/abis/PermissionlessNodeRegistry.abi.json index 93f109089..bd36bf44f 100644 --- a/abis/PermissionlessNodeRegistry.abi.json +++ b/abis/PermissionlessNodeRegistry.abi.json @@ -1,1649 +1,1404 @@ [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "CallerNotManager", - "type": "error" - }, - { - "inputs": [], - "name": "CallerNotOperator", - "type": "error" - }, - { - "inputs": [], - "name": "CallerNotStaderContract", - "type": "error" - }, - { - "inputs": [], - "name": "CooldownNotComplete", - "type": "error" - }, - { - "inputs": [], - "name": "DuplicatePoolIDOrPoolNotAdded", - "type": "error" - }, - { - "inputs": [], - "name": "InSufficientBalance", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidBondEthValue", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidKeyCount", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidStartAndEndIndex", - "type": "error" - }, - { - "inputs": [], - "name": "MisMatchingInputKeysSize", - "type": "error" - }, - { - "inputs": [], - "name": "NoChangeInState", - "type": "error" - }, - { - "inputs": [], - "name": "NotEnoughSDCollateral", - "type": "error" - }, - { - "inputs": [], - "name": "OperatorAlreadyOnBoardedInProtocol", - "type": "error" - }, - { - "inputs": [], - "name": "OperatorIsDeactivate", - "type": "error" - }, - { - "inputs": [], - "name": "OperatorNotOnBoarded", - "type": "error" - }, - { - "inputs": [], - "name": "PageNumberIsZero", - "type": "error" - }, - { - "inputs": [], - "name": "PubkeyAlreadyExist", - "type": "error" - }, - { - "inputs": [], - "name": "TooManyVerifiedKeysReported", - "type": "error" - }, - { - "inputs": [], - "name": "TooManyWithdrawnKeysReported", - "type": "error" - }, - { - "inputs": [], - "name": "TransferFailed", - "type": "error" - }, - { - "inputs": [], - "name": "UNEXPECTED_STATUS", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "maxKeyLimitReached", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "nodeOperator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "validatorId", - "type": "uint256" - } - ], - "name": "AddedValidatorKey", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "totalActiveValidatorCount", - "type": "uint256" - } - ], - "name": "DecreasedTotalActiveValidatorCount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "totalActiveValidatorCount", - "type": "uint256" - } - ], - "name": "IncreasedTotalActiveValidatorCount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "nodeOperator", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "nodeRewardAddress", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "operatorId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bool", - "name": "optInForSocializingPool", - "type": "bool" - } - ], - "name": "OnboardedOperator", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Paused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TransferredCollateralToPool", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Unpaused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "batchKeyDepositLimit", - "type": "uint256" - } - ], - "name": "UpdatedInputKeyCountLimit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint64", + { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, + { "inputs": [], "name": "CallerNotExistingRewardAddress", "type": "error" }, + { "inputs": [], "name": "CallerNotManager", "type": "error" }, + { "inputs": [], "name": "CallerNotNewRewardAddress", "type": "error" }, + { "inputs": [], "name": "CallerNotOperator", "type": "error" }, + { "inputs": [], "name": "CallerNotStaderContract", "type": "error" }, + { "inputs": [], "name": "CooldownNotComplete", "type": "error" }, + { "inputs": [], "name": "DuplicatePoolIDOrPoolNotAdded", "type": "error" }, + { "inputs": [], "name": "InSufficientBalance", "type": "error" }, + { "inputs": [], "name": "InvalidBondEthValue", "type": "error" }, + { "inputs": [], "name": "InvalidKeyCount", "type": "error" }, + { "inputs": [], "name": "InvalidStartAndEndIndex", "type": "error" }, + { "inputs": [], "name": "MisMatchingInputKeysSize", "type": "error" }, + { "inputs": [], "name": "NoChangeInState", "type": "error" }, + { "inputs": [], "name": "NotEnoughSDCollateral", "type": "error" }, + { + "inputs": [], + "name": "OperatorAlreadyOnBoardedInProtocol", + "type": "error" + }, + { "inputs": [], "name": "OperatorIsDeactivate", "type": "error" }, + { "inputs": [], "name": "OperatorNotOnBoarded", "type": "error" }, + { "inputs": [], "name": "PageNumberIsZero", "type": "error" }, + { "inputs": [], "name": "PubkeyAlreadyExist", "type": "error" }, + { "inputs": [], "name": "TooManyVerifiedKeysReported", "type": "error" }, + { "inputs": [], "name": "TooManyWithdrawnKeysReported", "type": "error" }, + { "inputs": [], "name": "TransferFailed", "type": "error" }, + { "inputs": [], "name": "UNEXPECTED_STATUS", "type": "error" }, + { "inputs": [], "name": "ZeroAddress", "type": "error" }, + { "inputs": [], "name": "maxKeyLimitReached", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "nodeOperator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "AddedValidatorKey", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "totalActiveValidatorCount", + "type": "uint256" + } + ], + "name": "DecreasedTotalActiveValidatorCount", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "totalActiveValidatorCount", + "type": "uint256" + } + ], + "name": "IncreasedTotalActiveValidatorCount", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "nodeOperator", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "nodeRewardAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "operatorId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "optInForSocializingPool", + "type": "bool" + } + ], + "name": "OnboardedOperator", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "nodeOperator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardAddress", + "type": "address" + } + ], + "name": "OperatorRewardAddressUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "nodeOperator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardAddress", + "type": "address" + } + ], + "name": "RewardAddressProposed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "TransferredCollateralToPool", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "batchKeyDepositLimit", + "type": "uint256" + } + ], + "name": "UpdatedInputKeyCountLimit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "maxNonTerminalKeyPerOperator", + "type": "uint64" + } + ], + "name": "UpdatedMaxNonTerminalKeyPerOperator", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "nextQueuedValidatorIndex", + "type": "uint256" + } + ], + "name": "UpdatedNextQueuedValidatorIndex", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "nodeOperator", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "operatorName", + "type": "string" + } + ], + "name": "UpdatedOperatorName", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "operatorId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "optedForSocializingPool", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "block", + "type": "uint256" + } + ], + "name": "UpdatedSocializingPoolState", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staderConfig", + "type": "address" + } + ], + "name": "UpdatedStaderConfig", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "depositBlock", + "type": "uint256" + } + ], + "name": "UpdatedValidatorDepositBlock", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "verifiedKeysBatchSize", + "type": "uint256" + } + ], + "name": "UpdatedVerifiedKeyBatchSize", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "withdrawnKeysBatchSize", + "type": "uint256" + } + ], + "name": "UpdatedWithdrawnKeyBatchSize", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "ValidatorMarkedAsFrontRunned", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "ValidatorMarkedReadyToDeposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "ValidatorStatusMarkedAsInvalidSignature", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "ValidatorWithdrawn", + "type": "event" + }, + { + "inputs": [], + "name": "COLLATERAL_ETH", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { "internalType": "bytes32", "name": "", "type": "bytes32" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "FRONT_RUN_PENALTY", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "POOL_ID", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes[]", "name": "_pubkey", "type": "bytes[]" }, + { + "internalType": "bytes[]", + "name": "_preDepositSignature", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "_depositSignature", + "type": "bytes[]" + } + ], + "name": "addValidatorKeys", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amountOfSDToUtilize", + "type": "uint256" + }, + { "internalType": "bytes[]", "name": "_pubkey", "type": "bytes[]" }, + { + "internalType": "bytes[]", + "name": "_preDepositSignature", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "_depositSignature", + "type": "bytes[]" + } + ], + "name": "addValidatorKeysWithUtilizeSD", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_optInForSocializingPool", + "type": "bool" + } + ], + "name": "changeSocializingPoolState", + "outputs": [ + { + "internalType": "address", + "name": "feeRecipientAddress", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operatorAddress", + "type": "address" + } + ], + "name": "confirmRewardAddressChange", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_pageNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_pageSize", + "type": "uint256" + } + ], + "name": "getAllActiveValidators", + "outputs": [ + { + "components": [ + { + "internalType": "enum ValidatorStatus", + "name": "status", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "preDepositSignature", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "depositSignature", + "type": "bytes" + }, + { + "internalType": "address", + "name": "withdrawVaultAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "operatorId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "depositBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawnBlock", + "type": "uint256" + } + ], + "internalType": "struct Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_pageNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_pageSize", + "type": "uint256" + } + ], + "name": "getAllNodeELVaultAddress", + "outputs": [ + { "internalType": "address[]", "name": "", "type": "address[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getCollateralETH", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_operatorId", + "type": "uint256" + } + ], + "name": "getOperatorRewardAddress", + "outputs": [ + { "internalType": "address payable", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_operatorId", + "type": "uint256" + } + ], + "name": "getOperatorTotalKeys", + "outputs": [ + { + "internalType": "uint256", + "name": "_totalKeys", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_nodeOperator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_startIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_endIndex", + "type": "uint256" + } + ], + "name": "getOperatorTotalNonTerminalKeys", + "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" } + ], + "name": "getRoleAdmin", + "outputs": [ + { "internalType": "bytes32", "name": "", "type": "bytes32" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_operatorId", + "type": "uint256" + } + ], + "name": "getSocializingPoolStateChangeBlock", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalActiveValidatorCount", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalQueuedValidatorCount", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_pageNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_pageSize", + "type": "uint256" + } + ], + "name": "getValidatorsByOperator", + "outputs": [ + { + "components": [ + { + "internalType": "enum ValidatorStatus", + "name": "status", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "preDepositSignature", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "depositSignature", + "type": "bytes" + }, + { + "internalType": "address", + "name": "withdrawVaultAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "operatorId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "depositBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawnBlock", + "type": "uint256" + } + ], + "internalType": "struct Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "hasRole", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_count", "type": "uint256" } + ], + "name": "increaseTotalActiveValidatorCount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_admin", "type": "address" }, + { + "internalType": "address", + "name": "_staderConfig", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "inputKeyCountLimit", + "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operAddr", + "type": "address" + } + ], + "name": "isExistingOperator", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes", "name": "_pubkey", "type": "bytes" } + ], + "name": "isExistingPubkey", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "_readyToDepositPubkey", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "_frontRunPubkey", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "_invalidSignaturePubkey", + "type": "bytes[]" + } + ], + "name": "markValidatorReadyToDeposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], "name": "maxNonTerminalKeyPerOperator", - "type": "uint64" - } - ], - "name": "UpdatedMaxNonTerminalKeyPerOperator", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", + "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextOperatorId", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], "name": "nextQueuedValidatorIndex", - "type": "uint256" - } - ], - "name": "UpdatedNextQueuedValidatorIndex", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "nodeOperator", - "type": "address" - }, - { - "indexed": false, - "internalType": "string", - "name": "operatorName", - "type": "string" - }, - { - "indexed": false, - "internalType": "address", - "name": "rewardAddress", - "type": "address" - } - ], - "name": "UpdatedOperatorDetails", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "operatorId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bool", - "name": "optedForSocializingPool", - "type": "bool" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "block", - "type": "uint256" - } - ], - "name": "UpdatedSocializingPoolState", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextValidatorId", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "name": "nodeELRewardVaultByOperatorId", + "outputs": [ + { "internalType": "address", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_optInForSocializingPool", + "type": "bool" + }, + { + "internalType": "string", + "name": "_operatorName", + "type": "string" + }, + { + "internalType": "address payable", + "name": "_operatorRewardAddress", + "type": "address" + } + ], + "name": "onboardNodeOperator", + "outputs": [ + { + "internalType": "address", + "name": "feeRecipientAddress", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "operatorIDByAddress", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "name": "operatorStructById", + "outputs": [ + { "internalType": "bool", "name": "active", "type": "bool" }, + { + "internalType": "bool", + "name": "optedForSocializingPool", + "type": "bool" + }, + { + "internalType": "string", + "name": "operatorName", + "type": "string" + }, + { + "internalType": "address payable", + "name": "operatorRewardAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "operatorAddress", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operatorAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_newRewardAddress", + "type": "address" + } + ], + "name": "proposeRewardAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "name": "proposedRewardAddressByOperatorId", + "outputs": [ + { "internalType": "address", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "name": "queuedValidators", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "name": "socializingPoolStateChangeBlock", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], "name": "staderConfig", - "type": "address" - } - ], - "name": "UpdatedStaderConfig", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "validatorId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "depositBlock", - "type": "uint256" - } - ], - "name": "UpdatedValidatorDepositBlock", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "verifiedKeysBatchSize", - "type": "uint256" - } - ], - "name": "UpdatedVerifiedKeyBatchSize", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "withdrawnKeysBatchSize", - "type": "uint256" - } - ], - "name": "UpdatedWithdrawnKeyBatchSize", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "validatorId", - "type": "uint256" - } - ], - "name": "ValidatorMarkedAsFrontRunned", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "validatorId", - "type": "uint256" - } - ], - "name": "ValidatorMarkedReadyToDeposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "validatorId", - "type": "uint256" - } - ], - "name": "ValidatorStatusMarkedAsInvalidSignature", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "validatorId", - "type": "uint256" - } - ], - "name": "ValidatorWithdrawn", - "type": "event" - }, - { - "inputs": [], - "name": "COLLATERAL_ETH", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "FRONT_RUN_PENALTY", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "POOL_ID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes[]", - "name": "_pubkey", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "_preDepositSignature", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "_depositSignature", - "type": "bytes[]" - } - ], - "name": "addValidatorKeys", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_optInForSocializingPool", - "type": "bool" - } - ], - "name": "changeSocializingPoolState", - "outputs": [ - { - "internalType": "address", - "name": "feeRecipientAddress", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_pageNumber", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_pageSize", - "type": "uint256" - } - ], - "name": "getAllActiveValidators", - "outputs": [ - { - "components": [ - { - "internalType": "enum ValidatorStatus", - "name": "status", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "preDepositSignature", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "depositSignature", - "type": "bytes" - }, - { - "internalType": "address", - "name": "withdrawVaultAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "operatorId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "depositBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "withdrawnBlock", - "type": "uint256" - } - ], - "internalType": "struct Validator[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_pageNumber", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_pageSize", - "type": "uint256" - } - ], - "name": "getAllNodeELVaultAddress", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getCollateralETH", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_operatorId", - "type": "uint256" - } - ], - "name": "getOperatorRewardAddress", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_operatorId", - "type": "uint256" - } - ], - "name": "getOperatorTotalKeys", - "outputs": [ - { - "internalType": "uint256", - "name": "_totalKeys", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_nodeOperator", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_startIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_endIndex", - "type": "uint256" - } - ], - "name": "getOperatorTotalNonTerminalKeys", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_operatorId", - "type": "uint256" - } - ], - "name": "getSocializingPoolStateChangeBlock", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getTotalActiveValidatorCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getTotalQueuedValidatorCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_operator", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_pageNumber", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_pageSize", - "type": "uint256" - } - ], - "name": "getValidatorsByOperator", - "outputs": [ - { - "components": [ - { - "internalType": "enum ValidatorStatus", - "name": "status", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "preDepositSignature", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "depositSignature", - "type": "bytes" - }, - { - "internalType": "address", - "name": "withdrawVaultAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "operatorId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "depositBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "withdrawnBlock", - "type": "uint256" - } - ], - "internalType": "struct Validator[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_count", - "type": "uint256" - } - ], - "name": "increaseTotalActiveValidatorCount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_admin", - "type": "address" - }, - { - "internalType": "address", - "name": "_staderConfig", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "inputKeyCountLimit", - "outputs": [ - { - "internalType": "uint16", - "name": "", - "type": "uint16" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_operAddr", - "type": "address" - } - ], - "name": "isExistingOperator", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "_pubkey", - "type": "bytes" - } - ], - "name": "isExistingPubkey", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes[]", - "name": "_readyToDepositPubkey", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "_frontRunPubkey", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "_invalidSignaturePubkey", - "type": "bytes[]" - } - ], - "name": "markValidatorReadyToDeposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "maxNonTerminalKeyPerOperator", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "nextOperatorId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "nextQueuedValidatorIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "nextValidatorId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "nodeELRewardVaultByOperatorId", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_optInForSocializingPool", - "type": "bool" - }, - { - "internalType": "string", - "name": "_operatorName", - "type": "string" - }, - { - "internalType": "address payable", - "name": "_operatorRewardAddress", - "type": "address" - } - ], - "name": "onboardNodeOperator", - "outputs": [ - { - "internalType": "address", - "name": "feeRecipientAddress", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "operatorIDByAddress", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "operatorStructById", - "outputs": [ - { - "internalType": "bool", - "name": "active", - "type": "bool" - }, - { - "internalType": "bool", - "name": "optedForSocializingPool", - "type": "bool" - }, - { - "internalType": "string", - "name": "operatorName", - "type": "string" - }, - { - "internalType": "address payable", - "name": "operatorRewardAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "operatorAddress", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "queuedValidators", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "socializingPoolStateChangeBlock", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "staderConfig", - "outputs": [ - { - "internalType": "contract IStaderConfig", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalActiveValidatorCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "transferCollateralToPool", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "unpause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_validatorId", - "type": "uint256" - } - ], - "name": "updateDepositStatusAndBlock", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint16", - "name": "_inputKeyCountLimit", - "type": "uint16" - } - ], - "name": "updateInputKeyCountLimit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint64", - "name": "_maxNonTerminalKeyPerOperator", - "type": "uint64" - } - ], - "name": "updateMaxNonTerminalKeyPerOperator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_nextQueuedValidatorIndex", - "type": "uint256" - } - ], - "name": "updateNextQueuedValidatorIndex", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "_operatorName", - "type": "string" - }, - { - "internalType": "address payable", - "name": "_rewardAddress", - "type": "address" - } - ], - "name": "updateOperatorDetails", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_staderConfig", - "type": "address" - } - ], - "name": "updateStaderConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_verifiedKeysBatchSize", - "type": "uint256" - } - ], - "name": "updateVerifiedKeysBatchSize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "validatorIdByPubkey", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "validatorIdsByOperatorId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "validatorQueueSize", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "validatorRegistry", - "outputs": [ - { - "internalType": "enum ValidatorStatus", - "name": "status", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "preDepositSignature", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "depositSignature", - "type": "bytes" - }, - { - "internalType": "address", - "name": "withdrawVaultAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "operatorId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "depositBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "withdrawnBlock", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "verifiedKeyBatchSize", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes[]", - "name": "_pubkeys", - "type": "bytes[]" - } - ], - "name": "withdrawnValidators", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] \ No newline at end of file + "outputs": [ + { + "internalType": "contract IStaderConfig", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalActiveValidatorCount", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_amount", "type": "uint256" } + ], + "name": "transferCollateralToPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_validatorId", + "type": "uint256" + } + ], + "name": "updateDepositStatusAndBlock", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_inputKeyCountLimit", + "type": "uint16" + } + ], + "name": "updateInputKeyCountLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "_maxNonTerminalKeyPerOperator", + "type": "uint64" + } + ], + "name": "updateMaxNonTerminalKeyPerOperator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_nextQueuedValidatorIndex", + "type": "uint256" + } + ], + "name": "updateNextQueuedValidatorIndex", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_operatorName", + "type": "string" + } + ], + "name": "updateOperatorName", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staderConfig", + "type": "address" + } + ], + "name": "updateStaderConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_verifiedKeysBatchSize", + "type": "uint256" + } + ], + "name": "updateVerifiedKeysBatchSize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "name": "validatorIdByPubkey", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "name": "validatorIdsByOperatorId", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "validatorQueueSize", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "name": "validatorRegistry", + "outputs": [ + { + "internalType": "enum ValidatorStatus", + "name": "status", + "type": "uint8" + }, + { "internalType": "bytes", "name": "pubkey", "type": "bytes" }, + { + "internalType": "bytes", + "name": "preDepositSignature", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "depositSignature", + "type": "bytes" + }, + { + "internalType": "address", + "name": "withdrawVaultAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "operatorId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "depositBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawnBlock", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "verifiedKeyBatchSize", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes[]", "name": "_pubkeys", "type": "bytes[]" } + ], + "name": "withdrawnValidators", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/abis/SDUtilityPool.abi.json b/abis/SDUtilityPool.abi.json new file mode 100644 index 000000000..92be5ffd9 --- /dev/null +++ b/abis/SDUtilityPool.abi.json @@ -0,0 +1,911 @@ +[ + { "inputs": [], "name": "AccrualBlockNumberNotLatest", "type": "error" }, + { "inputs": [], "name": "CallerNotAuthorizedToRedeem", "type": "error" }, + { "inputs": [], "name": "CannotFindRequestId", "type": "error" }, + { "inputs": [], "name": "InsufficientPoolBalance", "type": "error" }, + { "inputs": [], "name": "InvalidAmountOfWithdraw", "type": "error" }, + { "inputs": [], "name": "InvalidInput", "type": "error" }, + { "inputs": [], "name": "InvalidWithdrawAmount", "type": "error" }, + { + "inputs": [], + "name": "MaxLimitOnWithdrawRequestCountReached", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + } + ], + "name": "RequestIdNotFinalized", + "type": "error" + }, + { "inputs": [], "name": "SDTransferFailed", "type": "error" }, + { "inputs": [], "name": "SDUtilizeLimitReached", "type": "error" }, + { "inputs": [], "name": "UndelegationPeriodNotPassed", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "feeAccumulated", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalProtocolFee", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalUtilizedSD", + "type": "uint256" + } + ], + "name": "AccruedFees", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidationBonusInEth", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidationFeeInEth", + "type": "uint256" + } + ], + "name": "ClaimedLiquidation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdXToMint", + "type": "uint256" + } + ], + "name": "Delegated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "nextRequestIdToFinalize", + "type": "uint256" + } + ], + "name": "FinalizedWithdrawRequest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalLiquidationAmountInEth", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidationBonusInEth", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidationFeeInEth", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "liquidator", + "type": "address" + } + ], + "name": "LiquidationCall", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "protocolFeeFactor", + "type": "uint256" + } + ], + "name": "ProtocolFeeFactorUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdXAmount", + "type": "uint256" + } + ], + "name": "Redeemed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "utilizer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "Repaid", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdToTransfer", + "type": "uint256" + } + ], + "name": "RequestRedeemed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "utilizer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "utilizeAmount", + "type": "uint256" + } + ], + "name": "SDUtilized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "finalizationBatchLimit", + "type": "uint256" + } + ], + "name": "UpdatedFinalizationBatchLimit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "maxETHWorthOfSDPerValidator", + "type": "uint256" + } + ], + "name": "UpdatedMaxETHWorthOfSDPerValidator", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "count", + "type": "uint256" + } + ], + "name": "UpdatedMaxNonRedeemedDelegatorRequestCount", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "minBlockDelayToFinalizeRequest", + "type": "uint256" + } + ], + "name": "UpdatedMinBlockDelayToFinalizeRequest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_staderConfig", + "type": "address" + } + ], + "name": "UpdatedStaderConfig", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "undelegationPeriodInBlocks", + "type": "uint256" + } + ], + "name": "UpdatedUndelegationPeriodInBlocks", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "utilizationRatePerBlock", + "type": "uint256" + } + ], + "name": "UtilizationRatePerBlockUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "nextRequestId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdAmountToWithdraw", + "type": "uint256" + } + ], + "name": "WithdrawRequestReceived", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "WithdrawnProtocolFee", + "type": "event" + }, + { + "inputs": [], + "name": "accrueFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "cTokenTotalSupply", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "index", "type": "uint256" } + ], + "name": "claimLiquidation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "sdAmount", "type": "uint256" } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "delegatorCTokenBalance", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "delegatorWithdrawRequestedCTokenCount", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "name": "delegatorWithdrawRequests", + "outputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { + "internalType": "uint256", + "name": "amountOfCToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "sdExpected", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "sdFinalized", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestBlock", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "exchangeRateCurrent", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "exchangeRateStored", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "finalizeDelegatorWithdrawalRequest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getDelegationRate", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_delegator", + "type": "address" + } + ], + "name": "getDelegatorLatestSDBalance", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getLatestExchangeRate", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "getOperatorLiquidation", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "totalAmountInEth", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBonusInEth", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalFeeInEth", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isRepaid", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isClaimed", + "type": "bool" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + } + ], + "internalType": "struct OperatorLiquidation", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPoolAvailableSDBalance", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_owner", "type": "address" } + ], + "name": "getRequestIdsByDelegator", + "outputs": [ + { "internalType": "uint256[]", "name": "", "type": "uint256[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_utilizer", + "type": "address" + } + ], + "name": "getUtilizerLatestBalance", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "liquidationCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "maxApproveSD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "poolUtilization", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repay", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "repayLiquidation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "utilizer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repayOnBehalf", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "name": "requestIdsByDelegatorAddress", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "cTokenAmount", + "type": "uint256" + } + ], + "name": "requestWithdraw", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "sdAmount", "type": "uint256" } + ], + "name": "requestWithdrawWithSDAmount", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_finalizationBatchLimit", + "type": "uint256" + } + ], + "name": "updateFinalizationBatchLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_maxETHWorthOfSDPerValidator", + "type": "uint256" + } + ], + "name": "updateMaxETHWorthOfSDPerValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_count", "type": "uint256" } + ], + "name": "updateMaxNonRedeemedDelegatorRequestCount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_minBlockDelayToFinalizeRequest", + "type": "uint256" + } + ], + "name": "updateMinBlockDelayToFinalizeRequest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_protocolFeeFactor", + "type": "uint256" + } + ], + "name": "updateProtocolFeeFactor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staderConfig", + "type": "address" + } + ], + "name": "updateStaderConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_undelegationPeriodInBlocks", + "type": "uint256" + } + ], + "name": "updateUndelegationPeriodInBlocks", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_utilizationRatePerBlock", + "type": "uint256" + } + ], + "name": "updateUtilizationRatePerBlock", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "utilizeAmount", + "type": "uint256" + } + ], + "name": "utilize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "utilizeAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nonTerminalKeyCount", + "type": "uint256" + } + ], + "name": "utilizeWhileAddingKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "utilizerBalanceCurrent", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "utilizerBalanceStored", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "utilizerData", + "outputs": [ + { + "internalType": "uint256", + "name": "principal", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "utilizeIndex", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_amount", "type": "uint256" } + ], + "name": "withdrawProtocolFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/abis/StaderConfig.abi.json b/abis/StaderConfig.abi.json index b169a981a..b6d1c201d 100644 --- a/abis/StaderConfig.abi.json +++ b/abis/StaderConfig.abi.json @@ -1,1963 +1,2046 @@ [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "InvalidLimits", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidMaxDepositValue", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidMaxWithdrawValue", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidMinDepositValue", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidMinWithdrawValue", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAddress", - "type": "address" - } - ], - "name": "SetAccount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "SetConstant", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAddress", - "type": "address" - } - ], - "name": "SetContract", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAddress", - "type": "address" - } - ], - "name": "SetToken", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "SetVariable", - "type": "event" - }, - { - "inputs": [], - "name": "ADMIN", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "AUCTION_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DECIMALS", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ETHX_SUPPLY_POR_FEED", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ETH_BALANCE_POR_FEED", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ETH_DEPOSIT_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ETH_PER_NODE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ETHx", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "FULL_DEPOSIT_SIZE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MANAGER", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_DEPOSIT_AMOUNT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_WITHDRAW_AMOUNT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MIN_BLOCK_DELAY_TO_FINALIZE_WITHDRAW_REQUEST", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MIN_DEPOSIT_AMOUNT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MIN_WITHDRAW_AMOUNT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "NODE_EL_REWARD_VAULT_IMPLEMENTATION", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "OPERATOR", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "OPERATOR_MAX_NAME_LENGTH", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "OPERATOR_REWARD_COLLECTOR", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PENALTY_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PERMISSIONED_NODE_REGISTRY", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PERMISSIONED_POOL", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PERMISSIONED_SOCIALIZING_POOL", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PERMISSIONLESS_NODE_REGISTRY", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PERMISSIONLESS_POOL", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PERMISSIONLESS_SOCIALIZING_POOL", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "POOL_SELECTOR", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "POOL_UTILS", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PRE_DEPOSIT_SIZE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "REWARD_THRESHOLD", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "SD", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "SD_COLLATERAL", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "SOCIALIZING_POOL_CYCLE_DURATION", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "SOCIALIZING_POOL_OPT_IN_COOLING_PERIOD", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "STADER_INSURANCE_FUND", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "STADER_ORACLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "STADER_TREASURY", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "STAKE_POOL_MANAGER", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "TOTAL_FEE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "USER_WITHDRAW_MANAGER", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "VALIDATOR_WITHDRAWAL_VAULT_IMPLEMENTATION", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "VAULT_FACTORY", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "WITHDRAWN_KEYS_BATCH_SIZE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getAdmin", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getAuctionContract", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getDecimals", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getETHBalancePORFeedProxy", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getETHDepositContract", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getETHXSupplyPORFeedProxy", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getETHxToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getFullDepositSize", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMaxDepositAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMaxWithdrawAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMinBlockDelayToFinalizeWithdrawRequest", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMinDepositAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMinWithdrawAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getNodeELRewardVaultImplementation", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getOperatorMaxNameLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getOperatorRewardsCollector", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPenaltyContract", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPermissionedNodeRegistry", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPermissionedPool", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPermissionedSocializingPool", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPermissionlessNodeRegistry", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPermissionlessPool", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPermissionlessSocializingPool", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPoolSelector", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPoolUtils", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPreDepositSize", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getRewardsThreshold", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getSDCollateral", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getSocializingPoolCycleDuration", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getSocializingPoolOptInCoolingPeriod", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getStaderInsuranceFund", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getStaderOracle", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getStaderToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getStaderTreasury", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getStakePoolManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getStakedEthPerNode", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getTotalFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getUserWithdrawManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getValidatorWithdrawalVaultImplementation", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getVaultFactory", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getWithdrawnKeyBatchSize", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_admin", - "type": "address" - }, - { - "internalType": "address", - "name": "_ethDepositContract", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "onlyManagerRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "onlyOperatorRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_addr", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_contractName", - "type": "bytes32" - } - ], - "name": "onlyStaderContract", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_admin", - "type": "address" - } - ], - "name": "updateAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_auctionContract", - "type": "address" - } - ], - "name": "updateAuctionContract", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_ethBalanceProxy", - "type": "address" - } - ], - "name": "updateETHBalancePORFeedProxy", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_ethXSupplyProxy", - "type": "address" - } - ], - "name": "updateETHXSupplyPORFeedProxy", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_ethX", - "type": "address" - } - ], - "name": "updateETHxToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_maxDepositAmount", - "type": "uint256" - } - ], - "name": "updateMaxDepositAmount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_maxWithdrawAmount", - "type": "uint256" - } - ], - "name": "updateMaxWithdrawAmount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_minBlockDelay", - "type": "uint256" - } - ], - "name": "updateMinBlockDelayToFinalizeWithdrawRequest", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_minDepositAmount", - "type": "uint256" - } - ], - "name": "updateMinDepositAmount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_minWithdrawAmount", - "type": "uint256" - } - ], - "name": "updateMinWithdrawAmount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_nodeELRewardVaultImpl", - "type": "address" - } - ], - "name": "updateNodeELRewardImplementation", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_operatorRewardsCollector", - "type": "address" - } - ], - "name": "updateOperatorRewardsCollector", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_penaltyContract", - "type": "address" - } - ], - "name": "updatePenaltyContract", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_permissionedNodeRegistry", - "type": "address" - } - ], - "name": "updatePermissionedNodeRegistry", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_permissionedPool", - "type": "address" - } - ], - "name": "updatePermissionedPool", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_permissionedSocializePool", - "type": "address" - } - ], - "name": "updatePermissionedSocializingPool", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_permissionlessNodeRegistry", - "type": "address" - } - ], - "name": "updatePermissionlessNodeRegistry", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_permissionlessPool", - "type": "address" - } - ], - "name": "updatePermissionlessPool", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_permissionlessSocializePool", - "type": "address" - } - ], - "name": "updatePermissionlessSocializingPool", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_poolSelector", - "type": "address" - } - ], - "name": "updatePoolSelector", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_poolUtils", - "type": "address" - } - ], - "name": "updatePoolUtils", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_rewardsThreshold", - "type": "uint256" - } - ], - "name": "updateRewardsThreshold", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_sdCollateral", - "type": "address" - } - ], - "name": "updateSDCollateral", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_socializingPoolCycleDuration", - "type": "uint256" - } - ], - "name": "updateSocializingPoolCycleDuration", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_SocializePoolOptInCoolingPeriod", - "type": "uint256" - } - ], - "name": "updateSocializingPoolOptInCoolingPeriod", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_staderInsuranceFund", - "type": "address" - } - ], - "name": "updateStaderInsuranceFund", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_staderOracle", - "type": "address" - } - ], - "name": "updateStaderOracle", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_staderToken", - "type": "address" - } - ], - "name": "updateStaderToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_staderTreasury", - "type": "address" - } - ], - "name": "updateStaderTreasury", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakePoolManager", - "type": "address" - } - ], - "name": "updateStakePoolManager", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_userWithdrawManager", - "type": "address" - } - ], - "name": "updateUserWithdrawManager", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_validatorWithdrawalVaultImpl", - "type": "address" - } - ], - "name": "updateValidatorWithdrawalVaultImplementation", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vaultFactory", - "type": "address" - } - ], - "name": "updateVaultFactory", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_withdrawnKeysBatchSize", - "type": "uint256" - } - ], - "name": "updateWithdrawnKeysBatchSize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] \ No newline at end of file + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "IndenticalValue", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidLimits", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidMaxDepositValue", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidMaxWithdrawValue", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidMinDepositValue", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidMinWithdrawValue", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAddress", + "type": "address" + } + ], + "name": "SetAccount", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "SetConstant", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAddress", + "type": "address" + } + ], + "name": "SetContract", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAddress", + "type": "address" + } + ], + "name": "SetToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "SetVariable", + "type": "event" + }, + { + "inputs": [], + "name": "ADMIN", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "AUCTION_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DECIMALS", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ETHX_SUPPLY_POR_FEED", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ETH_BALANCE_POR_FEED", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ETH_DEPOSIT_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ETH_PER_NODE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ETHx", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "FULL_DEPOSIT_SIZE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MANAGER", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_DEPOSIT_AMOUNT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_WITHDRAW_AMOUNT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MIN_BLOCK_DELAY_TO_FINALIZE_WITHDRAW_REQUEST", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MIN_DEPOSIT_AMOUNT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MIN_WITHDRAW_AMOUNT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "NODE_EL_REWARD_VAULT_IMPLEMENTATION", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "OPERATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "OPERATOR_MAX_NAME_LENGTH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "OPERATOR_REWARD_COLLECTOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PENALTY_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PERMISSIONED_NODE_REGISTRY", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PERMISSIONED_POOL", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PERMISSIONED_SOCIALIZING_POOL", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PERMISSIONLESS_NODE_REGISTRY", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PERMISSIONLESS_POOL", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PERMISSIONLESS_SOCIALIZING_POOL", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "POOL_SELECTOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "POOL_UTILS", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PRE_DEPOSIT_SIZE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "REWARD_THRESHOLD", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SD", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SD_COLLATERAL", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SD_INCENTIVE_CONTROLLER", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SD_UTILITY_POOL", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SOCIALIZING_POOL_CYCLE_DURATION", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SOCIALIZING_POOL_OPT_IN_COOLING_PERIOD", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STADER_INSURANCE_FUND", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STADER_ORACLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STADER_TREASURY", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKE_POOL_MANAGER", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TOTAL_FEE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "USER_WITHDRAW_MANAGER", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "VALIDATOR_WITHDRAWAL_VAULT_IMPLEMENTATION", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "VAULT_FACTORY", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WITHDRAWN_KEYS_BATCH_SIZE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAdmin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAuctionContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDecimals", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getETHBalancePORFeedProxy", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getETHDepositContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getETHXSupplyPORFeedProxy", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getETHxToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getFullDepositSize", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMaxDepositAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMaxWithdrawAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMinBlockDelayToFinalizeWithdrawRequest", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMinDepositAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMinWithdrawAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNodeELRewardVaultImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getOperatorMaxNameLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getOperatorRewardsCollector", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPenaltyContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPermissionedNodeRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPermissionedPool", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPermissionedSocializingPool", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPermissionlessNodeRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPermissionlessPool", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPermissionlessSocializingPool", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPoolSelector", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPoolUtils", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPreDepositSize", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRewardsThreshold", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getSDCollateral", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getSDIncentiveController", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getSDUtilityPool", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getSocializingPoolCycleDuration", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getSocializingPoolOptInCoolingPeriod", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStaderInsuranceFund", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStaderOracle", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStaderToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStaderTreasury", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStakePoolManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStakedEthPerNode", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getUserWithdrawManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorWithdrawalVaultImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getVaultFactory", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getWithdrawnKeyBatchSize", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_admin", + "type": "address" + }, + { + "internalType": "address", + "name": "_ethDepositContract", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "onlyManagerRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "onlyOperatorRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_addr", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "_contractName", + "type": "bytes32" + } + ], + "name": "onlyStaderContract", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_admin", + "type": "address" + } + ], + "name": "updateAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_auctionContract", + "type": "address" + } + ], + "name": "updateAuctionContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_ethBalanceProxy", + "type": "address" + } + ], + "name": "updateETHBalancePORFeedProxy", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_ethXSupplyProxy", + "type": "address" + } + ], + "name": "updateETHXSupplyPORFeedProxy", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_ethX", + "type": "address" + } + ], + "name": "updateETHxToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_maxDepositAmount", + "type": "uint256" + } + ], + "name": "updateMaxDepositAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_maxWithdrawAmount", + "type": "uint256" + } + ], + "name": "updateMaxWithdrawAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_minBlockDelay", + "type": "uint256" + } + ], + "name": "updateMinBlockDelayToFinalizeWithdrawRequest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_minDepositAmount", + "type": "uint256" + } + ], + "name": "updateMinDepositAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_minWithdrawAmount", + "type": "uint256" + } + ], + "name": "updateMinWithdrawAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_nodeELRewardVaultImpl", + "type": "address" + } + ], + "name": "updateNodeELRewardImplementation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operatorRewardsCollector", + "type": "address" + } + ], + "name": "updateOperatorRewardsCollector", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_penaltyContract", + "type": "address" + } + ], + "name": "updatePenaltyContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_permissionedNodeRegistry", + "type": "address" + } + ], + "name": "updatePermissionedNodeRegistry", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_permissionedPool", + "type": "address" + } + ], + "name": "updatePermissionedPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_permissionedSocializePool", + "type": "address" + } + ], + "name": "updatePermissionedSocializingPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_permissionlessNodeRegistry", + "type": "address" + } + ], + "name": "updatePermissionlessNodeRegistry", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_permissionlessPool", + "type": "address" + } + ], + "name": "updatePermissionlessPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_permissionlessSocializePool", + "type": "address" + } + ], + "name": "updatePermissionlessSocializingPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_poolSelector", + "type": "address" + } + ], + "name": "updatePoolSelector", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_poolUtils", + "type": "address" + } + ], + "name": "updatePoolUtils", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_rewardsThreshold", + "type": "uint256" + } + ], + "name": "updateRewardsThreshold", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_sdCollateral", + "type": "address" + } + ], + "name": "updateSDCollateral", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_sdIncentiveController", + "type": "address" + } + ], + "name": "updateSDIncentiveController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_utilityPool", + "type": "address" + } + ], + "name": "updateSDUtilityPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_socializingPoolCycleDuration", + "type": "uint256" + } + ], + "name": "updateSocializingPoolCycleDuration", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_SocializePoolOptInCoolingPeriod", + "type": "uint256" + } + ], + "name": "updateSocializingPoolOptInCoolingPeriod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staderInsuranceFund", + "type": "address" + } + ], + "name": "updateStaderInsuranceFund", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staderOracle", + "type": "address" + } + ], + "name": "updateStaderOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staderToken", + "type": "address" + } + ], + "name": "updateStaderToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staderTreasury", + "type": "address" + } + ], + "name": "updateStaderTreasury", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakePoolManager", + "type": "address" + } + ], + "name": "updateStakePoolManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_userWithdrawManager", + "type": "address" + } + ], + "name": "updateUserWithdrawManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_validatorWithdrawalVaultImpl", + "type": "address" + } + ], + "name": "updateValidatorWithdrawalVaultImplementation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_vaultFactory", + "type": "address" + } + ], + "name": "updateVaultFactory", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_withdrawnKeysBatchSize", + "type": "uint256" + } + ], + "name": "updateWithdrawnKeysBatchSize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] From 7504ce10529d37a500196e30397b5f5a442c8c10 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 5 Dec 2023 16:51:00 +0700 Subject: [PATCH 024/159] Update validator keys --- stader/api/node/sd-status.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stader/api/node/sd-status.go b/stader/api/node/sd-status.go index 1cc6b78ee..35fbe96fc 100644 --- a/stader/api/node/sd-status.go +++ b/stader/api/node/sd-status.go @@ -60,7 +60,9 @@ func getSDStatus(c *cli.Context, numValidators *big.Int) (*api.GetSdStatusRespon return nil, err } - sdStatus, err := validator.GetSDStatus(sdc, sdu, sdt, nodeAccount.Address, big.NewInt(int64(totalValidatorNonTerminalKeys))) + numValidators = numValidators.Add(numValidators, big.NewInt(int64(totalValidatorNonTerminalKeys))) + + sdStatus, err := validator.GetSDStatus(sdc, sdu, sdt, nodeAccount.Address, numValidators) if err != nil { return nil, err } From eb119558dc6c25b53e7a5ae53879b8e9dcb4acf4 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 5 Dec 2023 16:58:59 +0700 Subject: [PATCH 025/159] Handle error in pool not had enough SD --- stader-cli/node/utilize-sd.go | 21 +++++++++++++-------- stader-cli/validator/deposit.go | 5 ++++- stader/api/node/commands.go | 1 + 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index dd7a112c4..e0b2a818c 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -1,6 +1,7 @@ package node import ( + "errors" "fmt" "math/big" "strconv" @@ -38,7 +39,10 @@ func utilizeSD(c *cli.Context) error { return err } - amountWei := PromptChooseUtilityAmount(sdStatusResponse.SDStatus) + amountWei, err := PromptChooseUtilityAmount(sdStatusResponse.SDStatus) + if err != nil { + return err + } canNodeUtilizeSdResponse, err := staderClient.CanNodeUtilizeSd(amountWei) if err != nil { @@ -91,21 +95,22 @@ func GetMaxUtility(sdStatus *api.SdStatusResponse) *big.Int { return maxUtility } -func PromptChooseUtilityAmount(sdStatus *api.SdStatusResponse) *big.Int { +func PromptChooseUtilityAmount(sdStatus *api.SdStatusResponse) (*big.Int, error) { minUtility := GetMinUtility(sdStatus) maxUtility := GetMaxUtility(sdStatus) // 1. If the pool had enough SD if minUtility.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { - cliutils.PrintError( - fmt.Sprintf("Pool available SD: %s not enough to min utility : %s \n", sdStatus.PoolAvailableSDBalance.String(), minUtility.String())) - return nil + msg := fmt.Sprintf("Pool available SD: %f not enough to min utility : %f \n", eth.WeiToEth(sdStatus.PoolAvailableSDBalance), eth.WeiToEth(minUtility)) + + return nil, errors.New(msg) } // 2. If user had enough Eth if minUtility.Cmp(maxUtility) > 0 { - cliutils.PrintError(fmt.Sprintf("Do not had enough ETH bond to utility : %s \n", minUtility.String())) - return nil + msg := fmt.Sprintf("Do not had enough ETH bond to utility : %s \n", minUtility.String()) + + return nil, errors.New(msg) } // Set max to pool available @@ -144,5 +149,5 @@ func PromptChooseUtilityAmount(sdStatus *api.SdStatusResponse) *big.Int { utilityAmount := eth.EthToWei(float64(_utilityAmount)) - return utilityAmount + return utilityAmount, nil } diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index d810d7d04..8ab88bf48 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -104,7 +104,10 @@ func nodeDeposit(c *cli.Context) error { return nodeDeposit(c) case 1: - utilityAmount = node.PromptChooseUtilityAmount(sdStatus) + utilityAmount, err = node.PromptChooseUtilityAmount(sdStatus) + if err != nil { + return err + } if !cliutils.Confirm(fmt.Sprintf("You're about to utility %f SD: ", eth.WeiToEth(utilityAmount))) { fmt.Printf("Cancel \n") diff --git a/stader/api/node/commands.go b/stader/api/node/commands.go index b4bd58a8a..56b392997 100644 --- a/stader/api/node/commands.go +++ b/stader/api/node/commands.go @@ -138,6 +138,7 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { { Name: "can-node-deposit-sd", + Aliases: []string{"cds"}, Usage: "Check whether the node can stake SD", UsageText: "stader-cli api node can-node-deposit-sd amount", Action: func(c *cli.Context) error { From 90e0865887e2a47e3eb14f0867ddc9880a24eebd Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 5 Dec 2023 17:30:49 +0700 Subject: [PATCH 026/159] Refactor --- shared/types/api/node.go | 34 ++++++++++++++----------------- stader-cli/node/claim-rewards.go | 9 ++++++-- stader-cli/node/repay-exess-sd.go | 7 ++++++- stader-cli/node/repay-sd.go | 15 ++++++++++---- stader-cli/node/withdraw-sd.go | 7 ++++++- stader/api/node/claim-rewards.go | 7 ------- stader/api/node/repay-sd.go | 7 ------- stader/api/node/withdraw-sd.go | 8 +------- 8 files changed, 46 insertions(+), 48 deletions(-) diff --git a/shared/types/api/node.go b/shared/types/api/node.go index 87ab6a3fd..9afa9a511 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -265,12 +265,11 @@ type SendElRewardsResponse struct { } type CanWithdrawSdResponse struct { - Status string `json:"status"` - Error string `json:"error"` - InsufficientSdCollateral bool `json:"insufficientSdCollateral"` - InsufficientWithdrawableSd bool `json:"insufficientWithdrawableSd"` - SdStatusResponse *SdStatusResponse `json:"sdStatusResponse"` - GasInfo stader.GasInfo `json:"gasInfo"` + Status string `json:"status"` + Error string `json:"error"` + InsufficientSdCollateral bool `json:"insufficientSdCollateral"` + InsufficientWithdrawableSd bool `json:"insufficientWithdrawableSd"` + GasInfo stader.GasInfo `json:"gasInfo"` } type WithdrawSdResponse struct { @@ -394,11 +393,10 @@ type NodeSignResponse struct { } type CanClaimRewards struct { - Status string `json:"status"` - Error string `json:"error"` - NoRewards bool `json:"noRewards"` - SdStatusResponse *SdStatusResponse `json:"sdStatusResponse"` - GasInfo stader.GasInfo `json:"gasInfo"` + Status string `json:"status"` + Error string `json:"error"` + NoRewards bool `json:"noRewards"` + GasInfo stader.GasInfo `json:"gasInfo"` } type ClaimRewards struct { @@ -416,10 +414,9 @@ type NodeRepaySDResponse struct { } type CanRepaySDResponse struct { - SdStatusResponse *SdStatusResponse `json:"sdStatusResponse"` - Status string `json:"status"` - Error string `json:"error"` - GasInfo stader.GasInfo `json:"gasInfo"` + Status string `json:"status"` + Error string `json:"error"` + GasInfo stader.GasInfo `json:"gasInfo"` } type NodeUtilitySDResponse struct { @@ -458,8 +455,7 @@ type NodeRepayExcessSDResponse struct { } type CanRepayExcessSDResponse struct { - SdStatusResponse *SdStatusResponse `json:"sdStatusResponse"` - Status string `json:"status"` - Error string `json:"error"` - GasInfo stader.GasInfo `json:"gasInfo"` + Status string `json:"status"` + Error string `json:"error"` + GasInfo stader.GasInfo `json:"gasInfo"` } diff --git a/stader-cli/node/claim-rewards.go b/stader-cli/node/claim-rewards.go index 8a2991152..7aee4880c 100644 --- a/stader-cli/node/claim-rewards.go +++ b/stader-cli/node/claim-rewards.go @@ -38,12 +38,17 @@ func ClaimRewards(c *cli.Context) error { return nil } + sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0)) + if err != nil { + return err + } + // TODO: // 1. How much SD fee need to repay // 2. Based on the current Health Factor, you can claim upto ETH. - if canClaimRewardsResponse.SdStatusResponse.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { - cliutils.PrintError(fmt.Sprintf("You need to first pay %f and close the utilization position to get back your funds. Execute the following command to repay your utilized SD stader-cli repay-sd --amount \n", eth.WeiToEth(canClaimRewardsResponse.SdStatusResponse.SdUtilizerLatestBalance))) + if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { + cliutils.PrintError(fmt.Sprintf("You need to first pay %f and close the utilization position to get back your funds. Execute the following command to repay your utilized SD stader-cli repay-sd --amount \n", eth.WeiToEth(sdStatusResponse.SDStatus.SdUtilizerLatestBalance))) return nil } diff --git a/stader-cli/node/repay-exess-sd.go b/stader-cli/node/repay-exess-sd.go index 48513edfb..60511e2eb 100644 --- a/stader-cli/node/repay-exess-sd.go +++ b/stader-cli/node/repay-exess-sd.go @@ -46,7 +46,12 @@ func repayExcessSD(c *cli.Context) error { return err } - sdStatus := canRepaySdResponse.SdStatusResponse + sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0)) + if err != nil { + return err + } + + sdStatus := sdStatusResponse.SDStatus // Do not had position if sdStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) <= 0 { diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index 762ec2e96..428347eab 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -2,6 +2,7 @@ package node import ( "fmt" + "math/big" "strconv" "github.com/urfave/cli" @@ -45,15 +46,21 @@ func repaySD(c *cli.Context) error { return err } + sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0)) + if err != nil { + return err + } + + sdStatus := sdStatusResponse.SDStatus // 1. Check if repay more than need - if amountWei.Cmp(canClaimElRewardsResponse.SdStatusResponse.SdUtilizerLatestBalance) > 0 { - cliutils.PrintError(fmt.Sprintf("Repayment amount greater than the Utilization position: %s \n", canClaimElRewardsResponse.SdStatusResponse.SdUtilizerLatestBalance.String())) + if amountWei.Cmp(sdStatus.SdUtilizerLatestBalance) > 0 { + cliutils.PrintError(fmt.Sprintf("Repayment amount greater than the Utilization position: %s \n", sdStatus.SdUtilizerLatestBalance.String())) return nil } // 2. If user had enough to repay - if amountWei.Cmp(canClaimElRewardsResponse.SdStatusResponse.SdBalance) >= 1 { - cliutils.PrintError(fmt.Sprintf("The node's SD balance is not enough SD, current SD available: %f \n", eth.WeiToEth(canClaimElRewardsResponse.SdStatusResponse.SdBalance))) + if amountWei.Cmp(sdStatus.SdBalance) >= 1 { + cliutils.PrintError(fmt.Sprintf("The node's SD balance is not enough SD, current SD available: %f \n", eth.WeiToEth(sdStatus.SdBalance))) return nil } diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index dd644d3cc..095b902ba 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -46,7 +46,12 @@ func WithdrawSd(c *cli.Context) error { return nil } - if canWithdrawSdResponse.SdStatusResponse.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { + sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0)) + if err != nil { + return err + } + + if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { cliutils.PrintWarning("You have an existing utilization position, please repay your utilized SD first by executing the following command: stader-cli repay-sd --amount ") return nil } diff --git a/stader/api/node/claim-rewards.go b/stader/api/node/claim-rewards.go index b1d9605a2..a7ba031b9 100644 --- a/stader/api/node/claim-rewards.go +++ b/stader/api/node/claim-rewards.go @@ -40,13 +40,6 @@ func CanClaimRewards(c *cli.Context) (*api.CanClaimRewards, error) { return &response, nil } - sdStatus, err := getSDStatus(c, big.NewInt(0)) - if err != nil { - return nil, err - } - - response.SdStatusResponse = sdStatus.SDStatus - opts, err := w.GetNodeAccountTransactor() if err != nil { return nil, err diff --git a/stader/api/node/repay-sd.go b/stader/api/node/repay-sd.go index 19556d62e..1ac042490 100644 --- a/stader/api/node/repay-sd.go +++ b/stader/api/node/repay-sd.go @@ -41,13 +41,6 @@ func canRepaySD(c *cli.Context, amountWei *big.Int) (*api.CanRepaySDResponse, er return nil, err } - sdStatus, err := getSDStatus(c, big.NewInt(0)) - if err != nil { - return nil, err - } - - response.SdStatusResponse = sdStatus.SDStatus - response.GasInfo = gasInfo return &response, nil diff --git a/stader/api/node/withdraw-sd.go b/stader/api/node/withdraw-sd.go index a64b6fb75..61e882926 100644 --- a/stader/api/node/withdraw-sd.go +++ b/stader/api/node/withdraw-sd.go @@ -41,18 +41,12 @@ func canWithdrawSd(c *cli.Context, amountWei *big.Int) (*api.CanWithdrawSdRespon if err != nil { return nil, err } - operatorId, err := node.GetOperatorId(pnr, nodeAccount.Address, nil) - if err != nil { - return nil, err - } - sdStatus, err := getSDStatus(c, big.NewInt(0)) + operatorId, err := node.GetOperatorId(pnr, nodeAccount.Address, nil) if err != nil { return nil, err } - response.SdStatusResponse = sdStatus.SDStatus - // get current sd collateral operatorSdCollateral, err := sd_collateral.GetOperatorSdBalance(sdc, nodeAccount.Address, nil) if err != nil { From 02e9b3a22d9be4abb51c457f09a778782a725ad1 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 5 Dec 2023 19:41:09 +0700 Subject: [PATCH 027/159] Update status --- stader-cli/node/status.go | 8 +++++++- stader/api/validator/deposit.go | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 54437f208..836623c30 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -199,7 +199,13 @@ func getNodeStatus(c *cli.Context) error { log.ColorBlue, status.AccountAddress, log.ColorReset, - math.RoundDown(eth.WeiToEth(sdStatus.SdMaxCollateralAmount), eth.Decimal)) + math.RoundDown(eth.WeiToEth(sdStatus.SdMaxUtilizableAmount), eth.Decimal)) + + fmt.Printf( + "The SD utility %s%s can provide max of %.6f SD.\n\n", + log.ColorBlue, + log.ColorReset, + math.RoundDown(eth.WeiToEth(sdStatus.PoolAvailableSDBalance), eth.Decimal)) cur := eth.WeiToEth(sdStatus.SdCollateralCurrentAmount) min := eth.WeiToEth(sdStatus.SdCollateralRequireAmount) diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index e91a9b919..ff5a685c0 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -248,7 +248,7 @@ func canNodeDeposit(c *cli.Context, amountBaseWei, amountUtilityWei, numValidato gasInfo, err := node.EstimateAddValidatorKeys( prn, - big.NewInt(0), + amountUtilityWei, pubKeys, preDepositSignatures, depositSignatures, From d32c379d76ae12a09243f4f83899dc1c2d09059e Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 5 Dec 2023 19:46:58 +0700 Subject: [PATCH 028/159] Refactor --- stader/api/validator/deposit.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index ff5a685c0..1672b038f 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -81,7 +81,7 @@ func GetSDStatus( }, nil } -func canNodeDeposit(c *cli.Context, amountBaseWei, amountUtilityWei, numValidators *big.Int, reloadKeys bool) (*api.CanNodeDepositResponse, error) { +func canNodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidators *big.Int, reloadKeys bool) (*api.CanNodeDepositResponse, error) { if err := services.RequireNodeWallet(c); err != nil { return nil, err } @@ -121,7 +121,7 @@ func canNodeDeposit(c *cli.Context, amountBaseWei, amountUtilityWei, numValidato return nil, err } - amountToSend := amountBaseWei.Mul(amountBaseWei, numValidators) + amountToSend := baseAmountWei.Mul(baseAmountWei, numValidators) opts, err := w.GetNodeAccountTransactor() if err != nil { @@ -248,7 +248,7 @@ func canNodeDeposit(c *cli.Context, amountBaseWei, amountUtilityWei, numValidato gasInfo, err := node.EstimateAddValidatorKeys( prn, - amountUtilityWei, + utilityAmountWei, pubKeys, preDepositSignatures, depositSignatures, From 98dacbee50de6f2d4bda57381db8b63bb35a2541 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 5 Dec 2023 20:13:51 +0700 Subject: [PATCH 029/159] Update percent --- stader-cli/node/status.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 836623c30..6e54d8e19 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -207,7 +207,7 @@ func getNodeStatus(c *cli.Context) error { log.ColorReset, math.RoundDown(eth.WeiToEth(sdStatus.PoolAvailableSDBalance), eth.Decimal)) - cur := eth.WeiToEth(sdStatus.SdCollateralCurrentAmount) + cur := eth.WeiToEth(new(big.Int).Add(sdStatus.SdCollateralCurrentAmount, sdStatus.SdUtilizerLatestBalance)) min := eth.WeiToEth(sdStatus.SdCollateralRequireAmount) fmt.Printf( From 0638c7a42c9dcddf1f5e189e3ea08421968535f6 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 5 Dec 2023 21:32:50 +0700 Subject: [PATCH 030/159] Approve SD for repay --- shared/services/stader/node.go | 48 +++++++++ shared/types/api/node.go | 6 ++ stader-cli/node/approve-sd.go | 76 +++++++++++++ stader-cli/node/commands.go | 24 +++++ stader-cli/node/repay-sd.go | 14 +++ stader/api/node/commands.go | 54 ++++++++++ stader/api/node/utility-sd-allowance.go | 136 ++++++++++++++++++++++++ 7 files changed, 358 insertions(+) create mode 100644 stader/api/node/utility-sd-allowance.go diff --git a/shared/services/stader/node.go b/shared/services/stader/node.go index d9a53d3ab..0465c6262 100644 --- a/shared/services/stader/node.go +++ b/shared/services/stader/node.go @@ -727,3 +727,51 @@ func (c *Client) GetSDStatus(numValidators *big.Int) (api.GetSdStatusResponse, e return response, nil } + +// Get the node's SD allowance +func (c *Client) GetSDPoolUtilitySdAllowance() (api.SDPoolUtilitySdAllowanceResponse, error) { + responseBytes, err := c.callAPI(fmt.Sprintf("node utility-sd-allowance")) + if err != nil { + return api.SDPoolUtilitySdAllowanceResponse{}, fmt.Errorf("could not get node deposit SD allowance: %w", err) + } + var response api.SDPoolUtilitySdAllowanceResponse + if err := json.Unmarshal(responseBytes, &response); err != nil { + return api.SDPoolUtilitySdAllowanceResponse{}, fmt.Errorf("could not decode node deposit SD allowance response: %w", err) + } + if response.Error != "" { + return api.SDPoolUtilitySdAllowanceResponse{}, fmt.Errorf("could not get node deposit SD allowance: %s", response.Error) + } + return response, nil +} + +// Approve SD for utility contract +func (c *Client) SDPoolUtilitySdApprove(amountWei *big.Int) (api.NodeDepositSdApproveResponse, error) { + responseBytes, err := c.callAPI(fmt.Sprintf("node utility-approve-sd %s", amountWei.String())) + if err != nil { + return api.NodeDepositSdApproveResponse{}, fmt.Errorf("could not approve SD for staking: %w", err) + } + var response api.NodeDepositSdApproveResponse + if err := json.Unmarshal(responseBytes, &response); err != nil { + return api.NodeDepositSdApproveResponse{}, fmt.Errorf("could not decode deposit node SD approve response: %w", err) + } + if response.Error != "" { + return api.NodeDepositSdApproveResponse{}, fmt.Errorf("could not approve SD for staking: %s", response.Error) + } + return response, nil +} + +// Get the gas estimate for approving new SD interaction +func (c *Client) SDPoolUtilitySdApproveGas(amountWei *big.Int) (api.NodeDepositSdApproveGasResponse, error) { + responseBytes, err := c.callAPI(fmt.Sprintf("node utility-approve-sd-gas %s", amountWei.String())) + if err != nil { + return api.NodeDepositSdApproveGasResponse{}, fmt.Errorf("could not get new SD approval gas: %w", err) + } + var response api.NodeDepositSdApproveGasResponse + if err := json.Unmarshal(responseBytes, &response); err != nil { + return api.NodeDepositSdApproveGasResponse{}, fmt.Errorf("could not decode utility SD approve gas response: %w", err) + } + if response.Error != "" { + return api.NodeDepositSdApproveGasResponse{}, fmt.Errorf("could not get utility SD approval gas: %s", response.Error) + } + return response, nil +} diff --git a/shared/types/api/node.go b/shared/types/api/node.go index 9afa9a511..7427326e0 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -91,6 +91,12 @@ type NodeDepositSdAllowanceResponse struct { Allowance *big.Int `json:"allowance"` } +type SDPoolUtilitySdAllowanceResponse struct { + Status string `json:"status"` + Error string `json:"error"` + Allowance *big.Int `json:"allowance"` +} + type CanNodeDepositResponse struct { Status string `json:"status"` Error string `json:"error"` diff --git a/stader-cli/node/approve-sd.go b/stader-cli/node/approve-sd.go index 4c9d702d7..eeb780ce6 100644 --- a/stader-cli/node/approve-sd.go +++ b/stader-cli/node/approve-sd.go @@ -98,3 +98,79 @@ func nodeApproveSdWithAmount(staderClient *stader.Client, amountWei *big.Int, au return nil } + +func nodeApproveUtilitySd(c *cli.Context) error { + staderClient, err := stader.NewClientFromCtx(c) + if err != nil { + return err + } + defer staderClient.Close() + + // Check and assign the EC status + err = cliutils.CheckClientStatus(staderClient) + if err != nil { + return err + } + + // If a custom nonce is set, print the multi-transaction warning + if c.GlobalUint64("nonce") != 0 { + cliutils.PrintMultiTransactionNonceWarning() + } + + amountInString := c.String("amount") + + amount, err := strconv.ParseFloat(amountInString, 64) + if err != nil { + return err + } + + amountWei := eth.EthToWei(amount) + + autoConfirm := c.Bool("yes") + + nonce := c.GlobalUint64("nonce") + + if nonce != 0 { + cliutils.PrintMultiTransactionNonceWarning() + } + + // Get approval gas + approvalGas, err := staderClient.SDPoolUtilitySdApproveGas(amountWei) + if err != nil { + return err + } + + // Assign max fees + err = gas.AssignMaxFeeAndLimit(approvalGas.GasInfo, staderClient, autoConfirm) + if err != nil { + return err + } + + // Prompt for confirmation + if !(autoConfirm || cliutils.Confirm("Do you want to approve SD to be spent by the Utility Contract?")) { + fmt.Println("Cancelled.") + return nil + } + + response, err := staderClient.SDPoolUtilitySdApprove(amountWei) + if err != nil { + return err + } + + hash := response.ApproveTxHash + + fmt.Println("Approving SD..") + cliutils.PrintTransactionHash(staderClient, hash) + + if _, err = staderClient.WaitForTransaction(hash); err != nil { + return err + } + + fmt.Println("Successfully approved SD.") + + // If a custom nonce is set, increment it for the next transaction + if nonce != 0 { + staderClient.IncrementCustomNonce() + } + return nil +} diff --git a/stader-cli/node/commands.go b/stader-cli/node/commands.go index 3da475ea2..376cd6fb5 100644 --- a/stader-cli/node/commands.go +++ b/stader-cli/node/commands.go @@ -428,6 +428,30 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { return repayExcessSD(c) }, }, + { + Name: "approve-utility-sd", + Aliases: []string{"aus"}, + Usage: "Approve SD for utility pool", + UsageText: "stader-cli node approve-utility-sd [options]", + Flags: []cli.Flag{ + cli.StringFlag{ + Name: "amount, a", + Usage: "The amount of SD to approve", + }, + cli.BoolFlag{ + Name: "yes, y", + Usage: "Automatically confirm SD approve", + }, + }, + Action: func(c *cli.Context) error { + if _, err := cliutils.ValidatePositiveEthAmount("sd amount", c.String("amount")); err != nil { + return err + } + + // Run + return nodeApproveUtilitySd(c) + }, + }, }, }) } diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index 428347eab..19d3e5ad1 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -41,6 +41,20 @@ func repaySD(c *cli.Context) error { amountWei := eth.EthToWei(amount) + // Check allowance + allowance, err := staderClient.GetSDPoolUtilitySdAllowance() + if err != nil { + return err + } + + if allowance.Allowance.Cmp(amountWei) < 0 { + fmt.Println("Before repay SD, you must first give the utility contract approval to interact with your SD. Amount to approve: ", eth.WeiToEth(amountWei)) + err = nodeApproveUtilitySd(c) + if err != nil { + return err + } + } + canClaimElRewardsResponse, err := staderClient.CanRepaySd(amountWei) if err != nil { return err diff --git a/stader/api/node/commands.go b/stader/api/node/commands.go index 56b392997..8ab1f9a0f 100644 --- a/stader/api/node/commands.go +++ b/stader/api/node/commands.go @@ -817,6 +817,60 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { return nil }, }, + { + Name: "utility-sd-allowance", + Usage: "Get the node's SD allowance for the utility contract", + UsageText: "stader-cli api node utility-sd-allowance", + Action: func(c *cli.Context) error { + // Validate args + if err := cliutils.ValidateArgCount(c, 0); err != nil { + return err + } + + // Run + api.PrintResponse(utilityAllowanceSd(c)) + return nil + + }, + }, + { + Name: "utility-approve-sd", + Usage: "Get the node's SD allowance for the utility contract", + UsageText: "stader-cli api node utility-approve-sd", + Action: func(c *cli.Context) error { + // Validate args + if err := cliutils.ValidateArgCount(c, 1); err != nil { + return err + } + amountWei, err := cliutils.ValidatePositiveWeiAmount("amount", c.Args().Get(0)) + if err != nil { + return err + } + + // Run + api.PrintResponse(utilityApproveSd(c, amountWei)) + return nil + }, + }, + { + Name: "utility-approve-sd-gas", + Usage: "Get the gas info of node approve SD for the utility contract", + UsageText: "stader-cli api node utility-approve-sd-gas", + Action: func(c *cli.Context) error { + // Validate args + if err := cliutils.ValidateArgCount(c, 1); err != nil { + return err + } + amountWei, err := cliutils.ValidatePositiveWeiAmount("amount", c.Args().Get(0)) + if err != nil { + return err + } + + // Run + api.PrintResponse(getUtilitySdApprovalGas(c, amountWei)) + return nil + }, + }, }, }) } diff --git a/stader/api/node/utility-sd-allowance.go b/stader/api/node/utility-sd-allowance.go new file mode 100644 index 000000000..77cb03000 --- /dev/null +++ b/stader/api/node/utility-sd-allowance.go @@ -0,0 +1,136 @@ +package node + +import ( + "fmt" + "math/big" + + "github.com/stader-labs/stader-node/stader-lib/tokens" + "github.com/urfave/cli" + + "github.com/stader-labs/stader-node/shared/services" + "github.com/stader-labs/stader-node/shared/types/api" + "github.com/stader-labs/stader-node/shared/utils/eth1" +) + +func utilityAllowanceSd(c *cli.Context) (*api.SDPoolUtilitySdAllowanceResponse, error) { + // Get services + if err := services.RequireNodeRegistered(c); err != nil { + return nil, err + } + + w, err := services.GetWallet(c) + if err != nil { + return nil, err + } + + sdt, err := services.GetSdTokenContract(c) + if err != nil { + return nil, err + } + + sduAddress, err := services.GetSdUtilityAddress(c) + if err != nil { + return nil, err + } + + // Response + response := api.SDPoolUtilitySdAllowanceResponse{} + + // Get node account + account, err := w.GetNodeAccount() + if err != nil { + return nil, err + } + + allowance, err := tokens.Allowance(sdt, account.Address, sduAddress, nil) + if err != nil { + return nil, err + } + + response.Allowance = allowance + + return &response, nil +} + +func utilityApproveSd(c *cli.Context, amountWei *big.Int) (*api.NodeDepositSdApproveResponse, error) { + // Get services + if err := services.RequireNodeRegistered(c); err != nil { + return nil, err + } + + w, err := services.GetWallet(c) + if err != nil { + return nil, err + } + + sdt, err := services.GetSdTokenContract(c) + if err != nil { + return nil, err + } + + sduAddress, err := services.GetSdUtilityAddress(c) + if err != nil { + return nil, err + } + // Response + response := api.NodeDepositSdApproveResponse{} + + opts, err := w.GetNodeAccountTransactor() + if err != nil { + return nil, err + } + + err = eth1.CheckForNonceOverride(c, opts) + if err != nil { + return nil, fmt.Errorf("Error checking for nonce override: %w", err) + } + + hash, err := tokens.Approve(sdt, sduAddress, amountWei, opts) + if err != nil { + return nil, err + } + + response.ApproveTxHash = hash + + // Return response + return &response, nil +} + +func getUtilitySdApprovalGas(c *cli.Context, amountWei *big.Int) (*api.NodeDepositSdApproveGasResponse, error) { + // Get services + if err := services.RequireNodeWallet(c); err != nil { + return nil, err + } + + w, err := services.GetWallet(c) + if err != nil { + return nil, err + } + + sdt, err := services.GetSdTokenContract(c) + if err != nil { + return nil, err + } + + utilityAddress, err := services.GetPoolUtilsAddress(c) + if err != nil { + return nil, err + } + + // Response + response := api.NodeDepositSdApproveGasResponse{} + + // Get gas estimates + opts, err := w.GetNodeAccountTransactor() + if err != nil { + return nil, err + } + + gasInfo, err := tokens.EstimateApproveGas(sdt, utilityAddress, amountWei, opts) + if err != nil { + return nil, err + } + + response.GasInfo = gasInfo + return &response, nil +} From daf3aa427f2ec6a086026243c87fbe7fe35ddd42 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Wed, 6 Dec 2023 08:56:46 +0700 Subject: [PATCH 031/159] Update stader-cli/node/commands.go Co-authored-by: Bharath Vedartham --- stader-cli/node/commands.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stader-cli/node/commands.go b/stader-cli/node/commands.go index 376cd6fb5..b7389d068 100644 --- a/stader-cli/node/commands.go +++ b/stader-cli/node/commands.go @@ -371,7 +371,7 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { Name: "utilize-sd", Aliases: []string{"us"}, Usage: "Utilize from the Utility pool.", - UsageText: "stader-cli node utilization-sd", + UsageText: "stader-cli node utilize-sd", Flags: []cli.Flag{ cli.BoolFlag{ Name: "yes, y", From 6f9824cc55f7558c9cf07f83bbc65bb7e9e3e494 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Wed, 6 Dec 2023 14:30:03 +0700 Subject: [PATCH 032/159] Add some more logs --- stader-cli/node/status.go | 11 ++++++++++- stader/api/node/sd-status.go | 8 +++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 6e54d8e19..dc93bcf22 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -178,6 +178,13 @@ func getNodeStatus(c *cli.Context) error { log.ColorReset, math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizerLatestBalance), eth.Decimal)) + fmt.Printf( + "The node %s%s%s require to had %.6f SD in collateral.\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, + math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralRequireAmount), eth.Decimal)) + fmt.Printf( "The node %s%s%s current had %.6f SD in collateral.\n\n", log.ColorBlue, @@ -194,12 +201,14 @@ func getNodeStatus(c *cli.Context) error { log.ColorReset, math.RoundDown(eth.WeiToEth(selfBond), eth.Decimal)) + maxUtilizable := new(big.Int).Sub(sdStatus.SdMaxUtilizableAmount, sdStatus.SdUtilizerLatestBalance) + fmt.Printf( "The node %s%s%s can utilize max of %.6f SD.\n\n", log.ColorBlue, status.AccountAddress, log.ColorReset, - math.RoundDown(eth.WeiToEth(sdStatus.SdMaxUtilizableAmount), eth.Decimal)) + math.RoundDown(eth.WeiToEth(maxUtilizable), eth.Decimal)) fmt.Printf( "The SD utility %s%s can provide max of %.6f SD.\n\n", diff --git a/stader/api/node/sd-status.go b/stader/api/node/sd-status.go index 35fbe96fc..c7551c228 100644 --- a/stader/api/node/sd-status.go +++ b/stader/api/node/sd-status.go @@ -60,16 +60,14 @@ func getSDStatus(c *cli.Context, numValidators *big.Int) (*api.GetSdStatusRespon return nil, err } - numValidators = numValidators.Add(numValidators, big.NewInt(int64(totalValidatorNonTerminalKeys))) + numValidatorsPostAdd := new(big.Int).Add(numValidators, big.NewInt(int64(totalValidatorNonTerminalKeys))) - sdStatus, err := validator.GetSDStatus(sdc, sdu, sdt, nodeAccount.Address, numValidators) + sdStatus, err := validator.GetSDStatus(sdc, sdu, sdt, nodeAccount.Address, numValidatorsPostAdd) if err != nil { return nil, err } - numValidators = numValidators.Add(numValidators, big.NewInt(int64(totalValidatorNonTerminalKeys))) - - hasEnoughSdCollateral, err := sd_collateral.HasEnoughSdCollateral(sdc, nodeAccount.Address, 1, numValidators, nil) + hasEnoughSdCollateral, err := sd_collateral.HasEnoughSdCollateral(sdc, nodeAccount.Address, 1, numValidatorsPostAdd, nil) if err != nil { return nil, err From 6da993b8ded80561f74bbcfc73700718510cdcee Mon Sep 17 00:00:00 2001 From: batphonghan Date: Wed, 6 Dec 2023 14:48:48 +0700 Subject: [PATCH 033/159] Update status amount --- stader-cli/node/status.go | 22 +++++++++++----------- stader/api/validator/deposit.go | 8 ++++---- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index dc93bcf22..1bc790b9f 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -185,21 +185,20 @@ func getNodeStatus(c *cli.Context) error { log.ColorReset, math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralRequireAmount), eth.Decimal)) + totalCollateral := new(big.Int).Add(sdStatus.SdCollateralCurrentAmount, sdStatus.SdUtilizerLatestBalance) fmt.Printf( "The node %s%s%s current had %.6f SD in collateral.\n\n", log.ColorBlue, status.AccountAddress, log.ColorReset, - math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralCurrentAmount), eth.Decimal)) - - selfBond := new(big.Int).Sub(sdStatus.SdCollateralCurrentAmount, sdStatus.SdUtilizerLatestBalance) + math.RoundDown(eth.WeiToEth(totalCollateral), eth.Decimal)) fmt.Printf( "The node %s%s%s current had %.6f SD in self bond.\n\n", log.ColorBlue, status.AccountAddress, log.ColorReset, - math.RoundDown(eth.WeiToEth(selfBond), eth.Decimal)) + math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralCurrentAmount), eth.Decimal)) maxUtilizable := new(big.Int).Sub(sdStatus.SdMaxUtilizableAmount, sdStatus.SdUtilizerLatestBalance) @@ -208,23 +207,24 @@ func getNodeStatus(c *cli.Context) error { log.ColorBlue, status.AccountAddress, log.ColorReset, - math.RoundDown(eth.WeiToEth(maxUtilizable), eth.Decimal)) + (eth.WeiToEth(maxUtilizable))) fmt.Printf( - "The SD utility %s%s can provide max of %.6f SD.\n\n", - log.ColorBlue, - log.ColorReset, + "The SD utility can provide max of %.6f SD.\n\n", math.RoundDown(eth.WeiToEth(sdStatus.PoolAvailableSDBalance), eth.Decimal)) - cur := eth.WeiToEth(new(big.Int).Add(sdStatus.SdCollateralCurrentAmount, sdStatus.SdUtilizerLatestBalance)) - min := eth.WeiToEth(sdStatus.SdCollateralRequireAmount) + current := eth.WeiToEth(totalCollateral) + require := eth.WeiToEth(sdStatus.SdCollateralRequireAmount) fmt.Printf( "The node %s%s%s current had %.6f%s Collateral.\n\n", log.ColorBlue, status.AccountAddress, log.ColorReset, - cur/min*100, "%") + current/require*100, "%") + // + // 7059.0032462241525 + // 2823.601298489661 return nil } diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index 1672b038f..20aaed64d 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -61,8 +61,8 @@ func GetSDStatus( sdMaxCollateralAmount := new(big.Int).Mul(minimumSDToBond, big.NewInt(MaxBondThreshold)) - maxSDToUtilize := new(big.Int).Mul(minimumSDToBond, big.NewInt(MinToUtilizeRatioNum)) - maxSDToUtilize = maxSDToUtilize.Div(maxSDToUtilize, big.NewInt(MinToUtilizeRatioDenom)) + sdMaxUtilizableAmount := new(big.Int).Mul(minimumSDToBond, big.NewInt(MinToUtilizeRatioNum)) + sdMaxUtilizableAmount = new(big.Int).Div(sdMaxUtilizableAmount, big.NewInt(MinToUtilizeRatioDenom)) hasEnoughSdCollateral, err := sd_collateral.HasEnoughSdCollateral(sdc, operatorAddress, 1, totalValidatorsPostAddition, nil) if err != nil { @@ -75,8 +75,8 @@ func GetSDStatus( SdBalance: sdBalance, SdCollateralCurrentAmount: sdCollateralCurrentAmount, SdCollateralRequireAmount: minimumSDToBond, - SdMaxUtilizableAmount: sdMaxCollateralAmount, - SdMaxCollateralAmount: maxSDToUtilize, + SdMaxUtilizableAmount: sdMaxUtilizableAmount, + SdMaxCollateralAmount: sdMaxCollateralAmount, PoolAvailableSDBalance: poolAvailableSDBalance, }, nil } From e87f16f99bf01847d632b74d6396ff90f9653871 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Wed, 6 Dec 2023 14:49:43 +0700 Subject: [PATCH 034/159] Refactor --- stader-cli/node/status.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 1bc790b9f..b20aea977 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -223,8 +223,5 @@ func getNodeStatus(c *cli.Context) error { log.ColorReset, current/require*100, "%") - // - // 7059.0032462241525 - // 2823.601298489661 return nil } From 52410110f0528629d0a30a647d9ec69d10dddf61 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Wed, 6 Dec 2023 15:13:05 +0700 Subject: [PATCH 035/159] Update excess amount --- stader-cli/node/repay-exess-sd.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stader-cli/node/repay-exess-sd.go b/stader-cli/node/repay-exess-sd.go index 60511e2eb..915e1bc7b 100644 --- a/stader-cli/node/repay-exess-sd.go +++ b/stader-cli/node/repay-exess-sd.go @@ -59,7 +59,9 @@ func repayExcessSD(c *cli.Context) error { return nil } - amountExcess := new(big.Int).Sub(sdStatus.SdCollateralCurrentAmount, sdStatus.SdMaxCollateralAmount) + totalCollateral := new(big.Int).Add(sdStatus.SdCollateralCurrentAmount, sdStatus.SdUtilizerLatestBalance) + + amountExcess := new(big.Int).Sub(totalCollateral, sdStatus.SdMaxCollateralAmount) if amountExcess.Cmp(big.NewInt(0)) <= 0 { fmt.Printf("You don't have excess SD collateral\n") From 04a8d1a4519119a75cf8446ee40e771acabb7235 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Wed, 6 Dec 2023 16:59:33 +0700 Subject: [PATCH 036/159] Add interest --- abis/SdCollateral.abi.json | 1637 +++++++++-------- shared/services/state/network-state.go | 15 +- shared/types/api/node.go | 1 + stader-cli/node/status.go | 8 + stader-cli/validator/deposit.go | 8 - stader-lib/contracts/sd-collateral.go | 826 ++++++++- stader-lib/sd-collateral/sd-deposit.go | 9 + stader/api/validator/deposit.go | 10 +- stader/guardian/collector/constants.go | 1 + .../guardian/collector/operator-collector.go | 5 + stader/guardian/collector/state-locker.go | 1 + 11 files changed, 1721 insertions(+), 800 deletions(-) diff --git a/abis/SdCollateral.abi.json b/abis/SdCollateral.abi.json index 29a7b1958..f0af7613a 100644 --- a/abis/SdCollateral.abi.json +++ b/abis/SdCollateral.abi.json @@ -1,729 +1,912 @@ [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "CallerNotManager", - "type": "error" - }, - { - "inputs": [], - "name": "CallerNotWithdrawVault", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "operatorSDCollateral", - "type": "uint256" - } - ], - "name": "InsufficientSDToWithdraw", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidPoolId", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidPoolLimit", - "type": "error" - }, - { - "inputs": [], - "name": "NoStateChange", - "type": "error" - }, - { - "inputs": [], - "name": "SDTransferFailed", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sdAmount", - "type": "uint256" - } - ], - "name": "SDDeposited", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "auction", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sdSlashed", - "type": "uint256" - } - ], - "name": "SDSlashed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sdAmount", - "type": "uint256" - } - ], - "name": "SDWithdrawn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "poolId", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "UpdatedPoolIdForOperator", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "poolId", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "minThreshold", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "withdrawThreshold", - "type": "uint256" - } - ], - "name": "UpdatedPoolThreshold", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "CallerNotManager", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotStaderContract", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotWithdrawVault", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "operatorSDCollateral", + "type": "uint256" + } + ], + "name": "InsufficientSDToWithdraw", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidPoolId", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidPoolLimit", + "type": "error" + }, + { + "inputs": [], + "name": "NoStateChange", + "type": "error" + }, + { + "inputs": [], + "name": "SDTransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdAmount", + "type": "uint256" + } + ], + "name": "ReducedUtilizedPosition", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdAmount", + "type": "uint256" + } + ], + "name": "SDDeposited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "SDRepaid", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "auction", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdSlashed", + "type": "uint256" + } + ], + "name": "SDSlashed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdSlashFromUtilized", + "type": "uint256" + } + ], + "name": "SDSlashedFromUtilize", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdAmount", + "type": "uint256" + } + ], + "name": "SDWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "poolId", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "UpdatedPoolIdForOperator", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "poolId", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "minThreshold", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "withdrawThreshold", + "type": "uint256" + } + ], + "name": "UpdatedPoolThreshold", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staderConfig", + "type": "address" + } + ], + "name": "UpdatedStaderConfig", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdAmount", + "type": "uint256" + } + ], + "name": "UtilizedSDDeposited", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_ethAmount", + "type": "uint256" + } + ], + "name": "convertETHToSD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_sdAmount", + "type": "uint256" + } + ], + "name": "convertSDToETH", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_sdAmount", + "type": "uint256" + } + ], + "name": "depositSDAsCollateral", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_sdAmount", + "type": "uint256" + } + ], + "name": "depositSDAsCollateralOnBehalf", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_sdAmount", + "type": "uint256" + } + ], + "name": "depositUtilizedSD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_poolId", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "_numValidator", + "type": "uint256" + } + ], + "name": "getMinimumSDToBond", + "outputs": [ + { + "internalType": "uint256", + "name": "_minSDToBond", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "getOperatorInfo", + "outputs": [ + { + "internalType": "uint8", + "name": "_poolId", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "_operatorId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_validatorCount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "getOperatorWithdrawThreshold", + "outputs": [ + { + "internalType": "uint256", + "name": "operatorWithdrawThreshold", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + }, + { + "internalType": "uint8", + "name": "_poolId", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "_numValidator", + "type": "uint256" + } + ], + "name": "getRemainingSDToBond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "getRewardEligibleSD", + "outputs": [ + { + "internalType": "uint256", + "name": "_rewardEligibleSD", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + }, + { + "internalType": "uint8", + "name": "_poolId", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "_numValidator", + "type": "uint256" + } + ], + "name": "hasEnoughSDCollateral", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_admin", + "type": "address" + }, + { + "internalType": "address", + "name": "_staderConfig", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "maxApproveSD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "operatorSDBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "operatorUtilizedSDBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "poolThresholdbyPoolId", + "outputs": [ + { + "internalType": "uint256", + "name": "minThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawThreshold", + "type": "uint256" + }, + { + "internalType": "string", + "name": "units", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_sdAmount", + "type": "uint256" + } + ], + "name": "reduceUtilizedSDPosition", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_validatorId", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "_poolId", + "type": "uint8" + } + ], + "name": "slashValidatorSD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], "name": "staderConfig", - "type": "address" - } - ], - "name": "UpdatedStaderConfig", - "type": "event" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_ethAmount", - "type": "uint256" - } - ], - "name": "convertETHToSD", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_sdAmount", - "type": "uint256" - } - ], - "name": "convertSDToETH", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_sdAmount", - "type": "uint256" - } - ], - "name": "depositSDAsCollateral", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_poolId", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "_numValidator", - "type": "uint256" - } - ], - "name": "getMinimumSDToBond", - "outputs": [ - { - "internalType": "uint256", - "name": "_minSDToBond", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_operator", - "type": "address" - } - ], - "name": "getOperatorWithdrawThreshold", - "outputs": [ - { - "internalType": "uint256", - "name": "operatorWithdrawThreshold", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_operator", - "type": "address" - }, - { - "internalType": "uint8", - "name": "_poolId", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "_numValidator", - "type": "uint256" - } - ], - "name": "getRemainingSDToBond", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_operator", - "type": "address" - } - ], - "name": "getRewardEligibleSD", - "outputs": [ - { - "internalType": "uint256", - "name": "_rewardEligibleSD", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_operator", - "type": "address" - }, - { - "internalType": "uint8", - "name": "_poolId", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "_numValidator", - "type": "uint256" - } - ], - "name": "hasEnoughSDCollateral", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_admin", - "type": "address" - }, - { - "internalType": "address", - "name": "_staderConfig", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "maxApproveSD", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "operatorSDBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "name": "poolThresholdbyPoolId", - "outputs": [ - { - "internalType": "uint256", - "name": "minThreshold", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxThreshold", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "withdrawThreshold", - "type": "uint256" - }, - { - "internalType": "string", - "name": "units", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_validatorId", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "_poolId", - "type": "uint8" - } - ], - "name": "slashValidatorSD", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "staderConfig", - "outputs": [ - { - "internalType": "contract IStaderConfig", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_poolId", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "_minThreshold", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_maxThreshold", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_withdrawThreshold", - "type": "uint256" - }, - { - "internalType": "string", - "name": "_units", - "type": "string" - } - ], - "name": "updatePoolThreshold", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_staderConfig", - "type": "address" - } - ], - "name": "updateStaderConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_requestedSD", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] \ No newline at end of file + "outputs": [ + { + "internalType": "contract IStaderConfig", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_poolId", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "_minThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_withdrawThreshold", + "type": "uint256" + }, + { + "internalType": "string", + "name": "_units", + "type": "string" + } + ], + "name": "updatePoolThreshold", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staderConfig", + "type": "address" + } + ], + "name": "updateStaderConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_requestedSD", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/shared/services/state/network-state.go b/shared/services/state/network-state.go index f3bb1ca6f..756874303 100644 --- a/shared/services/state/network-state.go +++ b/shared/services/state/network-state.go @@ -118,6 +118,9 @@ type MetricDetails struct { // done OperatorSDUtilized float64 + + // done + OperatorSDInterest float64 } type MetricsCache struct { @@ -463,7 +466,12 @@ func CreateMetricsCache( return nil, err } - sdUtilized, err := sdutility.GetUtilizerLatestBalance(sdu, nodeAddress, nil) + sdUtilizedLatest, err := sdutility.GetUtilizerLatestBalance(sdu, nodeAddress, nil) + if err != nil { + return nil, err + } + + sdUtilized, err := sd_collateral.GetOperatorUtilizedSDBalance(sdc, nodeAddress, nil) if err != nil { return nil, err } @@ -516,7 +524,10 @@ func CreateMetricsCache( metricsDetails.UnclaimedSocializingPoolElRewards = math.RoundDown(eth.WeiToEth(rewardClaimData.unclaimedEth), SixDecimalRound) metricsDetails.UnclaimedSocializingPoolSDRewards = math.RoundDown(eth.WeiToEth(rewardClaimData.unclaimedSd), SixDecimalRound) - metricsDetails.OperatorSDUtilized = math.RoundDown(eth.WeiToEth(sdUtilized), SixDecimalRound) + metricsDetails.OperatorSDUtilized = math.RoundDown(eth.WeiToEth(sdUtilizedLatest), SixDecimalRound) + interest := new(big.Int).Sub(sdUtilizedLatest, sdUtilized) + metricsDetails.OperatorSDInterest = math.RoundDown(eth.WeiToEth(interest), SixDecimalRound) + state.StaderNetworkDetails = metricsDetails state.logLine("Retrieved Stader Network Details (total time: %s)", time.Since(start)) diff --git a/shared/types/api/node.go b/shared/types/api/node.go index 7427326e0..0dee59275 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -445,6 +445,7 @@ type GetSdStatusResponse struct { type SdStatusResponse struct { SdUtilizerLatestBalance *big.Int `json:"sdUtilizerLatestBalance"` + SdUtilizedBalance *big.Int `json:"sdUtilizedBalance"` SdCollateralCurrentAmount *big.Int `json:"sdCollateralCurrentAmount"` SdCollateralRequireAmount *big.Int `json:"sdCollateralRequireAmount"` SdMaxUtilizableAmount *big.Int `json:"sdMaxUtilizableAmount"` diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index b20aea977..010da69c3 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -178,6 +178,14 @@ func getNodeStatus(c *cli.Context) error { log.ColorReset, math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizerLatestBalance), eth.Decimal)) + totalInterest := new(big.Int).Sub(sdStatus.SdUtilizerLatestBalance, sdStatus.SdUtilizedBalance) + fmt.Printf( + "The node %s%s%s total interest %.6f SD.\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, + math.RoundDown(eth.WeiToEth(totalInterest), eth.Decimal)) + fmt.Printf( "The node %s%s%s require to had %.6f SD in collateral.\n\n", log.ColorBlue, diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 8ab88bf48..576890b06 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -6,7 +6,6 @@ import ( "github.com/stader-labs/stader-node/shared/services/gas" "github.com/stader-labs/stader-node/shared/utils/log" - "github.com/stader-labs/stader-node/shared/utils/math" "github.com/stader-labs/stader-node/stader-cli/node" "github.com/stader-labs/stader-node/shared/services/stader" @@ -60,13 +59,6 @@ func nodeDeposit(c *cli.Context) error { return err } - fmt.Printf( - "The node %s%s%s has a balance of %.6f SD.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - math.RoundDown(eth.WeiToEth(status.AccountBalances.Sd), eth.Decimal)) - // Get node SD status sdStatusResp, err := staderClient.GetSDStatus(big.NewInt(int64(numValidators))) if err != nil { diff --git a/stader-lib/contracts/sd-collateral.go b/stader-lib/contracts/sd-collateral.go index 899a7c760..d731cb25d 100644 --- a/stader-lib/contracts/sd-collateral.go +++ b/stader-lib/contracts/sd-collateral.go @@ -31,7 +31,7 @@ var ( // SdCollateralMetaData contains all meta data concerning the SdCollateral contract. var SdCollateralMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CallerNotManager\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotWithdrawVault\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"operatorSDCollateral\",\"type\":\"uint256\"}],\"name\":\"InsufficientSDToWithdraw\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPoolId\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPoolLimit\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoStateChange\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"SDDeposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"auction\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdSlashed\",\"type\":\"uint256\"}],\"name\":\"SDSlashed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"SDWithdrawn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"poolId\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"UpdatedPoolIdForOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"poolId\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minThreshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"withdrawThreshold\",\"type\":\"uint256\"}],\"name\":\"UpdatedPoolThreshold\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_ethAmount\",\"type\":\"uint256\"}],\"name\":\"convertETHToSD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_sdAmount\",\"type\":\"uint256\"}],\"name\":\"convertSDToETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_sdAmount\",\"type\":\"uint256\"}],\"name\":\"depositSDAsCollateral\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"_poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_numValidator\",\"type\":\"uint256\"}],\"name\":\"getMinimumSDToBond\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_minSDToBond\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"}],\"name\":\"getOperatorWithdrawThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"operatorWithdrawThreshold\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"_poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_numValidator\",\"type\":\"uint256\"}],\"name\":\"getRemainingSDToBond\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"}],\"name\":\"getRewardEligibleSD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_rewardEligibleSD\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"_poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_numValidator\",\"type\":\"uint256\"}],\"name\":\"hasEnoughSDCollateral\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxApproveSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"operatorSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"name\":\"poolThresholdbyPoolId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"minThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawThreshold\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"units\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_validatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"_poolId\",\"type\":\"uint8\"}],\"name\":\"slashValidatorSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"staderConfig\",\"outputs\":[{\"internalType\":\"contractIStaderConfig\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"_poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_minThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_withdrawThreshold\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_units\",\"type\":\"string\"}],\"name\":\"updatePoolThreshold\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_requestedSD\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CallerNotManager\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotStaderContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotWithdrawVault\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"operatorSDCollateral\",\"type\":\"uint256\"}],\"name\":\"InsufficientSDToWithdraw\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPoolId\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPoolLimit\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoStateChange\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"ReducedUtilizedPosition\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"SDDeposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"SDRepaid\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"auction\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdSlashed\",\"type\":\"uint256\"}],\"name\":\"SDSlashed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdSlashFromUtilized\",\"type\":\"uint256\"}],\"name\":\"SDSlashedFromUtilize\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"SDWithdrawn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"poolId\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"UpdatedPoolIdForOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"poolId\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minThreshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"withdrawThreshold\",\"type\":\"uint256\"}],\"name\":\"UpdatedPoolThreshold\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"UtilizedSDDeposited\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_ethAmount\",\"type\":\"uint256\"}],\"name\":\"convertETHToSD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_sdAmount\",\"type\":\"uint256\"}],\"name\":\"convertSDToETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_sdAmount\",\"type\":\"uint256\"}],\"name\":\"depositSDAsCollateral\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_sdAmount\",\"type\":\"uint256\"}],\"name\":\"depositSDAsCollateralOnBehalf\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_sdAmount\",\"type\":\"uint256\"}],\"name\":\"depositUtilizedSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"_poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_numValidator\",\"type\":\"uint256\"}],\"name\":\"getMinimumSDToBond\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_minSDToBond\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"}],\"name\":\"getOperatorInfo\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"_poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_validatorCount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"}],\"name\":\"getOperatorWithdrawThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"operatorWithdrawThreshold\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"_poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_numValidator\",\"type\":\"uint256\"}],\"name\":\"getRemainingSDToBond\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"}],\"name\":\"getRewardEligibleSD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_rewardEligibleSD\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"_poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_numValidator\",\"type\":\"uint256\"}],\"name\":\"hasEnoughSDCollateral\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxApproveSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"operatorSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"operatorUtilizedSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"name\":\"poolThresholdbyPoolId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"minThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawThreshold\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"units\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_sdAmount\",\"type\":\"uint256\"}],\"name\":\"reduceUtilizedSDPosition\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_validatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"_poolId\",\"type\":\"uint8\"}],\"name\":\"slashValidatorSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"staderConfig\",\"outputs\":[{\"internalType\":\"contractIStaderConfig\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"_poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_minThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_withdrawThreshold\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_units\",\"type\":\"string\"}],\"name\":\"updatePoolThreshold\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_requestedSD\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // SdCollateralABI is the input ABI used to generate the binding from. @@ -304,6 +304,56 @@ func (_SdCollateral *SdCollateralCallerSession) GetMinimumSDToBond(_poolId uint8 return _SdCollateral.Contract.GetMinimumSDToBond(&_SdCollateral.CallOpts, _poolId, _numValidator) } +// GetOperatorInfo is a free data retrieval call binding the contract method 0x27d9ab5d. +// +// Solidity: function getOperatorInfo(address _operator) view returns(uint8 _poolId, uint256 _operatorId, uint256 _validatorCount) +func (_SdCollateral *SdCollateralCaller) GetOperatorInfo(opts *bind.CallOpts, _operator common.Address) (struct { + PoolId uint8 + OperatorId *big.Int + ValidatorCount *big.Int +}, error) { + var out []interface{} + err := _SdCollateral.contract.Call(opts, &out, "getOperatorInfo", _operator) + + outstruct := new(struct { + PoolId uint8 + OperatorId *big.Int + ValidatorCount *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.PoolId = *abi.ConvertType(out[0], new(uint8)).(*uint8) + outstruct.OperatorId = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.ValidatorCount = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + + return *outstruct, err + +} + +// GetOperatorInfo is a free data retrieval call binding the contract method 0x27d9ab5d. +// +// Solidity: function getOperatorInfo(address _operator) view returns(uint8 _poolId, uint256 _operatorId, uint256 _validatorCount) +func (_SdCollateral *SdCollateralSession) GetOperatorInfo(_operator common.Address) (struct { + PoolId uint8 + OperatorId *big.Int + ValidatorCount *big.Int +}, error) { + return _SdCollateral.Contract.GetOperatorInfo(&_SdCollateral.CallOpts, _operator) +} + +// GetOperatorInfo is a free data retrieval call binding the contract method 0x27d9ab5d. +// +// Solidity: function getOperatorInfo(address _operator) view returns(uint8 _poolId, uint256 _operatorId, uint256 _validatorCount) +func (_SdCollateral *SdCollateralCallerSession) GetOperatorInfo(_operator common.Address) (struct { + PoolId uint8 + OperatorId *big.Int + ValidatorCount *big.Int +}, error) { + return _SdCollateral.Contract.GetOperatorInfo(&_SdCollateral.CallOpts, _operator) +} + // GetOperatorWithdrawThreshold is a free data retrieval call binding the contract method 0x9871a30a. // // Solidity: function getOperatorWithdrawThreshold(address _operator) view returns(uint256 operatorWithdrawThreshold) @@ -521,6 +571,37 @@ func (_SdCollateral *SdCollateralCallerSession) OperatorSDBalance(arg0 common.Ad return _SdCollateral.Contract.OperatorSDBalance(&_SdCollateral.CallOpts, arg0) } +// OperatorUtilizedSDBalance is a free data retrieval call binding the contract method 0xb11a3a9b. +// +// Solidity: function operatorUtilizedSDBalance(address ) view returns(uint256) +func (_SdCollateral *SdCollateralCaller) OperatorUtilizedSDBalance(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) { + var out []interface{} + err := _SdCollateral.contract.Call(opts, &out, "operatorUtilizedSDBalance", arg0) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// OperatorUtilizedSDBalance is a free data retrieval call binding the contract method 0xb11a3a9b. +// +// Solidity: function operatorUtilizedSDBalance(address ) view returns(uint256) +func (_SdCollateral *SdCollateralSession) OperatorUtilizedSDBalance(arg0 common.Address) (*big.Int, error) { + return _SdCollateral.Contract.OperatorUtilizedSDBalance(&_SdCollateral.CallOpts, arg0) +} + +// OperatorUtilizedSDBalance is a free data retrieval call binding the contract method 0xb11a3a9b. +// +// Solidity: function operatorUtilizedSDBalance(address ) view returns(uint256) +func (_SdCollateral *SdCollateralCallerSession) OperatorUtilizedSDBalance(arg0 common.Address) (*big.Int, error) { + return _SdCollateral.Contract.OperatorUtilizedSDBalance(&_SdCollateral.CallOpts, arg0) +} + // PoolThresholdbyPoolId is a free data retrieval call binding the contract method 0x8a9b3738. // // Solidity: function poolThresholdbyPoolId(uint8 ) view returns(uint256 minThreshold, uint256 maxThreshold, uint256 withdrawThreshold, string units) @@ -659,6 +740,48 @@ func (_SdCollateral *SdCollateralTransactorSession) DepositSDAsCollateral(_sdAmo return _SdCollateral.Contract.DepositSDAsCollateral(&_SdCollateral.TransactOpts, _sdAmount) } +// DepositSDAsCollateralOnBehalf is a paid mutator transaction binding the contract method 0xc35d0016. +// +// Solidity: function depositSDAsCollateralOnBehalf(address _operator, uint256 _sdAmount) returns() +func (_SdCollateral *SdCollateralTransactor) DepositSDAsCollateralOnBehalf(opts *bind.TransactOpts, _operator common.Address, _sdAmount *big.Int) (*types.Transaction, error) { + return _SdCollateral.contract.Transact(opts, "depositSDAsCollateralOnBehalf", _operator, _sdAmount) +} + +// DepositSDAsCollateralOnBehalf is a paid mutator transaction binding the contract method 0xc35d0016. +// +// Solidity: function depositSDAsCollateralOnBehalf(address _operator, uint256 _sdAmount) returns() +func (_SdCollateral *SdCollateralSession) DepositSDAsCollateralOnBehalf(_operator common.Address, _sdAmount *big.Int) (*types.Transaction, error) { + return _SdCollateral.Contract.DepositSDAsCollateralOnBehalf(&_SdCollateral.TransactOpts, _operator, _sdAmount) +} + +// DepositSDAsCollateralOnBehalf is a paid mutator transaction binding the contract method 0xc35d0016. +// +// Solidity: function depositSDAsCollateralOnBehalf(address _operator, uint256 _sdAmount) returns() +func (_SdCollateral *SdCollateralTransactorSession) DepositSDAsCollateralOnBehalf(_operator common.Address, _sdAmount *big.Int) (*types.Transaction, error) { + return _SdCollateral.Contract.DepositSDAsCollateralOnBehalf(&_SdCollateral.TransactOpts, _operator, _sdAmount) +} + +// DepositUtilizedSD is a paid mutator transaction binding the contract method 0xd52eb99e. +// +// Solidity: function depositUtilizedSD(address _operator, uint256 _sdAmount) returns() +func (_SdCollateral *SdCollateralTransactor) DepositUtilizedSD(opts *bind.TransactOpts, _operator common.Address, _sdAmount *big.Int) (*types.Transaction, error) { + return _SdCollateral.contract.Transact(opts, "depositUtilizedSD", _operator, _sdAmount) +} + +// DepositUtilizedSD is a paid mutator transaction binding the contract method 0xd52eb99e. +// +// Solidity: function depositUtilizedSD(address _operator, uint256 _sdAmount) returns() +func (_SdCollateral *SdCollateralSession) DepositUtilizedSD(_operator common.Address, _sdAmount *big.Int) (*types.Transaction, error) { + return _SdCollateral.Contract.DepositUtilizedSD(&_SdCollateral.TransactOpts, _operator, _sdAmount) +} + +// DepositUtilizedSD is a paid mutator transaction binding the contract method 0xd52eb99e. +// +// Solidity: function depositUtilizedSD(address _operator, uint256 _sdAmount) returns() +func (_SdCollateral *SdCollateralTransactorSession) DepositUtilizedSD(_operator common.Address, _sdAmount *big.Int) (*types.Transaction, error) { + return _SdCollateral.Contract.DepositUtilizedSD(&_SdCollateral.TransactOpts, _operator, _sdAmount) +} + // GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. // // Solidity: function grantRole(bytes32 role, address account) returns() @@ -722,6 +845,27 @@ func (_SdCollateral *SdCollateralTransactorSession) MaxApproveSD() (*types.Trans return _SdCollateral.Contract.MaxApproveSD(&_SdCollateral.TransactOpts) } +// ReduceUtilizedSDPosition is a paid mutator transaction binding the contract method 0x956b95e7. +// +// Solidity: function reduceUtilizedSDPosition(address _operator, uint256 _sdAmount) returns() +func (_SdCollateral *SdCollateralTransactor) ReduceUtilizedSDPosition(opts *bind.TransactOpts, _operator common.Address, _sdAmount *big.Int) (*types.Transaction, error) { + return _SdCollateral.contract.Transact(opts, "reduceUtilizedSDPosition", _operator, _sdAmount) +} + +// ReduceUtilizedSDPosition is a paid mutator transaction binding the contract method 0x956b95e7. +// +// Solidity: function reduceUtilizedSDPosition(address _operator, uint256 _sdAmount) returns() +func (_SdCollateral *SdCollateralSession) ReduceUtilizedSDPosition(_operator common.Address, _sdAmount *big.Int) (*types.Transaction, error) { + return _SdCollateral.Contract.ReduceUtilizedSDPosition(&_SdCollateral.TransactOpts, _operator, _sdAmount) +} + +// ReduceUtilizedSDPosition is a paid mutator transaction binding the contract method 0x956b95e7. +// +// Solidity: function reduceUtilizedSDPosition(address _operator, uint256 _sdAmount) returns() +func (_SdCollateral *SdCollateralTransactorSession) ReduceUtilizedSDPosition(_operator common.Address, _sdAmount *big.Int) (*types.Transaction, error) { + return _SdCollateral.Contract.ReduceUtilizedSDPosition(&_SdCollateral.TransactOpts, _operator, _sdAmount) +} + // RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. // // Solidity: function renounceRole(bytes32 role, address account) returns() @@ -982,6 +1126,151 @@ func (_SdCollateral *SdCollateralFilterer) ParseInitialized(log types.Log) (*SdC return event, nil } +// SdCollateralReducedUtilizedPositionIterator is returned from FilterReducedUtilizedPosition and is used to iterate over the raw logs and unpacked data for ReducedUtilizedPosition events raised by the SdCollateral contract. +type SdCollateralReducedUtilizedPositionIterator struct { + Event *SdCollateralReducedUtilizedPosition // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SdCollateralReducedUtilizedPositionIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SdCollateralReducedUtilizedPosition) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SdCollateralReducedUtilizedPosition) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SdCollateralReducedUtilizedPositionIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SdCollateralReducedUtilizedPositionIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SdCollateralReducedUtilizedPosition represents a ReducedUtilizedPosition event raised by the SdCollateral contract. +type SdCollateralReducedUtilizedPosition struct { + Operator common.Address + SdAmount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterReducedUtilizedPosition is a free log retrieval operation binding the contract event 0x3819b1ebb313cb71368635e9c11bf524c47e692fbb7e68d46885341aa0d9fdeb. +// +// Solidity: event ReducedUtilizedPosition(address indexed operator, uint256 sdAmount) +func (_SdCollateral *SdCollateralFilterer) FilterReducedUtilizedPosition(opts *bind.FilterOpts, operator []common.Address) (*SdCollateralReducedUtilizedPositionIterator, error) { + + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _SdCollateral.contract.FilterLogs(opts, "ReducedUtilizedPosition", operatorRule) + if err != nil { + return nil, err + } + return &SdCollateralReducedUtilizedPositionIterator{contract: _SdCollateral.contract, event: "ReducedUtilizedPosition", logs: logs, sub: sub}, nil +} + +// WatchReducedUtilizedPosition is a free log subscription operation binding the contract event 0x3819b1ebb313cb71368635e9c11bf524c47e692fbb7e68d46885341aa0d9fdeb. +// +// Solidity: event ReducedUtilizedPosition(address indexed operator, uint256 sdAmount) +func (_SdCollateral *SdCollateralFilterer) WatchReducedUtilizedPosition(opts *bind.WatchOpts, sink chan<- *SdCollateralReducedUtilizedPosition, operator []common.Address) (event.Subscription, error) { + + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _SdCollateral.contract.WatchLogs(opts, "ReducedUtilizedPosition", operatorRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SdCollateralReducedUtilizedPosition) + if err := _SdCollateral.contract.UnpackLog(event, "ReducedUtilizedPosition", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseReducedUtilizedPosition is a log parse operation binding the contract event 0x3819b1ebb313cb71368635e9c11bf524c47e692fbb7e68d46885341aa0d9fdeb. +// +// Solidity: event ReducedUtilizedPosition(address indexed operator, uint256 sdAmount) +func (_SdCollateral *SdCollateralFilterer) ParseReducedUtilizedPosition(log types.Log) (*SdCollateralReducedUtilizedPosition, error) { + event := new(SdCollateralReducedUtilizedPosition) + if err := _SdCollateral.contract.UnpackLog(event, "ReducedUtilizedPosition", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + // SdCollateralRoleAdminChangedIterator is returned from FilterRoleAdminChanged and is used to iterate over the raw logs and unpacked data for RoleAdminChanged events raised by the SdCollateral contract. type SdCollateralRoleAdminChangedIterator struct { Event *SdCollateralRoleAdminChanged // Event containing the contract specifics and raw log @@ -1613,9 +1902,9 @@ func (_SdCollateral *SdCollateralFilterer) ParseSDDeposited(log types.Log) (*SdC return event, nil } -// SdCollateralSDSlashedIterator is returned from FilterSDSlashed and is used to iterate over the raw logs and unpacked data for SDSlashed events raised by the SdCollateral contract. -type SdCollateralSDSlashedIterator struct { - Event *SdCollateralSDSlashed // Event containing the contract specifics and raw log +// SdCollateralSDRepaidIterator is returned from FilterSDRepaid and is used to iterate over the raw logs and unpacked data for SDRepaid events raised by the SdCollateral contract. +type SdCollateralSDRepaidIterator struct { + Event *SdCollateralSDRepaid // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1629,7 +1918,7 @@ type SdCollateralSDSlashedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SdCollateralSDSlashedIterator) Next() bool { +func (it *SdCollateralSDRepaidIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1638,7 +1927,7 @@ func (it *SdCollateralSDSlashedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SdCollateralSDSlashed) + it.Event = new(SdCollateralSDRepaid) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1653,7 +1942,7 @@ func (it *SdCollateralSDSlashedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SdCollateralSDSlashed) + it.Event = new(SdCollateralSDRepaid) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1669,61 +1958,42 @@ func (it *SdCollateralSDSlashedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SdCollateralSDSlashedIterator) Error() error { +func (it *SdCollateralSDRepaidIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SdCollateralSDSlashedIterator) Close() error { +func (it *SdCollateralSDRepaidIterator) Close() error { it.sub.Unsubscribe() return nil } -// SdCollateralSDSlashed represents a SDSlashed event raised by the SdCollateral contract. -type SdCollateralSDSlashed struct { - Operator common.Address - Auction common.Address - SdSlashed *big.Int - Raw types.Log // Blockchain specific contextual infos +// SdCollateralSDRepaid represents a SDRepaid event raised by the SdCollateral contract. +type SdCollateralSDRepaid struct { + Operator common.Address + RepayAmount *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterSDSlashed is a free log retrieval operation binding the contract event 0xe4a6f5b1a676a94b2af7a506093c172e23d46a5bea6f2d783d4d32c9047800f4. +// FilterSDRepaid is a free log retrieval operation binding the contract event 0x78403a1d3d348f0cc8bb6e4a35d395cb9da1458aecf5bf1f147c6df1e20749b0. // -// Solidity: event SDSlashed(address indexed operator, address indexed auction, uint256 sdSlashed) -func (_SdCollateral *SdCollateralFilterer) FilterSDSlashed(opts *bind.FilterOpts, operator []common.Address, auction []common.Address) (*SdCollateralSDSlashedIterator, error) { - - var operatorRule []interface{} - for _, operatorItem := range operator { - operatorRule = append(operatorRule, operatorItem) - } - var auctionRule []interface{} - for _, auctionItem := range auction { - auctionRule = append(auctionRule, auctionItem) - } +// Solidity: event SDRepaid(address operator, uint256 repayAmount) +func (_SdCollateral *SdCollateralFilterer) FilterSDRepaid(opts *bind.FilterOpts) (*SdCollateralSDRepaidIterator, error) { - logs, sub, err := _SdCollateral.contract.FilterLogs(opts, "SDSlashed", operatorRule, auctionRule) + logs, sub, err := _SdCollateral.contract.FilterLogs(opts, "SDRepaid") if err != nil { return nil, err } - return &SdCollateralSDSlashedIterator{contract: _SdCollateral.contract, event: "SDSlashed", logs: logs, sub: sub}, nil + return &SdCollateralSDRepaidIterator{contract: _SdCollateral.contract, event: "SDRepaid", logs: logs, sub: sub}, nil } -// WatchSDSlashed is a free log subscription operation binding the contract event 0xe4a6f5b1a676a94b2af7a506093c172e23d46a5bea6f2d783d4d32c9047800f4. +// WatchSDRepaid is a free log subscription operation binding the contract event 0x78403a1d3d348f0cc8bb6e4a35d395cb9da1458aecf5bf1f147c6df1e20749b0. // -// Solidity: event SDSlashed(address indexed operator, address indexed auction, uint256 sdSlashed) -func (_SdCollateral *SdCollateralFilterer) WatchSDSlashed(opts *bind.WatchOpts, sink chan<- *SdCollateralSDSlashed, operator []common.Address, auction []common.Address) (event.Subscription, error) { - - var operatorRule []interface{} - for _, operatorItem := range operator { - operatorRule = append(operatorRule, operatorItem) - } - var auctionRule []interface{} - for _, auctionItem := range auction { - auctionRule = append(auctionRule, auctionItem) - } +// Solidity: event SDRepaid(address operator, uint256 repayAmount) +func (_SdCollateral *SdCollateralFilterer) WatchSDRepaid(opts *bind.WatchOpts, sink chan<- *SdCollateralSDRepaid) (event.Subscription, error) { - logs, sub, err := _SdCollateral.contract.WatchLogs(opts, "SDSlashed", operatorRule, auctionRule) + logs, sub, err := _SdCollateral.contract.WatchLogs(opts, "SDRepaid") if err != nil { return nil, err } @@ -1733,8 +2003,8 @@ func (_SdCollateral *SdCollateralFilterer) WatchSDSlashed(opts *bind.WatchOpts, select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SdCollateralSDSlashed) - if err := _SdCollateral.contract.UnpackLog(event, "SDSlashed", log); err != nil { + event := new(SdCollateralSDRepaid) + if err := _SdCollateral.contract.UnpackLog(event, "SDRepaid", log); err != nil { return err } event.Raw = log @@ -1755,21 +2025,21 @@ func (_SdCollateral *SdCollateralFilterer) WatchSDSlashed(opts *bind.WatchOpts, }), nil } -// ParseSDSlashed is a log parse operation binding the contract event 0xe4a6f5b1a676a94b2af7a506093c172e23d46a5bea6f2d783d4d32c9047800f4. +// ParseSDRepaid is a log parse operation binding the contract event 0x78403a1d3d348f0cc8bb6e4a35d395cb9da1458aecf5bf1f147c6df1e20749b0. // -// Solidity: event SDSlashed(address indexed operator, address indexed auction, uint256 sdSlashed) -func (_SdCollateral *SdCollateralFilterer) ParseSDSlashed(log types.Log) (*SdCollateralSDSlashed, error) { - event := new(SdCollateralSDSlashed) - if err := _SdCollateral.contract.UnpackLog(event, "SDSlashed", log); err != nil { +// Solidity: event SDRepaid(address operator, uint256 repayAmount) +func (_SdCollateral *SdCollateralFilterer) ParseSDRepaid(log types.Log) (*SdCollateralSDRepaid, error) { + event := new(SdCollateralSDRepaid) + if err := _SdCollateral.contract.UnpackLog(event, "SDRepaid", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SdCollateralSDWithdrawnIterator is returned from FilterSDWithdrawn and is used to iterate over the raw logs and unpacked data for SDWithdrawn events raised by the SdCollateral contract. -type SdCollateralSDWithdrawnIterator struct { - Event *SdCollateralSDWithdrawn // Event containing the contract specifics and raw log +// SdCollateralSDSlashedIterator is returned from FilterSDSlashed and is used to iterate over the raw logs and unpacked data for SDSlashed events raised by the SdCollateral contract. +type SdCollateralSDSlashedIterator struct { + Event *SdCollateralSDSlashed // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1783,7 +2053,7 @@ type SdCollateralSDWithdrawnIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SdCollateralSDWithdrawnIterator) Next() bool { +func (it *SdCollateralSDSlashedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1792,7 +2062,7 @@ func (it *SdCollateralSDWithdrawnIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SdCollateralSDWithdrawn) + it.Event = new(SdCollateralSDSlashed) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1807,7 +2077,7 @@ func (it *SdCollateralSDWithdrawnIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SdCollateralSDWithdrawn) + it.Event = new(SdCollateralSDSlashed) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1823,21 +2093,310 @@ func (it *SdCollateralSDWithdrawnIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SdCollateralSDWithdrawnIterator) Error() error { +func (it *SdCollateralSDSlashedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SdCollateralSDWithdrawnIterator) Close() error { +func (it *SdCollateralSDSlashedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SdCollateralSDWithdrawn represents a SDWithdrawn event raised by the SdCollateral contract. -type SdCollateralSDWithdrawn struct { - Operator common.Address - SdAmount *big.Int +// SdCollateralSDSlashed represents a SDSlashed event raised by the SdCollateral contract. +type SdCollateralSDSlashed struct { + Operator common.Address + Auction common.Address + SdSlashed *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterSDSlashed is a free log retrieval operation binding the contract event 0xe4a6f5b1a676a94b2af7a506093c172e23d46a5bea6f2d783d4d32c9047800f4. +// +// Solidity: event SDSlashed(address indexed operator, address indexed auction, uint256 sdSlashed) +func (_SdCollateral *SdCollateralFilterer) FilterSDSlashed(opts *bind.FilterOpts, operator []common.Address, auction []common.Address) (*SdCollateralSDSlashedIterator, error) { + + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + var auctionRule []interface{} + for _, auctionItem := range auction { + auctionRule = append(auctionRule, auctionItem) + } + + logs, sub, err := _SdCollateral.contract.FilterLogs(opts, "SDSlashed", operatorRule, auctionRule) + if err != nil { + return nil, err + } + return &SdCollateralSDSlashedIterator{contract: _SdCollateral.contract, event: "SDSlashed", logs: logs, sub: sub}, nil +} + +// WatchSDSlashed is a free log subscription operation binding the contract event 0xe4a6f5b1a676a94b2af7a506093c172e23d46a5bea6f2d783d4d32c9047800f4. +// +// Solidity: event SDSlashed(address indexed operator, address indexed auction, uint256 sdSlashed) +func (_SdCollateral *SdCollateralFilterer) WatchSDSlashed(opts *bind.WatchOpts, sink chan<- *SdCollateralSDSlashed, operator []common.Address, auction []common.Address) (event.Subscription, error) { + + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + var auctionRule []interface{} + for _, auctionItem := range auction { + auctionRule = append(auctionRule, auctionItem) + } + + logs, sub, err := _SdCollateral.contract.WatchLogs(opts, "SDSlashed", operatorRule, auctionRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SdCollateralSDSlashed) + if err := _SdCollateral.contract.UnpackLog(event, "SDSlashed", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseSDSlashed is a log parse operation binding the contract event 0xe4a6f5b1a676a94b2af7a506093c172e23d46a5bea6f2d783d4d32c9047800f4. +// +// Solidity: event SDSlashed(address indexed operator, address indexed auction, uint256 sdSlashed) +func (_SdCollateral *SdCollateralFilterer) ParseSDSlashed(log types.Log) (*SdCollateralSDSlashed, error) { + event := new(SdCollateralSDSlashed) + if err := _SdCollateral.contract.UnpackLog(event, "SDSlashed", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SdCollateralSDSlashedFromUtilizeIterator is returned from FilterSDSlashedFromUtilize and is used to iterate over the raw logs and unpacked data for SDSlashedFromUtilize events raised by the SdCollateral contract. +type SdCollateralSDSlashedFromUtilizeIterator struct { + Event *SdCollateralSDSlashedFromUtilize // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SdCollateralSDSlashedFromUtilizeIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SdCollateralSDSlashedFromUtilize) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SdCollateralSDSlashedFromUtilize) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SdCollateralSDSlashedFromUtilizeIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SdCollateralSDSlashedFromUtilizeIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SdCollateralSDSlashedFromUtilize represents a SDSlashedFromUtilize event raised by the SdCollateral contract. +type SdCollateralSDSlashedFromUtilize struct { + Operator common.Address + SdSlashFromUtilized *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterSDSlashedFromUtilize is a free log retrieval operation binding the contract event 0xe0674d9d9473524ba6cf67d596e4357df10898dc3feaf4edf2a7fb9ffdb41802. +// +// Solidity: event SDSlashedFromUtilize(address operator, uint256 sdSlashFromUtilized) +func (_SdCollateral *SdCollateralFilterer) FilterSDSlashedFromUtilize(opts *bind.FilterOpts) (*SdCollateralSDSlashedFromUtilizeIterator, error) { + + logs, sub, err := _SdCollateral.contract.FilterLogs(opts, "SDSlashedFromUtilize") + if err != nil { + return nil, err + } + return &SdCollateralSDSlashedFromUtilizeIterator{contract: _SdCollateral.contract, event: "SDSlashedFromUtilize", logs: logs, sub: sub}, nil +} + +// WatchSDSlashedFromUtilize is a free log subscription operation binding the contract event 0xe0674d9d9473524ba6cf67d596e4357df10898dc3feaf4edf2a7fb9ffdb41802. +// +// Solidity: event SDSlashedFromUtilize(address operator, uint256 sdSlashFromUtilized) +func (_SdCollateral *SdCollateralFilterer) WatchSDSlashedFromUtilize(opts *bind.WatchOpts, sink chan<- *SdCollateralSDSlashedFromUtilize) (event.Subscription, error) { + + logs, sub, err := _SdCollateral.contract.WatchLogs(opts, "SDSlashedFromUtilize") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SdCollateralSDSlashedFromUtilize) + if err := _SdCollateral.contract.UnpackLog(event, "SDSlashedFromUtilize", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseSDSlashedFromUtilize is a log parse operation binding the contract event 0xe0674d9d9473524ba6cf67d596e4357df10898dc3feaf4edf2a7fb9ffdb41802. +// +// Solidity: event SDSlashedFromUtilize(address operator, uint256 sdSlashFromUtilized) +func (_SdCollateral *SdCollateralFilterer) ParseSDSlashedFromUtilize(log types.Log) (*SdCollateralSDSlashedFromUtilize, error) { + event := new(SdCollateralSDSlashedFromUtilize) + if err := _SdCollateral.contract.UnpackLog(event, "SDSlashedFromUtilize", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SdCollateralSDWithdrawnIterator is returned from FilterSDWithdrawn and is used to iterate over the raw logs and unpacked data for SDWithdrawn events raised by the SdCollateral contract. +type SdCollateralSDWithdrawnIterator struct { + Event *SdCollateralSDWithdrawn // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SdCollateralSDWithdrawnIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SdCollateralSDWithdrawn) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SdCollateralSDWithdrawn) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SdCollateralSDWithdrawnIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SdCollateralSDWithdrawnIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SdCollateralSDWithdrawn represents a SDWithdrawn event raised by the SdCollateral contract. +type SdCollateralSDWithdrawn struct { + Operator common.Address + SdAmount *big.Int Raw types.Log // Blockchain specific contextual infos } @@ -2326,3 +2885,148 @@ func (_SdCollateral *SdCollateralFilterer) ParseUpdatedStaderConfig(log types.Lo event.Raw = log return event, nil } + +// SdCollateralUtilizedSDDepositedIterator is returned from FilterUtilizedSDDeposited and is used to iterate over the raw logs and unpacked data for UtilizedSDDeposited events raised by the SdCollateral contract. +type SdCollateralUtilizedSDDepositedIterator struct { + Event *SdCollateralUtilizedSDDeposited // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SdCollateralUtilizedSDDepositedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SdCollateralUtilizedSDDeposited) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SdCollateralUtilizedSDDeposited) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SdCollateralUtilizedSDDepositedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SdCollateralUtilizedSDDepositedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SdCollateralUtilizedSDDeposited represents a UtilizedSDDeposited event raised by the SdCollateral contract. +type SdCollateralUtilizedSDDeposited struct { + Operator common.Address + SdAmount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUtilizedSDDeposited is a free log retrieval operation binding the contract event 0x48ad8145b270d3b23a3a4e232b1e7900f334a73d223ef71986cefe090631b652. +// +// Solidity: event UtilizedSDDeposited(address indexed operator, uint256 sdAmount) +func (_SdCollateral *SdCollateralFilterer) FilterUtilizedSDDeposited(opts *bind.FilterOpts, operator []common.Address) (*SdCollateralUtilizedSDDepositedIterator, error) { + + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _SdCollateral.contract.FilterLogs(opts, "UtilizedSDDeposited", operatorRule) + if err != nil { + return nil, err + } + return &SdCollateralUtilizedSDDepositedIterator{contract: _SdCollateral.contract, event: "UtilizedSDDeposited", logs: logs, sub: sub}, nil +} + +// WatchUtilizedSDDeposited is a free log subscription operation binding the contract event 0x48ad8145b270d3b23a3a4e232b1e7900f334a73d223ef71986cefe090631b652. +// +// Solidity: event UtilizedSDDeposited(address indexed operator, uint256 sdAmount) +func (_SdCollateral *SdCollateralFilterer) WatchUtilizedSDDeposited(opts *bind.WatchOpts, sink chan<- *SdCollateralUtilizedSDDeposited, operator []common.Address) (event.Subscription, error) { + + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _SdCollateral.contract.WatchLogs(opts, "UtilizedSDDeposited", operatorRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SdCollateralUtilizedSDDeposited) + if err := _SdCollateral.contract.UnpackLog(event, "UtilizedSDDeposited", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUtilizedSDDeposited is a log parse operation binding the contract event 0x48ad8145b270d3b23a3a4e232b1e7900f334a73d223ef71986cefe090631b652. +// +// Solidity: event UtilizedSDDeposited(address indexed operator, uint256 sdAmount) +func (_SdCollateral *SdCollateralFilterer) ParseUtilizedSDDeposited(log types.Log) (*SdCollateralUtilizedSDDeposited, error) { + event := new(SdCollateralUtilizedSDDeposited) + if err := _SdCollateral.contract.UnpackLog(event, "UtilizedSDDeposited", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/stader-lib/sd-collateral/sd-deposit.go b/stader-lib/sd-collateral/sd-deposit.go index 61c92323f..664317733 100644 --- a/stader-lib/sd-collateral/sd-deposit.go +++ b/stader-lib/sd-collateral/sd-deposit.go @@ -46,6 +46,15 @@ func GetOperatorSdBalance(sdc *stader.SdCollateralContractManager, operatorAddre return balance, err } +func GetOperatorUtilizedSDBalance(sdc *stader.SdCollateralContractManager, operatorAddress common.Address, opts *bind.CallOpts) (*big.Int, error) { + balance, err := sdc.SdCollateral.OperatorUtilizedSDBalance(opts, operatorAddress) + if err != nil { + return nil, err + } + + return balance, err +} + func MinimumSDToBond(sdc *stader.SdCollateralContractManager, poolID uint8, numValidators *big.Int, opts *bind.CallOpts) (*big.Int, error) { minimumSDToBond, err := sdc.SdCollateral.GetMinimumSDToBond(opts, poolID, numValidators) if err != nil { diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index 20aaed64d..da2b9aacb 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -33,7 +33,7 @@ func GetSDStatus( operatorAddress common.Address, totalValidatorsPostAddition *big.Int, ) (*api.SdStatusResponse, error) { - sdUtilityBalance, err := sdutility.GetUtilizerLatestBalance(sdu, operatorAddress, nil) + sdUtilityLatestBalance, err := sdutility.GetUtilizerLatestBalance(sdu, operatorAddress, nil) if err != nil { return nil, err } @@ -53,6 +53,11 @@ func GetSDStatus( return nil, err } + sdUtilizedBalance, err := sd_collateral.GetOperatorUtilizedSDBalance(sdc, operatorAddress, nil) + if err != nil { + return nil, err + } + // Check Sd balance sdBalance, err := sdt.Erc20Token.BalanceOf(nil, operatorAddress) if err != nil { @@ -71,12 +76,13 @@ func GetSDStatus( return &api.SdStatusResponse{ NotEnoughSdCollateral: !hasEnoughSdCollateral, - SdUtilizerLatestBalance: sdUtilityBalance, + SdUtilizerLatestBalance: sdUtilityLatestBalance, SdBalance: sdBalance, SdCollateralCurrentAmount: sdCollateralCurrentAmount, SdCollateralRequireAmount: minimumSDToBond, SdMaxUtilizableAmount: sdMaxUtilizableAmount, SdMaxCollateralAmount: sdMaxCollateralAmount, + SdUtilizedBalance: sdUtilizedBalance, PoolAvailableSDBalance: poolAvailableSDBalance, }, nil } diff --git a/stader/guardian/collector/constants.go b/stader/guardian/collector/constants.go index 2761e1362..75aa48502 100644 --- a/stader/guardian/collector/constants.go +++ b/stader/guardian/collector/constants.go @@ -30,6 +30,7 @@ const UnclaimedSocializingPoolSdRewards = "unclaimed_socializing_pool_sd_rewards const UnclaimedCLRewards = "unclaimed_cl_rewards" const NextRewardCycleTime = "next_reward_cycle_time" const SDUtilized = "sd_utilized" +const SDUtilizedInterest = "sd_utilized_interest" // Node Health => stader_node_health+ key const NodeSub = "node_health" diff --git a/stader/guardian/collector/operator-collector.go b/stader/guardian/collector/operator-collector.go index 8233e131c..2e52cb3b8 100644 --- a/stader/guardian/collector/operator-collector.go +++ b/stader/guardian/collector/operator-collector.go @@ -34,6 +34,7 @@ type OperatorCollector struct { TotalSdCollateralInEth *prometheus.Desc TotalEthColateral *prometheus.Desc TotalSDUtilized *prometheus.Desc + TotalSDUtilizedInterest *prometheus.Desc // The beacon client bc beacon.Client @@ -115,6 +116,8 @@ func NewOperatorCollector( prometheus.BuildFQName(namespace, OperatorSub, EthCollateral), "", nil, nil), TotalSDUtilized: prometheus.NewDesc( prometheus.BuildFQName(namespace, OperatorSub, SDUtilized), "", nil, nil), + TotalSDUtilizedInterest: prometheus.NewDesc( + prometheus.BuildFQName(namespace, OperatorSub, SDUtilizedInterest), "", nil, nil), bc: bc, ec: ec, nodeAddress: nodeAddress, @@ -146,6 +149,7 @@ func (collector *OperatorCollector) Describe(channel chan<- *prometheus.Desc) { channel <- collector.TotalSdCollateralInEth channel <- collector.TotalEthColateral channel <- collector.TotalSDUtilized + channel <- collector.TotalSDUtilizedInterest } // Collect the latest metric values and pass them to Prometheus @@ -174,6 +178,7 @@ func (collector *OperatorCollector) Collect(channel chan<- prometheus.Metric) { channel <- prometheus.MustNewConstMetric(collector.TotalSdCollateralInEth, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorStakedSdInEth) channel <- prometheus.MustNewConstMetric(collector.TotalEthColateral, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorEthCollateral) channel <- prometheus.MustNewConstMetric(collector.TotalSDUtilized, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorSDUtilized) + channel <- prometheus.MustNewConstMetric(collector.TotalSDUtilizedInterest, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorSDInterest) } // Log error messages diff --git a/stader/guardian/collector/state-locker.go b/stader/guardian/collector/state-locker.go index 7ca04e04b..eb6b8c8f0 100644 --- a/stader/guardian/collector/state-locker.go +++ b/stader/guardian/collector/state-locker.go @@ -59,6 +59,7 @@ func NewMetricsCacheContainer() *MetricsCacheContainer { CollateralRatio: 0, CollateralRatioInSd: 0, OperatorSDUtilized: 0, + OperatorSDInterest: 0, StaderQueuedValidators: big.NewInt(0), }, }, From 4fb223aeb0699713cf797d8902772ac55f5983d2 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Thu, 7 Dec 2023 09:04:40 +0700 Subject: [PATCH 037/159] Rename --- stader-cli/node/status.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 010da69c3..e19265596 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -178,13 +178,13 @@ func getNodeStatus(c *cli.Context) error { log.ColorReset, math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizerLatestBalance), eth.Decimal)) - totalInterest := new(big.Int).Sub(sdStatus.SdUtilizerLatestBalance, sdStatus.SdUtilizedBalance) + totalFee := new(big.Int).Sub(sdStatus.SdUtilizerLatestBalance, sdStatus.SdUtilizedBalance) fmt.Printf( - "The node %s%s%s total interest %.6f SD.\n\n", + "The node %s%s%s total fee %.6f SD.\n\n", log.ColorBlue, status.AccountAddress, log.ColorReset, - math.RoundDown(eth.WeiToEth(totalInterest), eth.Decimal)) + math.RoundDown(eth.WeiToEth(totalFee), eth.Decimal)) fmt.Printf( "The node %s%s%s require to had %.6f SD in collateral.\n\n", From 5d10895893138085f44c57564d487c21d53d54d5 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Thu, 7 Dec 2023 12:39:57 +0530 Subject: [PATCH 038/159] refactor + withdraw-sd changes --- shared/services/stader/node.go | 84 ++++----------- shared/types/api/node.go | 14 ++- stader-cli/node/approve-sd.go | 89 ++-------------- stader-cli/node/commands.go | 59 ++-------- stader-cli/node/deposit-sd.go | 9 +- stader-cli/node/repay-exess-sd.go | 95 ----------------- stader-cli/node/repay-sd.go | 9 +- stader-cli/node/withdraw-sd.go | 4 +- stader/api/node/commands.go | 127 ++++++++-------------- stader/api/node/deposit-sd.go | 31 ++---- stader/api/node/get-contracts-info.go | 4 + stader/api/node/utility-sd-allowance.go | 136 ------------------------ 12 files changed, 113 insertions(+), 548 deletions(-) delete mode 100644 stader-cli/node/repay-exess-sd.go delete mode 100644 stader/api/node/utility-sd-allowance.go diff --git a/shared/services/stader/node.go b/shared/services/stader/node.go index 0465c6262..ca866d692 100644 --- a/shared/services/stader/node.go +++ b/shared/services/stader/node.go @@ -113,33 +113,33 @@ func (c *Client) CanNodeDepositSd(amountWei *big.Int) (api.CanNodeDepositSdRespo } // Get the gas estimate for approving new SD interaction -func (c *Client) NodeDepositSdApprovalGas(amountWei *big.Int) (api.NodeDepositSdApproveGasResponse, error) { - responseBytes, err := c.callAPI(fmt.Sprintf("node get-deposit-sd-approval-gas %s", amountWei.String())) +func (c *Client) NodeSdApprovalGas(amountWei *big.Int, address common.Address) (api.SdApproveGasResponse, error) { + responseBytes, err := c.callAPI(fmt.Sprintf("node get-deposit-sd-approval-gas %s %s", amountWei.String(), address)) if err != nil { - return api.NodeDepositSdApproveGasResponse{}, fmt.Errorf("could not get new SD approval gas: %w", err) + return api.SdApproveGasResponse{}, fmt.Errorf("could not get new SD approval gas: %w", err) } - var response api.NodeDepositSdApproveGasResponse + var response api.SdApproveGasResponse if err := json.Unmarshal(responseBytes, &response); err != nil { - return api.NodeDepositSdApproveGasResponse{}, fmt.Errorf("could not decode node deposit S approve gas response: %w", err) + return api.SdApproveGasResponse{}, fmt.Errorf("could not decode node deposit S approve gas response: %w", err) } if response.Error != "" { - return api.NodeDepositSdApproveGasResponse{}, fmt.Errorf("could not get new SD approval gas: %s", response.Error) + return api.SdApproveGasResponse{}, fmt.Errorf("could not get new SD approval gas: %s", response.Error) } return response, nil } // Approve SD for depositing as collateral -func (c *Client) NodeDepositSdApprove(amountWei *big.Int) (api.NodeDepositSdApproveResponse, error) { - responseBytes, err := c.callAPI(fmt.Sprintf("node deposit-sd-approve-sd %s", amountWei.String())) +func (c *Client) NodeSdApprove(amountWei *big.Int, address common.Address) (api.SdApproveResponse, error) { + responseBytes, err := c.callAPI(fmt.Sprintf("node deposit-sd-approve-sd %s %s", amountWei.String(), address)) if err != nil { - return api.NodeDepositSdApproveResponse{}, fmt.Errorf("could not approve SD for staking: %w", err) + return api.SdApproveResponse{}, fmt.Errorf("could not approve SD for staking: %w", err) } - var response api.NodeDepositSdApproveResponse + var response api.SdApproveResponse if err := json.Unmarshal(responseBytes, &response); err != nil { - return api.NodeDepositSdApproveResponse{}, fmt.Errorf("could not decode deposit node SD approve response: %w", err) + return api.SdApproveResponse{}, fmt.Errorf("could not decode deposit node SD approve response: %w", err) } if response.Error != "" { - return api.NodeDepositSdApproveResponse{}, fmt.Errorf("could not approve SD for staking: %s", response.Error) + return api.SdApproveResponse{}, fmt.Errorf("could not approve SD for staking: %s", response.Error) } return response, nil } @@ -191,17 +191,17 @@ func (c *Client) UpdateSocializeEl(socializeEl bool) (api.UpdateSocializeElRespo } // Get the node's SD allowance -func (c *Client) GetNodeDepositSdAllowance() (api.NodeDepositSdAllowanceResponse, error) { - responseBytes, err := c.callAPI(fmt.Sprintf("node deposit-sd-allowance")) +func (c *Client) GetNodeSdAllowance(contractAddress common.Address) (api.SdAllowanceResponse, error) { + responseBytes, err := c.callAPI(fmt.Sprintf("node sd-allowance %s", contractAddress.String())) if err != nil { - return api.NodeDepositSdAllowanceResponse{}, fmt.Errorf("could not get node deposit SD allowance: %w", err) + return api.SdAllowanceResponse{}, fmt.Errorf("could not get node deposit SD allowance: %w", err) } - var response api.NodeDepositSdAllowanceResponse + var response api.SdAllowanceResponse if err := json.Unmarshal(responseBytes, &response); err != nil { - return api.NodeDepositSdAllowanceResponse{}, fmt.Errorf("could not decode node deposit SD allowance response: %w", err) + return api.SdAllowanceResponse{}, fmt.Errorf("could not decode node deposit SD allowance response: %w", err) } if response.Error != "" { - return api.NodeDepositSdAllowanceResponse{}, fmt.Errorf("could not get node deposit SD allowance: %s", response.Error) + return api.SdAllowanceResponse{}, fmt.Errorf("could not get node deposit SD allowance: %s", response.Error) } return response, nil } @@ -727,51 +727,3 @@ func (c *Client) GetSDStatus(numValidators *big.Int) (api.GetSdStatusResponse, e return response, nil } - -// Get the node's SD allowance -func (c *Client) GetSDPoolUtilitySdAllowance() (api.SDPoolUtilitySdAllowanceResponse, error) { - responseBytes, err := c.callAPI(fmt.Sprintf("node utility-sd-allowance")) - if err != nil { - return api.SDPoolUtilitySdAllowanceResponse{}, fmt.Errorf("could not get node deposit SD allowance: %w", err) - } - var response api.SDPoolUtilitySdAllowanceResponse - if err := json.Unmarshal(responseBytes, &response); err != nil { - return api.SDPoolUtilitySdAllowanceResponse{}, fmt.Errorf("could not decode node deposit SD allowance response: %w", err) - } - if response.Error != "" { - return api.SDPoolUtilitySdAllowanceResponse{}, fmt.Errorf("could not get node deposit SD allowance: %s", response.Error) - } - return response, nil -} - -// Approve SD for utility contract -func (c *Client) SDPoolUtilitySdApprove(amountWei *big.Int) (api.NodeDepositSdApproveResponse, error) { - responseBytes, err := c.callAPI(fmt.Sprintf("node utility-approve-sd %s", amountWei.String())) - if err != nil { - return api.NodeDepositSdApproveResponse{}, fmt.Errorf("could not approve SD for staking: %w", err) - } - var response api.NodeDepositSdApproveResponse - if err := json.Unmarshal(responseBytes, &response); err != nil { - return api.NodeDepositSdApproveResponse{}, fmt.Errorf("could not decode deposit node SD approve response: %w", err) - } - if response.Error != "" { - return api.NodeDepositSdApproveResponse{}, fmt.Errorf("could not approve SD for staking: %s", response.Error) - } - return response, nil -} - -// Get the gas estimate for approving new SD interaction -func (c *Client) SDPoolUtilitySdApproveGas(amountWei *big.Int) (api.NodeDepositSdApproveGasResponse, error) { - responseBytes, err := c.callAPI(fmt.Sprintf("node utility-approve-sd-gas %s", amountWei.String())) - if err != nil { - return api.NodeDepositSdApproveGasResponse{}, fmt.Errorf("could not get new SD approval gas: %w", err) - } - var response api.NodeDepositSdApproveGasResponse - if err := json.Unmarshal(responseBytes, &response); err != nil { - return api.NodeDepositSdApproveGasResponse{}, fmt.Errorf("could not decode utility SD approve gas response: %w", err) - } - if response.Error != "" { - return api.NodeDepositSdApproveGasResponse{}, fmt.Errorf("could not get utility SD approval gas: %s", response.Error) - } - return response, nil -} diff --git a/shared/types/api/node.go b/shared/types/api/node.go index 0dee59275..12fa1769a 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -70,28 +70,25 @@ type CanNodeDepositSdResponse struct { GasInfo stader.GasInfo `json:"gasInfo"` } -type NodeDepositSdApproveGasResponse struct { +type SdApproveGasResponse struct { Status string `json:"status"` Error string `json:"error"` GasInfo stader.GasInfo `json:"gasInfo"` } -type NodeDepositSdApproveResponse struct { + +type SdApproveResponse struct { Status string `json:"status"` Error string `json:"error"` ApproveTxHash common.Hash `json:"approveTxHash"` } + type NodeDepositSdResponse struct { Status string `json:"status"` Error string `json:"error"` DepositTxHash common.Hash `json:"stakeTxHash"` } -type NodeDepositSdAllowanceResponse struct { - Status string `json:"status"` - Error string `json:"error"` - Allowance *big.Int `json:"allowance"` -} -type SDPoolUtilitySdAllowanceResponse struct { +type SdAllowanceResponse struct { Status string `json:"status"` Error string `json:"error"` Allowance *big.Int `json:"allowance"` @@ -154,6 +151,7 @@ type ContractsInfoResponse struct { StaderOracle common.Address `json:"staderOracle"` PenaltyTracker common.Address `json:"penaltyTracker"` StakePoolManager common.Address `json:"stakePoolManager"` + SdUtilityContract common.Address `json:"sdUtilityContract"` } type DebugExitResponse struct { diff --git a/stader-cli/node/approve-sd.go b/stader-cli/node/approve-sd.go index eeb780ce6..616ecdf37 100644 --- a/stader-cli/node/approve-sd.go +++ b/stader-cli/node/approve-sd.go @@ -5,6 +5,7 @@ import ( "math/big" "strconv" + "github.com/ethereum/go-ethereum/common" "github.com/urfave/cli" "github.com/stader-labs/stader-node/shared/services/gas" @@ -13,7 +14,7 @@ import ( "github.com/stader-labs/stader-node/stader-lib/utils/eth" ) -func nodeApproveSd(c *cli.Context) error { +func nodeApproveSd(c *cli.Context, addressInString string) error { staderClient, err := stader.NewClientFromCtx(c) if err != nil { return err @@ -40,11 +41,13 @@ func nodeApproveSd(c *cli.Context) error { amountWei := eth.EthToWei(amount) + address := common.HexToAddress(addressInString) + autoConfirm := c.Bool("yes") nonce := c.GlobalUint64("nonce") - err = nodeApproveSdWithAmount(staderClient, amountWei, autoConfirm, nonce) + err = nodeApproveSdWithAmount(staderClient, amountWei, address, autoConfirm, nonce) if err != nil { return err } @@ -52,14 +55,14 @@ func nodeApproveSd(c *cli.Context) error { return nil } -func nodeApproveSdWithAmount(staderClient *stader.Client, amountWei *big.Int, autoConfirm bool, nonce uint64) error { +func nodeApproveSdWithAmount(staderClient *stader.Client, amountWei *big.Int, address common.Address, autoConfirm bool, nonce uint64) error { // If a custom nonce is set, print the multi-transaction warning if nonce != 0 { cliutils.PrintMultiTransactionNonceWarning() } // Get approval gas - approvalGas, err := staderClient.NodeDepositSdApprovalGas(amountWei) + approvalGas, err := staderClient.NodeSdApprovalGas(amountWei, address) if err != nil { return err } @@ -75,7 +78,7 @@ func nodeApproveSdWithAmount(staderClient *stader.Client, amountWei *big.Int, au return nil } - response, err := staderClient.NodeDepositSdApprove(amountWei) + response, err := staderClient.NodeSdApprove(amountWei, address) if err != nil { return err } @@ -98,79 +101,3 @@ func nodeApproveSdWithAmount(staderClient *stader.Client, amountWei *big.Int, au return nil } - -func nodeApproveUtilitySd(c *cli.Context) error { - staderClient, err := stader.NewClientFromCtx(c) - if err != nil { - return err - } - defer staderClient.Close() - - // Check and assign the EC status - err = cliutils.CheckClientStatus(staderClient) - if err != nil { - return err - } - - // If a custom nonce is set, print the multi-transaction warning - if c.GlobalUint64("nonce") != 0 { - cliutils.PrintMultiTransactionNonceWarning() - } - - amountInString := c.String("amount") - - amount, err := strconv.ParseFloat(amountInString, 64) - if err != nil { - return err - } - - amountWei := eth.EthToWei(amount) - - autoConfirm := c.Bool("yes") - - nonce := c.GlobalUint64("nonce") - - if nonce != 0 { - cliutils.PrintMultiTransactionNonceWarning() - } - - // Get approval gas - approvalGas, err := staderClient.SDPoolUtilitySdApproveGas(amountWei) - if err != nil { - return err - } - - // Assign max fees - err = gas.AssignMaxFeeAndLimit(approvalGas.GasInfo, staderClient, autoConfirm) - if err != nil { - return err - } - - // Prompt for confirmation - if !(autoConfirm || cliutils.Confirm("Do you want to approve SD to be spent by the Utility Contract?")) { - fmt.Println("Cancelled.") - return nil - } - - response, err := staderClient.SDPoolUtilitySdApprove(amountWei) - if err != nil { - return err - } - - hash := response.ApproveTxHash - - fmt.Println("Approving SD..") - cliutils.PrintTransactionHash(staderClient, hash) - - if _, err = staderClient.WaitForTransaction(hash); err != nil { - return err - } - - fmt.Println("Successfully approved SD.") - - // If a custom nonce is set, increment it for the next transaction - if nonce != 0 { - staderClient.IncrementCustomNonce() - } - return nil -} diff --git a/stader-cli/node/commands.go b/stader-cli/node/commands.go index b7389d068..aa26f49a3 100644 --- a/stader-cli/node/commands.go +++ b/stader-cli/node/commands.go @@ -353,6 +353,10 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { Name: "amount, a", Usage: "The amount of SD to approve", }, + cli.StringFlag{ + Name: "address, c", + Usage: "The address to which we want to approve SD", + }, cli.BoolFlag{ Name: "yes, y", Usage: "Automatically confirm SD approve", @@ -362,9 +366,14 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { if _, err := cliutils.ValidatePositiveEthAmount("sd deposit amount", c.String("amount")); err != nil { return err } + if _, err := cliutils.ValidateAddress("address", c.String("address")); err != nil { + return err + } + + address := c.String("address") // Run - return nodeApproveSd(c) + return nodeApproveSd(c, address) }, }, { @@ -404,54 +413,6 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { return repaySD(c) }, }, - { - Name: "repay-excess-sd", - Aliases: []string{"res"}, - Usage: "Repay utilized SD using the excess SD collateral", - UsageText: "stader-cli node repay-excess-sd [options]", - Flags: []cli.Flag{ - cli.StringFlag{ - Name: "amount, a", - Usage: "The amount of SD to repay excess", - }, - cli.BoolFlag{ - Name: "yes, y", - Usage: "Automatically confirm SD repay", - }, - }, - Action: func(c *cli.Context) error { - if _, err := cliutils.ValidatePositiveEthAmount("sd repay amount", c.String("amount")); err != nil { - return err - } - - // Run - return repayExcessSD(c) - }, - }, - { - Name: "approve-utility-sd", - Aliases: []string{"aus"}, - Usage: "Approve SD for utility pool", - UsageText: "stader-cli node approve-utility-sd [options]", - Flags: []cli.Flag{ - cli.StringFlag{ - Name: "amount, a", - Usage: "The amount of SD to approve", - }, - cli.BoolFlag{ - Name: "yes, y", - Usage: "Automatically confirm SD approve", - }, - }, - Action: func(c *cli.Context) error { - if _, err := cliutils.ValidatePositiveEthAmount("sd amount", c.String("amount")); err != nil { - return err - } - - // Run - return nodeApproveUtilitySd(c) - }, - }, }, }) } diff --git a/stader-cli/node/deposit-sd.go b/stader-cli/node/deposit-sd.go index 79bef72a7..c154b31ff 100644 --- a/stader-cli/node/deposit-sd.go +++ b/stader-cli/node/deposit-sd.go @@ -49,15 +49,20 @@ func nodeDepositSd(c *cli.Context) error { } func DepositSdWithAmount(staderClient *stader.Client, amountWei *big.Int, autoConfirm bool, nounce uint64) error { + contracts, err := staderClient.GetContractsInfo() + if err != nil { + return err + } + // Check allowance - allowance, err := staderClient.GetNodeDepositSdAllowance() + allowance, err := staderClient.GetNodeSdAllowance(contracts.SdCollateralContract) if err != nil { return err } if allowance.Allowance.Cmp(amountWei) < 0 { fmt.Println("Before depositing SD, you must first give the collateral contract approval to interact with your SD. Amount to approve: ", eth.WeiToEth(amountWei)) - err = nodeApproveSdWithAmount(staderClient, amountWei, autoConfirm, nounce) + err = nodeApproveSdWithAmount(staderClient, amountWei, contracts.SdCollateralContract, autoConfirm, nounce) if err != nil { return err } diff --git a/stader-cli/node/repay-exess-sd.go b/stader-cli/node/repay-exess-sd.go deleted file mode 100644 index 915e1bc7b..000000000 --- a/stader-cli/node/repay-exess-sd.go +++ /dev/null @@ -1,95 +0,0 @@ -package node - -import ( - "fmt" - "math/big" - "strconv" - - "github.com/urfave/cli" - - "github.com/stader-labs/stader-node/shared/services/gas" - "github.com/stader-labs/stader-node/shared/services/stader" - cliutils "github.com/stader-labs/stader-node/shared/utils/cli" - "github.com/stader-labs/stader-node/stader-lib/utils/eth" -) - -func repayExcessSD(c *cli.Context) error { - staderClient, err := stader.NewClientFromCtx(c) - if err != nil { - return err - } - defer staderClient.Close() - - // Check and assign the EC status - err = cliutils.CheckClientStatus(staderClient) - if err != nil { - return err - } - - // Print what network we're on - err = cliutils.PrintNetwork(staderClient) - if err != nil { - return err - } - - amountInString := c.String("amount") - - amount, err := strconv.ParseFloat(amountInString, 64) - if err != nil { - return err - } - - amountWei := eth.EthToWei(amount) - - canRepaySdResponse, err := staderClient.CanRepaySd(amountWei) - if err != nil { - return err - } - - sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0)) - if err != nil { - return err - } - - sdStatus := sdStatusResponse.SDStatus - - // Do not had position - if sdStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) <= 0 { - fmt.Printf("You don't have an existing utilization position. To withdraw excess SD to your wallet execute the following command: stader-cli node withdraw-sd --amount \n") - return nil - } - - totalCollateral := new(big.Int).Add(sdStatus.SdCollateralCurrentAmount, sdStatus.SdUtilizerLatestBalance) - - amountExcess := new(big.Int).Sub(totalCollateral, sdStatus.SdMaxCollateralAmount) - - if amountExcess.Cmp(big.NewInt(0)) <= 0 { - fmt.Printf("You don't have excess SD collateral\n") - return nil - } - - err = gas.AssignMaxFeeAndLimit(canRepaySdResponse.GasInfo, staderClient, c.Bool("yes")) - if err != nil { - return err - } - - // Prompt for confirmation - if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintln( - "Are you sure you want to repay excess SD?"))) { - fmt.Println("Cancelled.") - return nil - } - - res, err := staderClient.RepaySd(amountWei) - if err != nil { - return err - } - - cliutils.PrintTransactionHash(staderClient, res.TxHash) - - if _, err = staderClient.WaitForTransaction(res.TxHash); err != nil { - return err - } - - return nil -} diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index 19d3e5ad1..c0d38ed5c 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -41,15 +41,20 @@ func repaySD(c *cli.Context) error { amountWei := eth.EthToWei(amount) + contracts, err := staderClient.GetContractsInfo() + if err != nil { + return err + } + // Check allowance - allowance, err := staderClient.GetSDPoolUtilitySdAllowance() + allowance, err := staderClient.GetNodeSdAllowance(contracts.SdUtilityContract) if err != nil { return err } if allowance.Allowance.Cmp(amountWei) < 0 { fmt.Println("Before repay SD, you must first give the utility contract approval to interact with your SD. Amount to approve: ", eth.WeiToEth(amountWei)) - err = nodeApproveUtilitySd(c) + err = nodeApproveSd(c, contracts.SdUtilityContract.String()) if err != nil { return err } diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index 095b902ba..0cc124370 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -50,10 +50,8 @@ func WithdrawSd(c *cli.Context) error { if err != nil { return err } - if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { - cliutils.PrintWarning("You have an existing utilization position, please repay your utilized SD first by executing the following command: stader-cli repay-sd --amount ") - return nil + fmt.Printf("You currently have %f utilized SD. When you try to withdraw SD, the withdrawable SD will be paid back to the utility pool first.\n", eth.WeiToEth(sdStatusResponse.SDStatus.SdUtilizerLatestBalance)) } // Assign max fees diff --git a/stader/api/node/commands.go b/stader/api/node/commands.go index 8ab1f9a0f..0d7eddc95 100644 --- a/stader/api/node/commands.go +++ b/stader/api/node/commands.go @@ -158,28 +158,6 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { }, }, - { - Name: "deposit-sd-approve-sd", - Aliases: []string{"k1"}, - Usage: "Approve SD for staking against the node", - UsageText: "stader-cli api node deposit-sd-approve-sd amount", - Action: func(c *cli.Context) error { - - // Validate args - if err := cliutils.ValidateArgCount(c, 1); err != nil { - return err - } - amountWei, err := cliutils.ValidatePositiveWeiAmount("stake amount", c.Args().Get(0)) - if err != nil { - return err - } - - // Run - api.PrintResponse(approveSd(c, amountWei)) - return nil - - }, - }, { Name: "utilize-sd", Usage: "Utilize SD", @@ -281,39 +259,72 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { }, }, { - Name: "get-deposit-sd-approval-gas", + Name: "sd-approve-sd", + Aliases: []string{"k1"}, + Usage: "Approve SD for staking against the node", + UsageText: "stader-cli api node deposit-sd-approve-sd amount contract-address", + Action: func(c *cli.Context) error { + + // Validate args + if err := cliutils.ValidateArgCount(c, 2); err != nil { + return err + } + amountWei, err := cliutils.ValidatePositiveWeiAmount("stake amount", c.Args().Get(0)) + if err != nil { + return err + } + contractAddress, err := cliutils.ValidateAddress("contract-address", c.Args().Get(1)) + if err != nil { + return err + } + + // Run + api.PrintResponse(approveSd(c, amountWei, contractAddress)) + return nil + + }, + }, + { + Name: "get-sd-approval-gas", Usage: "Estimate the gas cost of new SD interaction approval", - UsageText: "stader-cli api node get-deposit-sd-approval-gas", + UsageText: "stader-cli api node get-deposit-sd-approval-gas contract-address", Action: func(c *cli.Context) error { // Validate args - if err := cliutils.ValidateArgCount(c, 1); err != nil { + if err := cliutils.ValidateArgCount(c, 2); err != nil { return err } amountWei, err := cliutils.ValidatePositiveWeiAmount("approve amount", c.Args().Get(0)) if err != nil { return err } - + contractAddress, err := cliutils.ValidateAddress("contract-address", c.Args().Get(1)) + if err != nil { + return err + } // Run - api.PrintResponse(getDepositSdApprovalGas(c, amountWei)) + api.PrintResponse(getDepositSdApprovalGas(c, amountWei, contractAddress)) return nil }, }, { - Name: "deposit-sd-allowance", + Name: "sd-allowance", Usage: "Get the node's SD allowance for the collateral contract", - UsageText: "stader-cli api node deposit-sd-allowance", + UsageText: "stader-cli api node deposit-sd-allowance contract-address", Action: func(c *cli.Context) error { // Validate args - if err := cliutils.ValidateArgCount(c, 0); err != nil { + if err := cliutils.ValidateArgCount(c, 1); err != nil { + return err + } + contractAddress, err := cliutils.ValidateAddress("contract-address", c.Args().Get(0)) + if err != nil { return err } // Run - api.PrintResponse(allowanceSd(c)) + api.PrintResponse(allowanceSd(c, contractAddress)) return nil }, @@ -817,60 +828,6 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { return nil }, }, - { - Name: "utility-sd-allowance", - Usage: "Get the node's SD allowance for the utility contract", - UsageText: "stader-cli api node utility-sd-allowance", - Action: func(c *cli.Context) error { - // Validate args - if err := cliutils.ValidateArgCount(c, 0); err != nil { - return err - } - - // Run - api.PrintResponse(utilityAllowanceSd(c)) - return nil - - }, - }, - { - Name: "utility-approve-sd", - Usage: "Get the node's SD allowance for the utility contract", - UsageText: "stader-cli api node utility-approve-sd", - Action: func(c *cli.Context) error { - // Validate args - if err := cliutils.ValidateArgCount(c, 1); err != nil { - return err - } - amountWei, err := cliutils.ValidatePositiveWeiAmount("amount", c.Args().Get(0)) - if err != nil { - return err - } - - // Run - api.PrintResponse(utilityApproveSd(c, amountWei)) - return nil - }, - }, - { - Name: "utility-approve-sd-gas", - Usage: "Get the gas info of node approve SD for the utility contract", - UsageText: "stader-cli api node utility-approve-sd-gas", - Action: func(c *cli.Context) error { - // Validate args - if err := cliutils.ValidateArgCount(c, 1); err != nil { - return err - } - amountWei, err := cliutils.ValidatePositiveWeiAmount("amount", c.Args().Get(0)) - if err != nil { - return err - } - - // Run - api.PrintResponse(getUtilitySdApprovalGas(c, amountWei)) - return nil - }, - }, }, }) } diff --git a/stader/api/node/deposit-sd.go b/stader/api/node/deposit-sd.go index 97493cfea..d13474676 100644 --- a/stader/api/node/deposit-sd.go +++ b/stader/api/node/deposit-sd.go @@ -69,7 +69,7 @@ func canNodeDepositSd(c *cli.Context, amountWei *big.Int) (*api.CanNodeDepositSd } -func getDepositSdApprovalGas(c *cli.Context, amountWei *big.Int) (*api.NodeDepositSdApproveGasResponse, error) { +func getDepositSdApprovalGas(c *cli.Context, amountWei *big.Int, contractAddress common.Address) (*api.SdApproveGasResponse, error) { // Get services if err := services.RequireNodeWallet(c); err != nil { return nil, err @@ -82,20 +82,16 @@ func getDepositSdApprovalGas(c *cli.Context, amountWei *big.Int) (*api.NodeDepos if err != nil { return nil, err } - sdc, err := services.GetSdCollateralContract(c) - if err != nil { - return nil, err - } // Response - response := api.NodeDepositSdApproveGasResponse{} + response := api.SdApproveGasResponse{} // Get gas estimates opts, err := w.GetNodeAccountTransactor() if err != nil { return nil, err } - gasInfo, err := tokens.EstimateApproveGas(sdt, *sdc.SdCollateralContract.Address, amountWei, opts) + gasInfo, err := tokens.EstimateApproveGas(sdt, contractAddress, amountWei, opts) if err != nil { return nil, err } @@ -103,7 +99,7 @@ func getDepositSdApprovalGas(c *cli.Context, amountWei *big.Int) (*api.NodeDepos return &response, nil } -func allowanceSd(c *cli.Context) (*api.NodeDepositSdAllowanceResponse, error) { +func allowanceSd(c *cli.Context, contractAddress common.Address) (*api.SdAllowanceResponse, error) { // Get services if err := services.RequireNodeRegistered(c); err != nil { @@ -117,13 +113,9 @@ func allowanceSd(c *cli.Context) (*api.NodeDepositSdAllowanceResponse, error) { if err != nil { return nil, err } - sdc, err := services.GetSdCollateralContract(c) - if err != nil { - return nil, err - } // Response - response := api.NodeDepositSdAllowanceResponse{} + response := api.SdAllowanceResponse{} // Get node account account, err := w.GetNodeAccount() @@ -131,7 +123,7 @@ func allowanceSd(c *cli.Context) (*api.NodeDepositSdAllowanceResponse, error) { return nil, err } - allowance, err := tokens.Allowance(sdt, account.Address, *sdc.SdCollateralContract.Address, nil) + allowance, err := tokens.Allowance(sdt, account.Address, contractAddress, nil) if err != nil { return nil, err } @@ -141,7 +133,7 @@ func allowanceSd(c *cli.Context) (*api.NodeDepositSdAllowanceResponse, error) { return &response, nil } -func approveSd(c *cli.Context, amountWei *big.Int) (*api.NodeDepositSdApproveResponse, error) { +func approveSd(c *cli.Context, amountWei *big.Int, contractAddress common.Address) (*api.SdApproveResponse, error) { // Get services if err := services.RequireNodeRegistered(c); err != nil { @@ -155,12 +147,9 @@ func approveSd(c *cli.Context, amountWei *big.Int) (*api.NodeDepositSdApproveRes if err != nil { return nil, err } - sdc, err := services.GetSdCollateralContract(c) - if err != nil { - return nil, err - } + // Response - response := api.NodeDepositSdApproveResponse{} + response := api.SdApproveResponse{} opts, err := w.GetNodeAccountTransactor() if err != nil { @@ -170,7 +159,7 @@ func approveSd(c *cli.Context, amountWei *big.Int) (*api.NodeDepositSdApproveRes if err != nil { return nil, fmt.Errorf("Error checking for nonce override: %w", err) } - hash, err := tokens.Approve(sdt, *sdc.SdCollateralContract.Address, amountWei, opts) + hash, err := tokens.Approve(sdt, contractAddress, amountWei, opts) if err != nil { return nil, err } diff --git a/stader/api/node/get-contracts-info.go b/stader/api/node/get-contracts-info.go index 8414b53b6..72d78261e 100644 --- a/stader/api/node/get-contracts-info.go +++ b/stader/api/node/get-contracts-info.go @@ -72,6 +72,10 @@ func getContractsInfo(c *cli.Context) (*api.ContractsInfoResponse, error) { if err != nil { return nil, err } + response.SdUtilityContract, err = services.GetSdUtilityAddress(c) + if err != nil { + return nil, err + } // Return response return &response, nil diff --git a/stader/api/node/utility-sd-allowance.go b/stader/api/node/utility-sd-allowance.go deleted file mode 100644 index 77cb03000..000000000 --- a/stader/api/node/utility-sd-allowance.go +++ /dev/null @@ -1,136 +0,0 @@ -package node - -import ( - "fmt" - "math/big" - - "github.com/stader-labs/stader-node/stader-lib/tokens" - "github.com/urfave/cli" - - "github.com/stader-labs/stader-node/shared/services" - "github.com/stader-labs/stader-node/shared/types/api" - "github.com/stader-labs/stader-node/shared/utils/eth1" -) - -func utilityAllowanceSd(c *cli.Context) (*api.SDPoolUtilitySdAllowanceResponse, error) { - // Get services - if err := services.RequireNodeRegistered(c); err != nil { - return nil, err - } - - w, err := services.GetWallet(c) - if err != nil { - return nil, err - } - - sdt, err := services.GetSdTokenContract(c) - if err != nil { - return nil, err - } - - sduAddress, err := services.GetSdUtilityAddress(c) - if err != nil { - return nil, err - } - - // Response - response := api.SDPoolUtilitySdAllowanceResponse{} - - // Get node account - account, err := w.GetNodeAccount() - if err != nil { - return nil, err - } - - allowance, err := tokens.Allowance(sdt, account.Address, sduAddress, nil) - if err != nil { - return nil, err - } - - response.Allowance = allowance - - return &response, nil -} - -func utilityApproveSd(c *cli.Context, amountWei *big.Int) (*api.NodeDepositSdApproveResponse, error) { - // Get services - if err := services.RequireNodeRegistered(c); err != nil { - return nil, err - } - - w, err := services.GetWallet(c) - if err != nil { - return nil, err - } - - sdt, err := services.GetSdTokenContract(c) - if err != nil { - return nil, err - } - - sduAddress, err := services.GetSdUtilityAddress(c) - if err != nil { - return nil, err - } - // Response - response := api.NodeDepositSdApproveResponse{} - - opts, err := w.GetNodeAccountTransactor() - if err != nil { - return nil, err - } - - err = eth1.CheckForNonceOverride(c, opts) - if err != nil { - return nil, fmt.Errorf("Error checking for nonce override: %w", err) - } - - hash, err := tokens.Approve(sdt, sduAddress, amountWei, opts) - if err != nil { - return nil, err - } - - response.ApproveTxHash = hash - - // Return response - return &response, nil -} - -func getUtilitySdApprovalGas(c *cli.Context, amountWei *big.Int) (*api.NodeDepositSdApproveGasResponse, error) { - // Get services - if err := services.RequireNodeWallet(c); err != nil { - return nil, err - } - - w, err := services.GetWallet(c) - if err != nil { - return nil, err - } - - sdt, err := services.GetSdTokenContract(c) - if err != nil { - return nil, err - } - - utilityAddress, err := services.GetPoolUtilsAddress(c) - if err != nil { - return nil, err - } - - // Response - response := api.NodeDepositSdApproveGasResponse{} - - // Get gas estimates - opts, err := w.GetNodeAccountTransactor() - if err != nil { - return nil, err - } - - gasInfo, err := tokens.EstimateApproveGas(sdt, utilityAddress, amountWei, opts) - if err != nil { - return nil, err - } - - response.GasInfo = gasInfo - return &response, nil -} From 204cdb7ca5178cf239bb7360f0e8445121ed0bba Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Thu, 7 Dec 2023 13:15:50 +0530 Subject: [PATCH 039/159] prompt user to use deposit-sd cmd if they don't have enough collateral --- stader-cli/validator/deposit.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 576890b06..83d7197fe 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -29,7 +29,6 @@ func nodeDeposit(c *cli.Context) error { } numValidators := c.Uint64("num-validators") - autoConfirm := c.Bool("yes") baseAmountInEth := 4 baseAmount := eth.EthToWei(4.0) @@ -84,24 +83,17 @@ func nodeDeposit(c *cli.Context) error { switch i { case 0: if status.AccountBalances.Sd.Cmp(amountToCollateral) < 0 { - cliutils.PrintError("You do not had enough SD in your wallet. Please deposit and try again") + fmt.Printf("You need to deposit %f more SD to collateralize your node to create %d validators\n. Please use the stader-cli node deposit-sd command to deposit SD", eth.WeiToEth(amountToCollateral), numValidators) return nil } - err = node.DepositSdWithAmount(staderClient, amountToCollateral, autoConfirm, 0) - if err != nil { - return err - } - - return nodeDeposit(c) - case 1: utilityAmount, err = node.PromptChooseUtilityAmount(sdStatus) if err != nil { return err } - if !cliutils.Confirm(fmt.Sprintf("You're about to utility %f SD: ", eth.WeiToEth(utilityAmount))) { + if !cliutils.Confirm(fmt.Sprintf("You're about to utilize %f SD: ", eth.WeiToEth(utilityAmount))) { fmt.Printf("Cancel \n") return nil } From 7985ebb8e43ae4f60d82020e3678364e92d8447b Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Thu, 7 Dec 2023 14:13:25 +0530 Subject: [PATCH 040/159] some refactor --- stader-cli/node/approve-sd.go | 4 +--- stader-cli/node/claim-sp-rewards.go | 2 +- stader-cli/node/commands.go | 3 ++- stader-cli/node/repay-sd.go | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/stader-cli/node/approve-sd.go b/stader-cli/node/approve-sd.go index 616ecdf37..eb6559d2f 100644 --- a/stader-cli/node/approve-sd.go +++ b/stader-cli/node/approve-sd.go @@ -14,7 +14,7 @@ import ( "github.com/stader-labs/stader-node/stader-lib/utils/eth" ) -func nodeApproveSd(c *cli.Context, addressInString string) error { +func nodeApproveSd(c *cli.Context, addressInString string, amountInString string) error { staderClient, err := stader.NewClientFromCtx(c) if err != nil { return err @@ -32,8 +32,6 @@ func nodeApproveSd(c *cli.Context, addressInString string) error { cliutils.PrintMultiTransactionNonceWarning() } - amountInString := c.String("amount") - amount, err := strconv.ParseFloat(amountInString, 64) if err != nil { return err diff --git a/stader-cli/node/claim-sp-rewards.go b/stader-cli/node/claim-sp-rewards.go index 4d58a38b4..158ab00de 100644 --- a/stader-cli/node/claim-sp-rewards.go +++ b/stader-cli/node/claim-sp-rewards.go @@ -164,7 +164,7 @@ func ClaimSpRewards(c *cli.Context) error { fmt.Printf("Please select one of the following options:\n") fmt.Printf("1. Claim all SD rewards to your Reward Address\n") - fmt.Printf("2. Redeposit all the SD rewards as SD collateral for additional earnings\n") + fmt.Printf("2. Redeposit all the SD rewards as SD collateral for additional earnings\n\n") option := cliutils.Prompt("", "^(1|2)$", "Please enter a valid option") if option == "1" { diff --git a/stader-cli/node/commands.go b/stader-cli/node/commands.go index aa26f49a3..0c05f44aa 100644 --- a/stader-cli/node/commands.go +++ b/stader-cli/node/commands.go @@ -370,10 +370,11 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { return err } + amount := c.String("amount") address := c.String("address") // Run - return nodeApproveSd(c, address) + return nodeApproveSd(c, address, amount) }, }, { diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index c0d38ed5c..2096999f8 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -54,7 +54,7 @@ func repaySD(c *cli.Context) error { if allowance.Allowance.Cmp(amountWei) < 0 { fmt.Println("Before repay SD, you must first give the utility contract approval to interact with your SD. Amount to approve: ", eth.WeiToEth(amountWei)) - err = nodeApproveSd(c, contracts.SdUtilityContract.String()) + err = nodeApproveSd(c, contracts.SdUtilityContract.String(), amountInString) if err != nil { return err } From a8ca64ea6c2e34e80c3b4b85977353e80f4b9e0f Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Thu, 7 Dec 2023 14:24:45 +0530 Subject: [PATCH 041/159] minor refactor --- stader-cli/node/repay-sd.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index 2096999f8..c991ee5a2 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -60,11 +60,6 @@ func repaySD(c *cli.Context) error { } } - canClaimElRewardsResponse, err := staderClient.CanRepaySd(amountWei) - if err != nil { - return err - } - sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0)) if err != nil { return err @@ -83,7 +78,12 @@ func repaySD(c *cli.Context) error { return nil } - err = gas.AssignMaxFeeAndLimit(canClaimElRewardsResponse.GasInfo, staderClient, c.Bool("yes")) + canRepaySdResponse, err := staderClient.CanRepaySd(amountWei) + if err != nil { + return err + } + + err = gas.AssignMaxFeeAndLimit(canRepaySdResponse.GasInfo, staderClient, c.Bool("yes")) if err != nil { return err } From 4512d115454c3adbe009ea8222bfff7de92f7291 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Thu, 7 Dec 2023 14:39:28 +0530 Subject: [PATCH 042/159] minor refactoring --- stader-cli/node/repay-sd.go | 2 +- stader/api/node/utility-sd.go | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index c991ee5a2..4bda6e49f 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -73,7 +73,7 @@ func repaySD(c *cli.Context) error { } // 2. If user had enough to repay - if amountWei.Cmp(sdStatus.SdBalance) >= 1 { + if amountWei.Cmp(sdStatus.SdBalance) > 0 { cliutils.PrintError(fmt.Sprintf("The node's SD balance is not enough SD, current SD available: %f \n", eth.WeiToEth(sdStatus.SdBalance))) return nil } diff --git a/stader/api/node/utility-sd.go b/stader/api/node/utility-sd.go index a68a97ab9..7c800e530 100644 --- a/stader/api/node/utility-sd.go +++ b/stader/api/node/utility-sd.go @@ -10,8 +10,7 @@ import ( "github.com/stader-labs/stader-node/stader-lib/sdutility" ) -func utilitySd(c *cli.Context, amountWei *big.Int) (*api.NodeUtilitySDResponse, error) { - // Get services +func canUtilitySd(c *cli.Context, amountWei *big.Int) (*api.CanUtilitySDResponse, error) { if err := services.RequireNodeWallet(c); err != nil { return nil, err } @@ -21,6 +20,9 @@ func utilitySd(c *cli.Context, amountWei *big.Int) (*api.NodeUtilitySDResponse, return nil, err } + // Response + response := api.CanUtilitySDResponse{} + sdu, err := services.GetSdUtilityContract(c) if err != nil { return nil, err @@ -32,20 +34,18 @@ func utilitySd(c *cli.Context, amountWei *big.Int) (*api.NodeUtilitySDResponse, return nil, err } - // Response - response := api.NodeUtilitySDResponse{} - - tx, err := sdutility.Utilize(sdu, amountWei, opts) + gasInfo, err := sdutility.EstimateUtilize(sdu, amountWei, opts) if err != nil { return nil, err } - response.TxHash = tx.Hash() + response.GasInfo = gasInfo return &response, nil } -func canUtilitySd(c *cli.Context, amountWei *big.Int) (*api.CanUtilitySDResponse, error) { +func utilitySd(c *cli.Context, amountWei *big.Int) (*api.NodeUtilitySDResponse, error) { + // Get services if err := services.RequireNodeWallet(c); err != nil { return nil, err } @@ -55,9 +55,6 @@ func canUtilitySd(c *cli.Context, amountWei *big.Int) (*api.CanUtilitySDResponse return nil, err } - // Response - response := api.CanUtilitySDResponse{} - sdu, err := services.GetSdUtilityContract(c) if err != nil { return nil, err @@ -69,12 +66,15 @@ func canUtilitySd(c *cli.Context, amountWei *big.Int) (*api.CanUtilitySDResponse return nil, err } - gasInfo, err := sdutility.EstimateUtilize(sdu, amountWei, opts) + // Response + response := api.NodeUtilitySDResponse{} + + tx, err := sdutility.Utilize(sdu, amountWei, opts) if err != nil { return nil, err } - response.GasInfo = gasInfo + response.TxHash = tx.Hash() return &response, nil } From 1bdd683a4a7e01f71c568574887d118250203183 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Thu, 7 Dec 2023 16:24:36 +0530 Subject: [PATCH 043/159] refactor cmds --- stader-cli/node/approve-sd.go | 53 ++++++++++++++++++++++++++++++++--- stader-cli/node/commands.go | 38 ++++++++++++++++++------- stader-cli/node/deposit-sd.go | 4 +-- 3 files changed, 79 insertions(+), 16 deletions(-) diff --git a/stader-cli/node/approve-sd.go b/stader-cli/node/approve-sd.go index eb6559d2f..fa23078cc 100644 --- a/stader-cli/node/approve-sd.go +++ b/stader-cli/node/approve-sd.go @@ -14,7 +14,7 @@ import ( "github.com/stader-labs/stader-node/stader-lib/utils/eth" ) -func nodeApproveSd(c *cli.Context, addressInString string, amountInString string) error { +func nodeApproveDepositSd(c *cli.Context, amountInString string) error { staderClient, err := stader.NewClientFromCtx(c) if err != nil { return err @@ -39,13 +39,58 @@ func nodeApproveSd(c *cli.Context, addressInString string, amountInString string amountWei := eth.EthToWei(amount) - address := common.HexToAddress(addressInString) + contracts, err := staderClient.GetContractsInfo() + if err != nil { + return err + } + + autoConfirm := c.Bool("yes") + + nonce := c.GlobalUint64("nonce") + + err = nodeApproveSdWithAmountAndAddress(staderClient, amountWei, contracts.SdCollateralContract, autoConfirm, nonce) + if err != nil { + return err + } + + return nil +} + +func nodeApproveUtilitySd(c *cli.Context, amountInString string) error { + staderClient, err := stader.NewClientFromCtx(c) + if err != nil { + return err + } + defer staderClient.Close() + + // Check and assign the EC status + err = cliutils.CheckClientStatus(staderClient) + if err != nil { + return err + } + + // If a custom nonce is set, print the multi-transaction warning + if c.GlobalUint64("nonce") != 0 { + cliutils.PrintMultiTransactionNonceWarning() + } + + amount, err := strconv.ParseFloat(amountInString, 64) + if err != nil { + return err + } + + amountWei := eth.EthToWei(amount) + + contracts, err := staderClient.GetContractsInfo() + if err != nil { + return err + } autoConfirm := c.Bool("yes") nonce := c.GlobalUint64("nonce") - err = nodeApproveSdWithAmount(staderClient, amountWei, address, autoConfirm, nonce) + err = nodeApproveSdWithAmountAndAddress(staderClient, amountWei, contracts.SdUtilityContract, autoConfirm, nonce) if err != nil { return err } @@ -53,7 +98,7 @@ func nodeApproveSd(c *cli.Context, addressInString string, amountInString string return nil } -func nodeApproveSdWithAmount(staderClient *stader.Client, amountWei *big.Int, address common.Address, autoConfirm bool, nonce uint64) error { +func nodeApproveSdWithAmountAndAddress(staderClient *stader.Client, amountWei *big.Int, address common.Address, autoConfirm bool, nonce uint64) error { // If a custom nonce is set, print the multi-transaction warning if nonce != 0 { cliutils.PrintMultiTransactionNonceWarning() diff --git a/stader-cli/node/commands.go b/stader-cli/node/commands.go index 0c05f44aa..d7b5ae3c2 100644 --- a/stader-cli/node/commands.go +++ b/stader-cli/node/commands.go @@ -344,7 +344,7 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { }, }, { - Name: "approve-sd", + Name: "deposit-approve-sd", Aliases: []string{"k"}, Usage: "Approve SD against the node", UsageText: "stader-cli node approve-sd [options]", @@ -353,10 +353,6 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { Name: "amount, a", Usage: "The amount of SD to approve", }, - cli.StringFlag{ - Name: "address, c", - Usage: "The address to which we want to approve SD", - }, cli.BoolFlag{ Name: "yes, y", Usage: "Automatically confirm SD approve", @@ -366,15 +362,11 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { if _, err := cliutils.ValidatePositiveEthAmount("sd deposit amount", c.String("amount")); err != nil { return err } - if _, err := cliutils.ValidateAddress("address", c.String("address")); err != nil { - return err - } amount := c.String("amount") - address := c.String("address") // Run - return nodeApproveSd(c, address, amount) + return nodeApproveDepositSd(c, amount) }, }, { @@ -414,6 +406,32 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { return repaySD(c) }, }, + { + Name: "approve-utility-sd", + Aliases: []string{"aus"}, + Usage: "Approve SD for utility pool", + UsageText: "stader-cli node approve-utility-sd [options]", + Flags: []cli.Flag{ + cli.StringFlag{ + Name: "amount, a", + Usage: "The amount of SD to approve", + }, + cli.BoolFlag{ + Name: "yes, y", + Usage: "Automatically confirm SD approve", + }, + }, + Action: func(c *cli.Context) error { + if _, err := cliutils.ValidatePositiveEthAmount("sd amount", c.String("amount")); err != nil { + return err + } + + amountInString := c.String("amount") + + // Run + return nodeApproveUtilitySd(c, amountInString) + }, + }, }, }) } diff --git a/stader-cli/node/deposit-sd.go b/stader-cli/node/deposit-sd.go index c154b31ff..cec781f3c 100644 --- a/stader-cli/node/deposit-sd.go +++ b/stader-cli/node/deposit-sd.go @@ -48,7 +48,7 @@ func nodeDepositSd(c *cli.Context) error { return DepositSdWithAmount(staderClient, amountWei, autoConfirm, nounce) } -func DepositSdWithAmount(staderClient *stader.Client, amountWei *big.Int, autoConfirm bool, nounce uint64) error { +func DepositSdWithAmount(staderClient *stader.Client, amountWei *big.Int, autoConfirm bool, nonce uint64) error { contracts, err := staderClient.GetContractsInfo() if err != nil { return err @@ -62,7 +62,7 @@ func DepositSdWithAmount(staderClient *stader.Client, amountWei *big.Int, autoCo if allowance.Allowance.Cmp(amountWei) < 0 { fmt.Println("Before depositing SD, you must first give the collateral contract approval to interact with your SD. Amount to approve: ", eth.WeiToEth(amountWei)) - err = nodeApproveSdWithAmount(staderClient, amountWei, contracts.SdCollateralContract, autoConfirm, nounce) + err = nodeApproveSdWithAmount(staderClient, amountWei, contracts.SdCollateralContract, autoConfirm, nonce) if err != nil { return err } From d3b862cdade72869d2f23f6216d92f26c0a88905 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Thu, 7 Dec 2023 16:25:33 +0530 Subject: [PATCH 044/159] refactor --- shared/services/stader/node.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/services/stader/node.go b/shared/services/stader/node.go index ca866d692..10ae5d51b 100644 --- a/shared/services/stader/node.go +++ b/shared/services/stader/node.go @@ -114,7 +114,7 @@ func (c *Client) CanNodeDepositSd(amountWei *big.Int) (api.CanNodeDepositSdRespo // Get the gas estimate for approving new SD interaction func (c *Client) NodeSdApprovalGas(amountWei *big.Int, address common.Address) (api.SdApproveGasResponse, error) { - responseBytes, err := c.callAPI(fmt.Sprintf("node get-deposit-sd-approval-gas %s %s", amountWei.String(), address)) + responseBytes, err := c.callAPI(fmt.Sprintf("node get-sd-approval-gas %s %s", amountWei.String(), address)) if err != nil { return api.SdApproveGasResponse{}, fmt.Errorf("could not get new SD approval gas: %w", err) } @@ -130,7 +130,7 @@ func (c *Client) NodeSdApprovalGas(amountWei *big.Int, address common.Address) ( // Approve SD for depositing as collateral func (c *Client) NodeSdApprove(amountWei *big.Int, address common.Address) (api.SdApproveResponse, error) { - responseBytes, err := c.callAPI(fmt.Sprintf("node deposit-sd-approve-sd %s %s", amountWei.String(), address)) + responseBytes, err := c.callAPI(fmt.Sprintf("node sd-approve-sd %s %s", amountWei.String(), address)) if err != nil { return api.SdApproveResponse{}, fmt.Errorf("could not approve SD for staking: %w", err) } From d18607fa5b36910f2467ce503170c0d3fa8053f4 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Thu, 7 Dec 2023 15:12:29 +0700 Subject: [PATCH 045/159] Update Reward Eligible --- abis/OperatorRewardsCollector.abi.json | 814 ++++++++++-------- shared/types/api/node.go | 11 +- stader-cli/node/claim-rewards.go | 10 +- stader-cli/node/deposit-sd.go | 2 +- stader-cli/node/repay-sd.go | 2 +- stader-cli/node/status.go | 7 + stader-cli/node/withdraw-sd.go | 7 + .../contracts/operator-rewards-collector.go | 75 +- stader-lib/node/operator.go | 9 + stader-lib/sd-collateral/sd-deposit.go | 17 + stader/api/node/claim-rewards.go | 8 + stader/api/validator/deposit.go | 10 +- 12 files changed, 585 insertions(+), 387 deletions(-) diff --git a/abis/OperatorRewardsCollector.abi.json b/abis/OperatorRewardsCollector.abi.json index 594208ca2..6fc23cab7 100644 --- a/abis/OperatorRewardsCollector.abi.json +++ b/abis/OperatorRewardsCollector.abi.json @@ -1,374 +1,444 @@ [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "TransferFailed", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Claimed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "DepositedFor", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "CallerNotStaderContract", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientBalance", + "type": "error" + }, + { + "inputs": [], + "name": "TransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Claimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "DepositedFor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staderConfig", + "type": "address" + } + ], + "name": "UpdatedStaderConfig", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balances", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "claimFor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "liquidatorAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + } + ], + "name": "claimLiquidation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_receiver", + "type": "address" + } + ], + "name": "depositFor", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_admin", + "type": "address" + }, + { + "internalType": "address", + "name": "_staderConfig", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], "name": "staderConfig", - "type": "address" - } - ], - "name": "UpdatedStaderConfig", - "type": "event" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "balances", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "claim", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "depositFor", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_admin", - "type": "address" - }, - { - "internalType": "address", - "name": "_staderConfig", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "staderConfig", - "outputs": [ - { - "internalType": "contract IStaderConfig", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_staderConfig", - "type": "address" - } - ], - "name": "updateStaderConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] \ No newline at end of file + "outputs": [ + { + "internalType": "contract IStaderConfig", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staderConfig", + "type": "address" + } + ], + "name": "updateStaderConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "withdrawableInEth", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/shared/types/api/node.go b/shared/types/api/node.go index 12fa1769a..5be530f42 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -397,10 +397,11 @@ type NodeSignResponse struct { } type CanClaimRewards struct { - Status string `json:"status"` - Error string `json:"error"` - NoRewards bool `json:"noRewards"` - GasInfo stader.GasInfo `json:"gasInfo"` + Status string `json:"status"` + Error string `json:"error"` + NoRewards bool `json:"noRewards"` + WithdrawableInEth *big.Int `json:"withdrawableInEth"` + GasInfo stader.GasInfo `json:"gasInfo"` } type ClaimRewards struct { @@ -447,9 +448,9 @@ type SdStatusResponse struct { SdCollateralCurrentAmount *big.Int `json:"sdCollateralCurrentAmount"` SdCollateralRequireAmount *big.Int `json:"sdCollateralRequireAmount"` SdMaxUtilizableAmount *big.Int `json:"sdMaxUtilizableAmount"` - SdMaxCollateralAmount *big.Int `json:"sdMaxCollateralAmount"` SdBalance *big.Int `json:"sdBalance"` PoolAvailableSDBalance *big.Int `json:"poolAvailableSDBalance"` + SdRewardEligible *big.Int `json:"sdRewardEligible"` NotEnoughSdCollateral bool `json:"notEnoughSdCollateral"` } diff --git a/stader-cli/node/claim-rewards.go b/stader-cli/node/claim-rewards.go index 7aee4880c..a158485ce 100644 --- a/stader-cli/node/claim-rewards.go +++ b/stader-cli/node/claim-rewards.go @@ -43,13 +43,17 @@ func ClaimRewards(c *cli.Context) error { return err } - // TODO: + sdStatus := sdStatusResponse.SDStatus + // 1. How much SD fee need to repay // 2. Based on the current Health Factor, you can claim upto ETH. if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { - cliutils.PrintError(fmt.Sprintf("You need to first pay %f and close the utilization position to get back your funds. Execute the following command to repay your utilized SD stader-cli repay-sd --amount \n", eth.WeiToEth(sdStatusResponse.SDStatus.SdUtilizerLatestBalance))) - return nil + totalFee := new(big.Int).Sub(sdStatus.SdUtilizerLatestBalance, sdStatus.SdUtilizedBalance) + + cliutils.PrintWarning(fmt.Sprintf("You need to first pay %f and close the utilization position to get back your funds. Execute the following command to repay your utilized SD stader-cli repay-sd --amount \n", eth.WeiToEth(totalFee))) + + cliutils.PrintWarning(fmt.Sprintf("Based on the current Health Factor, you can claim upto %.6f ETH.", eth.WeiToEth(canClaimRewardsResponse.WithdrawableInEth))) } err = gas.AssignMaxFeeAndLimit(canClaimRewardsResponse.GasInfo, staderClient, c.Bool("yes")) diff --git a/stader-cli/node/deposit-sd.go b/stader-cli/node/deposit-sd.go index cec781f3c..b361c2cf4 100644 --- a/stader-cli/node/deposit-sd.go +++ b/stader-cli/node/deposit-sd.go @@ -62,7 +62,7 @@ func DepositSdWithAmount(staderClient *stader.Client, amountWei *big.Int, autoCo if allowance.Allowance.Cmp(amountWei) < 0 { fmt.Println("Before depositing SD, you must first give the collateral contract approval to interact with your SD. Amount to approve: ", eth.WeiToEth(amountWei)) - err = nodeApproveSdWithAmount(staderClient, amountWei, contracts.SdCollateralContract, autoConfirm, nonce) + err = nodeApproveSdWithAmountAndAddress(staderClient, amountWei, contracts.SdCollateralContract, autoConfirm, nonce) if err != nil { return err } diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index 4bda6e49f..e7ec40775 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -54,7 +54,7 @@ func repaySD(c *cli.Context) error { if allowance.Allowance.Cmp(amountWei) < 0 { fmt.Println("Before repay SD, you must first give the utility contract approval to interact with your SD. Amount to approve: ", eth.WeiToEth(amountWei)) - err = nodeApproveSd(c, contracts.SdUtilityContract.String(), amountInString) + err = nodeApproveUtilitySd(c, amountInString) if err != nil { return err } diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index e19265596..d92774971 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -231,5 +231,12 @@ func getNodeStatus(c *cli.Context) error { log.ColorReset, current/require*100, "%") + fmt.Printf( + "The node %s%s%s reward Eligible SD is %.6f.\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, + eth.WeiToEth(sdStatus.SdRewardEligible)) + return nil } diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index 0cc124370..176e5daf3 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -50,8 +50,15 @@ func WithdrawSd(c *cli.Context) error { if err != nil { return err } + if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { fmt.Printf("You currently have %f utilized SD. When you try to withdraw SD, the withdrawable SD will be paid back to the utility pool first.\n", eth.WeiToEth(sdStatusResponse.SDStatus.SdUtilizerLatestBalance)) + + sdStatus := sdStatusResponse.SDStatus + totalFee := new(big.Int).Sub(sdStatus.SdUtilizerLatestBalance, sdStatus.SdUtilizedBalance) + + msg := fmt.Sprintf("You have an existing utilization position, please repay your utilized SD first by executing the following command: stader-cli repay-sd --amount %.6f", eth.WeiToEth(totalFee)) + cliutils.PrintWarning(msg) } // Assign max fees diff --git a/stader-lib/contracts/operator-rewards-collector.go b/stader-lib/contracts/operator-rewards-collector.go index d31261d57..50c9bdcad 100644 --- a/stader-lib/contracts/operator-rewards-collector.go +++ b/stader-lib/contracts/operator-rewards-collector.go @@ -31,7 +31,7 @@ var ( // OperatorRewardsCollectorMetaData contains all meta data concerning the OperatorRewardsCollector contract. var OperatorRewardsCollectorMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"TransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Claimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"DepositedFor\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balances\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"}],\"name\":\"depositFor\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"staderConfig\",\"outputs\":[{\"internalType\":\"contractIStaderConfig\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CallerNotStaderContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Claimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"DepositedFor\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balances\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"claimFor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"liquidatorAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"name\":\"claimLiquidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"}],\"name\":\"depositFor\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"staderConfig\",\"outputs\":[{\"internalType\":\"contractIStaderConfig\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"withdrawableInEth\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } // OperatorRewardsCollectorABI is the input ABI used to generate the binding from. @@ -366,6 +366,37 @@ func (_OperatorRewardsCollector *OperatorRewardsCollectorCallerSession) Supports return _OperatorRewardsCollector.Contract.SupportsInterface(&_OperatorRewardsCollector.CallOpts, interfaceId) } +// WithdrawableInEth is a free data retrieval call binding the contract method 0x96198d0f. +// +// Solidity: function withdrawableInEth(address operator) view returns(uint256) +func (_OperatorRewardsCollector *OperatorRewardsCollectorCaller) WithdrawableInEth(opts *bind.CallOpts, operator common.Address) (*big.Int, error) { + var out []interface{} + err := _OperatorRewardsCollector.contract.Call(opts, &out, "withdrawableInEth", operator) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// WithdrawableInEth is a free data retrieval call binding the contract method 0x96198d0f. +// +// Solidity: function withdrawableInEth(address operator) view returns(uint256) +func (_OperatorRewardsCollector *OperatorRewardsCollectorSession) WithdrawableInEth(operator common.Address) (*big.Int, error) { + return _OperatorRewardsCollector.Contract.WithdrawableInEth(&_OperatorRewardsCollector.CallOpts, operator) +} + +// WithdrawableInEth is a free data retrieval call binding the contract method 0x96198d0f. +// +// Solidity: function withdrawableInEth(address operator) view returns(uint256) +func (_OperatorRewardsCollector *OperatorRewardsCollectorCallerSession) WithdrawableInEth(operator common.Address) (*big.Int, error) { + return _OperatorRewardsCollector.Contract.WithdrawableInEth(&_OperatorRewardsCollector.CallOpts, operator) +} + // Claim is a paid mutator transaction binding the contract method 0x4e71d92d. // // Solidity: function claim() returns() @@ -387,6 +418,48 @@ func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactorSession) Clai return _OperatorRewardsCollector.Contract.Claim(&_OperatorRewardsCollector.TransactOpts) } +// ClaimFor is a paid mutator transaction binding the contract method 0x0de05659. +// +// Solidity: function claimFor(address operator, uint256 amount) returns() +func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactor) ClaimFor(opts *bind.TransactOpts, operator common.Address, amount *big.Int) (*types.Transaction, error) { + return _OperatorRewardsCollector.contract.Transact(opts, "claimFor", operator, amount) +} + +// ClaimFor is a paid mutator transaction binding the contract method 0x0de05659. +// +// Solidity: function claimFor(address operator, uint256 amount) returns() +func (_OperatorRewardsCollector *OperatorRewardsCollectorSession) ClaimFor(operator common.Address, amount *big.Int) (*types.Transaction, error) { + return _OperatorRewardsCollector.Contract.ClaimFor(&_OperatorRewardsCollector.TransactOpts, operator, amount) +} + +// ClaimFor is a paid mutator transaction binding the contract method 0x0de05659. +// +// Solidity: function claimFor(address operator, uint256 amount) returns() +func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactorSession) ClaimFor(operator common.Address, amount *big.Int) (*types.Transaction, error) { + return _OperatorRewardsCollector.Contract.ClaimFor(&_OperatorRewardsCollector.TransactOpts, operator, amount) +} + +// ClaimLiquidation is a paid mutator transaction binding the contract method 0xb86d3808. +// +// Solidity: function claimLiquidation(uint256 liquidatorAmount, uint256 feeAmount, address liquidator) returns() +func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactor) ClaimLiquidation(opts *bind.TransactOpts, liquidatorAmount *big.Int, feeAmount *big.Int, liquidator common.Address) (*types.Transaction, error) { + return _OperatorRewardsCollector.contract.Transact(opts, "claimLiquidation", liquidatorAmount, feeAmount, liquidator) +} + +// ClaimLiquidation is a paid mutator transaction binding the contract method 0xb86d3808. +// +// Solidity: function claimLiquidation(uint256 liquidatorAmount, uint256 feeAmount, address liquidator) returns() +func (_OperatorRewardsCollector *OperatorRewardsCollectorSession) ClaimLiquidation(liquidatorAmount *big.Int, feeAmount *big.Int, liquidator common.Address) (*types.Transaction, error) { + return _OperatorRewardsCollector.Contract.ClaimLiquidation(&_OperatorRewardsCollector.TransactOpts, liquidatorAmount, feeAmount, liquidator) +} + +// ClaimLiquidation is a paid mutator transaction binding the contract method 0xb86d3808. +// +// Solidity: function claimLiquidation(uint256 liquidatorAmount, uint256 feeAmount, address liquidator) returns() +func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactorSession) ClaimLiquidation(liquidatorAmount *big.Int, feeAmount *big.Int, liquidator common.Address) (*types.Transaction, error) { + return _OperatorRewardsCollector.Contract.ClaimLiquidation(&_OperatorRewardsCollector.TransactOpts, liquidatorAmount, feeAmount, liquidator) +} + // DepositFor is a paid mutator transaction binding the contract method 0xaa67c919. // // Solidity: function depositFor(address _receiver) payable returns() diff --git a/stader-lib/node/operator.go b/stader-lib/node/operator.go index a73673cdf..46850ea0f 100644 --- a/stader-lib/node/operator.go +++ b/stader-lib/node/operator.go @@ -107,6 +107,15 @@ func GetOperatorId(pnr *stader.PermissionlessNodeRegistryContractManager, nodeAd return operatorId, nil } +func WithdrawableInEth(orc *stader.OperatorRewardsCollectorContractManager, nodeAddress common.Address, opts *bind.CallOpts) (*big.Int, error) { + withdrawableInEth, err := orc.OperatorRewardsCollector.WithdrawableInEth(opts, nodeAddress) + if err != nil { + return nil, err + } + + return withdrawableInEth, nil +} + func GetOperatorInfo(pnr *stader.PermissionlessNodeRegistryContractManager, operatorId *big.Int, opts *bind.CallOpts) (types2.OperatorInfo, error) { operatorInfo, err := pnr.PermissionlessNodeRegistry.OperatorStructById(opts, operatorId) if err != nil { diff --git a/stader-lib/sd-collateral/sd-deposit.go b/stader-lib/sd-collateral/sd-deposit.go index 664317733..dd0d8c326 100644 --- a/stader-lib/sd-collateral/sd-deposit.go +++ b/stader-lib/sd-collateral/sd-deposit.go @@ -64,6 +64,23 @@ func MinimumSDToBond(sdc *stader.SdCollateralContractManager, poolID uint8, numV return minimumSDToBond, nil } +func RewardEligibleSD(sdc *stader.SdCollateralContractManager, poolID uint8, numValidators *big.Int, opts *bind.CallOpts) (*big.Int, error) { + poolThreshold, err := sdc.SdCollateral.PoolThresholdbyPoolId(opts, poolID) + if err != nil { + return nil, err + } + + maxThreshold := poolThreshold.MaxThreshold + ethAmount := new(big.Int).Mul(maxThreshold, numValidators) + + sdAmount, err := sdc.SdCollateral.ConvertETHToSD(opts, ethAmount) + if err != nil { + return nil, err + } + + return sdAmount, nil +} + func HasEnoughSdCollateral(sdc *stader.SdCollateralContractManager, operatorAddress common.Address, poolType uint8, numValidators *big.Int, opts *bind.CallOpts) (bool, error) { hasEnoughSdCollateral, err := sdc.SdCollateral.HasEnoughSDCollateral(opts, operatorAddress, poolType, numValidators) if err != nil { diff --git a/stader/api/node/claim-rewards.go b/stader/api/node/claim-rewards.go index a7ba031b9..05610f693 100644 --- a/stader/api/node/claim-rewards.go +++ b/stader/api/node/claim-rewards.go @@ -35,6 +35,14 @@ func CanClaimRewards(c *cli.Context) (*api.CanClaimRewards, error) { if err != nil { return nil, err } + + withdrawableInEth, err := node.WithdrawableInEth(orc, nodeAccount.Address, nil) + if err != nil { + return nil, err + } + + response.WithdrawableInEth = withdrawableInEth + if operatorClaimVaultBalance.Cmp(big.NewInt(0)) == 0 { response.NoRewards = true return &response, nil diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index da2b9aacb..5c894d1af 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -21,7 +21,6 @@ import ( ) const ( - MaxBondThreshold = 20 MinToUtilizeRatioNum = 5 MinToUtilizeRatioDenom = 2 ) @@ -58,14 +57,17 @@ func GetSDStatus( return nil, err } + rewardEligibleSD, err := sd_collateral.RewardEligibleSD(sdc, 1, totalValidatorsPostAddition, nil) + if err != nil { + return nil, err + } + // Check Sd balance sdBalance, err := sdt.Erc20Token.BalanceOf(nil, operatorAddress) if err != nil { return nil, err } - sdMaxCollateralAmount := new(big.Int).Mul(minimumSDToBond, big.NewInt(MaxBondThreshold)) - sdMaxUtilizableAmount := new(big.Int).Mul(minimumSDToBond, big.NewInt(MinToUtilizeRatioNum)) sdMaxUtilizableAmount = new(big.Int).Div(sdMaxUtilizableAmount, big.NewInt(MinToUtilizeRatioDenom)) @@ -81,9 +83,9 @@ func GetSDStatus( SdCollateralCurrentAmount: sdCollateralCurrentAmount, SdCollateralRequireAmount: minimumSDToBond, SdMaxUtilizableAmount: sdMaxUtilizableAmount, - SdMaxCollateralAmount: sdMaxCollateralAmount, SdUtilizedBalance: sdUtilizedBalance, PoolAvailableSDBalance: poolAvailableSDBalance, + SdRewardEligible: rewardEligibleSD, }, nil } From 23381bf2a4d6a8df222e82a69cf79058d1381dc6 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Thu, 7 Dec 2023 21:27:41 +0700 Subject: [PATCH 046/159] Early return error --- stader-cli/node/claim-sp-rewards.go | 1 - stader/api/node/commands.go | 2 -- stader/api/node/deposit-sd.go | 2 -- stader/api/validator/deposit.go | 1 + 4 files changed, 1 insertion(+), 5 deletions(-) diff --git a/stader-cli/node/claim-sp-rewards.go b/stader-cli/node/claim-sp-rewards.go index 158ab00de..570d2ecc1 100644 --- a/stader-cli/node/claim-sp-rewards.go +++ b/stader-cli/node/claim-sp-rewards.go @@ -181,7 +181,6 @@ func ClaimSpRewards(c *cli.Context) error { } depositSd = true } - } else { if cliutils.Confirm(fmt.Sprintf( "Are you sure you want to claim %s ETH for cycles %v to your reward address?", totalClaimableEth.String(), cyclesToClaimArray)) { diff --git a/stader/api/node/commands.go b/stader/api/node/commands.go index 0d7eddc95..55a520a3d 100644 --- a/stader/api/node/commands.go +++ b/stader/api/node/commands.go @@ -264,7 +264,6 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { Usage: "Approve SD for staking against the node", UsageText: "stader-cli api node deposit-sd-approve-sd amount contract-address", Action: func(c *cli.Context) error { - // Validate args if err := cliutils.ValidateArgCount(c, 2); err != nil { return err @@ -281,7 +280,6 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { // Run api.PrintResponse(approveSd(c, amountWei, contractAddress)) return nil - }, }, { diff --git a/stader/api/node/deposit-sd.go b/stader/api/node/deposit-sd.go index d13474676..5d50de8c6 100644 --- a/stader/api/node/deposit-sd.go +++ b/stader/api/node/deposit-sd.go @@ -100,7 +100,6 @@ func getDepositSdApprovalGas(c *cli.Context, amountWei *big.Int, contractAddress } func allowanceSd(c *cli.Context, contractAddress common.Address) (*api.SdAllowanceResponse, error) { - // Get services if err := services.RequireNodeRegistered(c); err != nil { return nil, err @@ -134,7 +133,6 @@ func allowanceSd(c *cli.Context, contractAddress common.Address) (*api.SdAllowan } func approveSd(c *cli.Context, amountWei *big.Int, contractAddress common.Address) (*api.SdApproveResponse, error) { - // Get services if err := services.RequireNodeRegistered(c); err != nil { return nil, err diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index 5c894d1af..f7f032f6d 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -146,6 +146,7 @@ func canNodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidato } if userBalance.Cmp(amountToSend) < 0 { canNodeDepositResponse.InsufficientBalance = true + return &canNodeDepositResponse, nil } isPermissionlessNodeRegistryPaused, err := node.IsPermissionlessNodeRegistryPaused(prn, nil) From b31dcc785c6189035cc10d5343070ebe2b3dc962 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Thu, 7 Dec 2023 21:31:26 +0530 Subject: [PATCH 047/159] fix build errors --- stader-cli/node/deposit-sd.go | 2 +- stader-cli/node/repay-sd.go | 2 +- stader/api/node/commands.go | 2 +- stader/api/node/deposit-sd.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/stader-cli/node/deposit-sd.go b/stader-cli/node/deposit-sd.go index cec781f3c..b361c2cf4 100644 --- a/stader-cli/node/deposit-sd.go +++ b/stader-cli/node/deposit-sd.go @@ -62,7 +62,7 @@ func DepositSdWithAmount(staderClient *stader.Client, amountWei *big.Int, autoCo if allowance.Allowance.Cmp(amountWei) < 0 { fmt.Println("Before depositing SD, you must first give the collateral contract approval to interact with your SD. Amount to approve: ", eth.WeiToEth(amountWei)) - err = nodeApproveSdWithAmount(staderClient, amountWei, contracts.SdCollateralContract, autoConfirm, nonce) + err = nodeApproveSdWithAmountAndAddress(staderClient, amountWei, contracts.SdCollateralContract, autoConfirm, nonce) if err != nil { return err } diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index 4bda6e49f..e7ec40775 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -54,7 +54,7 @@ func repaySD(c *cli.Context) error { if allowance.Allowance.Cmp(amountWei) < 0 { fmt.Println("Before repay SD, you must first give the utility contract approval to interact with your SD. Amount to approve: ", eth.WeiToEth(amountWei)) - err = nodeApproveSd(c, contracts.SdUtilityContract.String(), amountInString) + err = nodeApproveUtilitySd(c, amountInString) if err != nil { return err } diff --git a/stader/api/node/commands.go b/stader/api/node/commands.go index 0d7eddc95..bc8423ab9 100644 --- a/stader/api/node/commands.go +++ b/stader/api/node/commands.go @@ -303,7 +303,7 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { return err } // Run - api.PrintResponse(getDepositSdApprovalGas(c, amountWei, contractAddress)) + api.PrintResponse(getSdApprovalGas(c, amountWei, contractAddress)) return nil }, diff --git a/stader/api/node/deposit-sd.go b/stader/api/node/deposit-sd.go index d13474676..28fae82e7 100644 --- a/stader/api/node/deposit-sd.go +++ b/stader/api/node/deposit-sd.go @@ -69,7 +69,7 @@ func canNodeDepositSd(c *cli.Context, amountWei *big.Int) (*api.CanNodeDepositSd } -func getDepositSdApprovalGas(c *cli.Context, amountWei *big.Int, contractAddress common.Address) (*api.SdApproveGasResponse, error) { +func getSdApprovalGas(c *cli.Context, amountWei *big.Int, contractAddress common.Address) (*api.SdApproveGasResponse, error) { // Get services if err := services.RequireNodeWallet(c); err != nil { return nil, err From caf4ac54f32f408e3b7c3484c18a323c7582c804 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Mon, 11 Dec 2023 09:47:35 +0530 Subject: [PATCH 048/159] withdraw-sd new flow --- stader-cli/node/withdraw-sd.go | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index 176e5daf3..e30accdf3 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -50,15 +50,18 @@ func WithdrawSd(c *cli.Context) error { if err != nil { return err } - - if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { - fmt.Printf("You currently have %f utilized SD. When you try to withdraw SD, the withdrawable SD will be paid back to the utility pool first.\n", eth.WeiToEth(sdStatusResponse.SDStatus.SdUtilizerLatestBalance)) - - sdStatus := sdStatusResponse.SDStatus - totalFee := new(big.Int).Sub(sdStatus.SdUtilizerLatestBalance, sdStatus.SdUtilizedBalance) - - msg := fmt.Sprintf("You have an existing utilization position, please repay your utilized SD first by executing the following command: stader-cli repay-sd --amount %.6f", eth.WeiToEth(totalFee)) - cliutils.PrintWarning(msg) + if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(amountWei) <= 0 { + confirm := cliutils.Confirm(fmt.Sprintf("You have an existing Utilization Position of %.6f SD. The excess SD collateral you are trying to withdraw will be used to repay the utilized SD.\n Do you wish to proceed? [y/n]", math.RoundDown(eth.WeiToEth(sdStatusResponse.SDStatus.SdUtilizerLatestBalance), 6))) + if !confirm { + fmt.Println("Cancelled.") + return nil + } + } else { + confirm := cliutils.Confirm(fmt.Sprintf("You have an existing Utilization Position of %.6f SD. The excess SD collateral you are trying to withdraw will be used to repay the utilized SD and the remaining SD will be sent to your Reward Address.\n Do you wish to proceed? [y/n]", math.RoundDown(eth.WeiToEth(sdStatusResponse.SDStatus.SdUtilizerLatestBalance), 6))) + if !confirm { + fmt.Println("Cancelled.") + return nil + } } // Assign max fees From d38bc9f5c8f12493ee418f913d9112875d9e66c7 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Mon, 11 Dec 2023 09:58:21 +0530 Subject: [PATCH 049/159] Add SD utility pool balance metrics to grafana --- shared/services/state/network-state.go | 8 ++++++++ stader/guardian/collector/network-collector.go | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/shared/services/state/network-state.go b/shared/services/state/network-state.go index 756874303..105dde8b6 100644 --- a/shared/services/state/network-state.go +++ b/shared/services/state/network-state.go @@ -118,6 +118,8 @@ type MetricDetails struct { // done OperatorSDUtilized float64 + // done + SdUtilityPoolBalance float64 // done OperatorSDInterest float64 @@ -476,6 +478,11 @@ func CreateMetricsCache( return nil, err } + utilityPoolBalance, err := sdutility.GetPoolAvailableSDBalance(sdu, nil) + if err != nil { + return nil, err + } + minThreshold := math.RoundDown(eth.WeiToEth(permissionlessPoolThreshold.MinThreshold), 2) sdPriceFormatted := math.RoundDown(eth.WeiToEth(sdPrice), 2) collateralRatioInSd := minThreshold * sdPriceFormatted @@ -527,6 +534,7 @@ func CreateMetricsCache( metricsDetails.OperatorSDUtilized = math.RoundDown(eth.WeiToEth(sdUtilizedLatest), SixDecimalRound) interest := new(big.Int).Sub(sdUtilizedLatest, sdUtilized) metricsDetails.OperatorSDInterest = math.RoundDown(eth.WeiToEth(interest), SixDecimalRound) + metricsDetails.SdUtilityPoolBalance = math.RoundDown(eth.WeiToEth(utilityPoolBalance), SixDecimalRound) state.StaderNetworkDetails = metricsDetails diff --git a/stader/guardian/collector/network-collector.go b/stader/guardian/collector/network-collector.go index 52bf8f12b..1f82b7d90 100644 --- a/stader/guardian/collector/network-collector.go +++ b/stader/guardian/collector/network-collector.go @@ -59,6 +59,9 @@ type NetworkCollector struct { // The min amount of sd value that can be staked to get rewards MinEthThreshold *prometheus.Desc + // The current balance of the SD utility pool + SdUtilityPoolBalance *prometheus.Desc + // The beacon client bc beacon.Client @@ -139,6 +142,10 @@ func NewNetworkCollector(bc beacon.Client, ec stader.ExecutionClient, nodeAddres "The maximum amount of sd value that can be staked to get rewards", nil, nil, ), + SdUtilityPoolBalance: prometheus.NewDesc(prometheus.BuildFQName(namespace, subsystem, "sd_utility_pool_balance"), + "The current balance of the SD utility pool", + nil, nil, + ), bc: bc, ec: ec, nodeAddress: nodeAddress, @@ -164,6 +171,7 @@ func (collector *NetworkCollector) Describe(channel chan<- *prometheus.Desc) { channel <- collector.CollateralRatioInSd channel <- collector.MinEthThreshold channel <- collector.MaxEthThreshold + channel <- collector.SdUtilityPoolBalance } // Collect the latest metric values and pass them to Prometheus @@ -203,6 +211,7 @@ func (collector *NetworkCollector) Collect(channel chan<- prometheus.Metric) { collector.MinEthThreshold, prometheus.GaugeValue, state.StaderNetworkDetails.MinEthThreshold) channel <- prometheus.MustNewConstMetric( collector.MaxEthThreshold, prometheus.GaugeValue, state.StaderNetworkDetails.MaxEthThreshold) + channel <- prometheus.MustNewConstMetric(collector.SdUtilityPoolBalance, prometheus.GaugeValue, state.StaderNetworkDetails.SdUtilityPoolBalance) } // Log error messages From a9dcd8366fce455c1d352ef8cc44ed4db543219d Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Mon, 11 Dec 2023 10:03:00 +0530 Subject: [PATCH 050/159] minor fix --- stader-cli/node/withdraw-sd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index e30accdf3..dd4fc5c76 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -50,7 +50,7 @@ func WithdrawSd(c *cli.Context) error { if err != nil { return err } - if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(amountWei) <= 0 { + if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(amountWei) > 0 { confirm := cliutils.Confirm(fmt.Sprintf("You have an existing Utilization Position of %.6f SD. The excess SD collateral you are trying to withdraw will be used to repay the utilized SD.\n Do you wish to proceed? [y/n]", math.RoundDown(eth.WeiToEth(sdStatusResponse.SDStatus.SdUtilizerLatestBalance), 6))) if !confirm { fmt.Println("Cancelled.") From 0aed4f8648951aa64963a0ffa057cfab75edbae0 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Mon, 11 Dec 2023 11:37:12 +0700 Subject: [PATCH 051/159] Calculate max SD can utilize --- abis/SDUtilityPool.abi.json | 1197 ++++++++- stader-lib/contracts/sd-utility.go | 3897 +++++++++++++++++++++++----- stader-lib/sdutility/sd-utility.go | 17 + stader/api/validator/deposit.go | 6 +- 4 files changed, 4393 insertions(+), 724 deletions(-) diff --git a/abis/SDUtilityPool.abi.json b/abis/SDUtilityPool.abi.json index 92be5ffd9..aa951f317 100644 --- a/abis/SDUtilityPool.abi.json +++ b/abis/SDUtilityPool.abi.json @@ -1,16 +1,84 @@ [ - { "inputs": [], "name": "AccrualBlockNumberNotLatest", "type": "error" }, - { "inputs": [], "name": "CallerNotAuthorizedToRedeem", "type": "error" }, - { "inputs": [], "name": "CannotFindRequestId", "type": "error" }, - { "inputs": [], "name": "InsufficientPoolBalance", "type": "error" }, - { "inputs": [], "name": "InvalidAmountOfWithdraw", "type": "error" }, - { "inputs": [], "name": "InvalidInput", "type": "error" }, - { "inputs": [], "name": "InvalidWithdrawAmount", "type": "error" }, + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AccrualBlockNumberNotLatest", + "type": "error" + }, + { + "inputs": [], + "name": "AlreadyClaimed", + "type": "error" + }, + { + "inputs": [], + "name": "AlreadyLiquidated", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotAuthorizedToRedeem", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotManager", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotStaderContract", + "type": "error" + }, + { + "inputs": [], + "name": "CannotFindRequestId", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientPoolBalance", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAmountOfWithdraw", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidInput", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidWithdrawAmount", + "type": "error" + }, { "inputs": [], "name": "MaxLimitOnWithdrawRequestCountReached", "type": "error" }, + { + "inputs": [], + "name": "NotClaimable", + "type": "error" + }, + { + "inputs": [], + "name": "NotLiquidatable", + "type": "error" + }, + { + "inputs": [], + "name": "NotLiquidator", + "type": "error" + }, { "inputs": [ { @@ -22,9 +90,26 @@ "name": "RequestIdNotFinalized", "type": "error" }, - { "inputs": [], "name": "SDTransferFailed", "type": "error" }, - { "inputs": [], "name": "SDUtilizeLimitReached", "type": "error" }, - { "inputs": [], "name": "UndelegationPeriodNotPassed", "type": "error" }, + { + "inputs": [], + "name": "SDTransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "SDUtilizeLimitReached", + "type": "error" + }, + { + "inputs": [], + "name": "UndelegationPeriodNotPassed", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, { "anonymous": false, "inputs": [ @@ -113,6 +198,19 @@ "name": "FinalizedWithdrawRequest", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -150,6 +248,19 @@ "name": "LiquidationCall", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -226,6 +337,112 @@ "name": "RequestRedeemed", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "liquidationThreshold", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidationBonusPercent", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidationFeePercent", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "ltv", + "type": "uint256" + } + ], + "name": "RiskConfigUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -245,6 +462,19 @@ "name": "SDUtilized", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -376,86 +606,187 @@ }, { "inputs": [], - "name": "accrueFee", - "outputs": [], - "stateMutability": "nonpayable", + "name": "DECIMAL", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", "type": "function" }, { "inputs": [], - "name": "cTokenTotalSupply", + "name": "DEFAULT_ADMIN_ROLE", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } ], "stateMutability": "view", "type": "function" }, { - "inputs": [ + "inputs": [], + "name": "MAX_PROTOCOL_FEE", + "outputs": [ { "internalType": "uint256", - "name": "requestId", + "name": "", "type": "uint256" } ], - "name": "claim", - "outputs": [], - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { - "inputs": [ - { "internalType": "uint256", "name": "index", "type": "uint256" } + "inputs": [], + "name": "accrualBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], - "name": "claimLiquidation", - "outputs": [], - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { - "inputs": [ - { "internalType": "uint256", "name": "sdAmount", "type": "uint256" } - ], - "name": "delegate", + "inputs": [], + "name": "accrueFee", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { - "inputs": [ - { "internalType": "address", "name": "", "type": "address" } - ], - "name": "delegatorCTokenBalance", + "inputs": [], + "name": "accumulatedProtocolFee", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { - "inputs": [ - { "internalType": "address", "name": "", "type": "address" } - ], - "name": "delegatorWithdrawRequestedCTokenCount", + "inputs": [], + "name": "cTokenTotalSupply", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } - ], - "name": "delegatorWithdrawRequests", - "outputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "uint256", - "name": "amountOfCToken", + "name": "_requestId", "type": "uint256" - }, - { + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "claimLiquidation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "sdAmount", + "type": "uint256" + } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "delegatorCTokenBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "delegatorWithdrawRequestedCTokenCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "delegatorWithdrawRequests", + "outputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountOfCToken", + "type": "uint256" + }, + { "internalType": "uint256", "name": "sdExpected", "type": "uint256" @@ -478,7 +809,11 @@ "inputs": [], "name": "exchangeRateCurrent", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "nonpayable", "type": "function" @@ -487,7 +822,24 @@ "inputs": [], "name": "exchangeRateStored", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "finalizationBatchLimit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" @@ -503,7 +855,11 @@ "inputs": [], "name": "getDelegationRate", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" @@ -518,7 +874,11 @@ ], "name": "getDelegatorLatestSDBalance", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" @@ -527,14 +887,35 @@ "inputs": [], "name": "getLatestExchangeRate", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getLiquidationThreshold", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "getOperatorLiquidation", "outputs": [ @@ -576,121 +957,591 @@ "type": "tuple" } ], - "stateMutability": "view", + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "getOperatorTotalEth", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPoolAvailableSDBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_delegator", + "type": "address" + } + ], + "name": "getRequestIdsByDelegator", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getUserData", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "totalInterestSD", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalCollateralInSD", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "healthFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lockedEth", + "type": "uint256" + } + ], + "internalType": "struct UserData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_utilizer", + "type": "address" + } + ], + "name": "getUtilizerLatestBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_admin", + "type": "address" + }, + { + "internalType": "address", + "name": "_staderConfig", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "liquidationCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "liquidations", + "outputs": [ + { + "internalType": "uint256", + "name": "totalAmountInEth", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBonusInEth", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalFeeInEth", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isRepaid", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isClaimed", + "type": "bool" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxApproveSD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "maxETHWorthOfSDPerValidator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxNonRedeemedDelegatorRequestCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minBlockDelayToFinalizeRequest", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextRequestId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextRequestIdToFinalize", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poolUtilization", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "protocolFeeFactor", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repay", + "outputs": [ + { + "internalType": "uint256", + "name": "repaidAmount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", "type": "function" }, { - "inputs": [], - "name": "getPoolAvailableSDBalance", - "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } ], - "stateMutability": "view", + "name": "repayLiquidation", + "outputs": [], + "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "_owner", "type": "address" } + { + "internalType": "address", + "name": "utilizer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } ], - "name": "getRequestIdsByDelegator", + "name": "repayOnBehalf", "outputs": [ - { "internalType": "uint256[]", "name": "", "type": "uint256[]" } + { + "internalType": "uint256", + "name": "repaidAmount", + "type": "uint256" + } ], - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", - "name": "_utilizer", + "name": "", "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" } ], - "name": "getUtilizerLatestBalance", + "name": "requestIdsByDelegatorAddress", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "uint256", + "name": "_cTokenAmount", + "type": "uint256" + } ], - "name": "liquidationCall", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "maxApproveSD", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "poolUtilization", + "name": "requestWithdraw", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "_requestId", + "type": "uint256" + } ], - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", - "name": "repayAmount", + "name": "_sdAmount", "type": "uint256" } ], - "name": "repay", + "name": "requestWithdrawWithSDAmount", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "_requestId", + "type": "uint256" + } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } ], - "name": "repayLiquidation", + "name": "revokeRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { - "inputs": [ + "inputs": [], + "name": "riskConfig", + "outputs": [ { - "internalType": "address", - "name": "utilizer", - "type": "address" + "internalType": "uint256", + "name": "liquidationThreshold", + "type": "uint256" }, { "internalType": "uint256", - "name": "repayAmount", + "name": "liquidationBonusPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationFeePercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "ltv", "type": "uint256" } ], - "name": "repayOnBehalf", + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "sdRequestedForWithdraw", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { - "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "uint256", "name": "", "type": "uint256" } + "inputs": [], + "name": "sdReservedForClaim", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], - "name": "requestIdsByDelegatorAddress", + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "staderConfig", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "contract IStaderConfig", + "name": "", + "type": "address" + } ], "stateMutability": "view", "type": "function" @@ -698,26 +1549,52 @@ { "inputs": [ { - "internalType": "uint256", - "name": "cTokenAmount", - "type": "uint256" + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" } ], - "name": "requestWithdraw", + "name": "supportsInterface", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "bool", + "name": "", + "type": "bool" + } ], - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { - "inputs": [ - { "internalType": "uint256", "name": "sdAmount", "type": "uint256" } + "inputs": [], + "name": "totalUtilizedSD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], - "name": "requestWithdrawWithSDAmount", + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "undelegationPeriodInBlocks", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], "stateMutability": "nonpayable", "type": "function" }, @@ -749,7 +1626,11 @@ }, { "inputs": [ - { "internalType": "uint256", "name": "_count", "type": "uint256" } + { + "internalType": "uint256", + "name": "_count", + "type": "uint256" + } ], "name": "updateMaxNonRedeemedDelegatorRequestCount", "outputs": [], @@ -782,6 +1663,34 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "liquidationThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationBonusPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationFeePercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "ltv", + "type": "uint256" + } + ], + "name": "updateRiskConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -821,6 +1730,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "utilizationRatePerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -834,6 +1756,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "utilizeIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -859,29 +1794,49 @@ }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "utilizerBalanceCurrent", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "utilizerBalanceStored", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "", "type": "address" } + { + "internalType": "address", + "name": "", + "type": "address" + } ], "name": "utilizerData", "outputs": [ @@ -901,7 +1856,11 @@ }, { "inputs": [ - { "internalType": "uint256", "name": "_amount", "type": "uint256" } + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } ], "name": "withdrawProtocolFee", "outputs": [], diff --git a/stader-lib/contracts/sd-utility.go b/stader-lib/contracts/sd-utility.go index 51cbdb05e..1deb1cb7a 100644 --- a/stader-lib/contracts/sd-utility.go +++ b/stader-lib/contracts/sd-utility.go @@ -29,9 +29,27 @@ var ( _ = abi.ConvertType ) +// OperatorLiquidation is an auto generated low-level Go binding around an user-defined struct. +type OperatorLiquidation struct { + TotalAmountInEth *big.Int + TotalBonusInEth *big.Int + TotalFeeInEth *big.Int + IsRepaid bool + IsClaimed bool + Liquidator common.Address +} + +// UserData is an auto generated low-level Go binding around an user-defined struct. +type UserData struct { + TotalInterestSD *big.Int + TotalCollateralInSD *big.Int + HealthFactor *big.Int + LockedEth *big.Int +} + // SDUtilityPoolMetaData contains all meta data concerning the SDUtilityPool contract. var SDUtilityPoolMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"AccrualBlockNumberNotLatest\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotAuthorizedToRedeem\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotFindRequestId\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientPoolBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAmountOfWithdraw\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxLimitOnWithdrawRequestCountReached\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"RequestIdNotFinalized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDUtilizeLimitReached\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UndelegationPeriodNotPassed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAccumulated\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalProtocolFee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalUtilizedSD\",\"type\":\"uint256\"}],\"name\":\"AccruedFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXToMint\",\"type\":\"uint256\"}],\"name\":\"Delegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestIdToFinalize\",\"type\":\"uint256\"}],\"name\":\"FinalizedWithdrawRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"protocolFeeFactor\",\"type\":\"uint256\"}],\"name\":\"ProtocolFeeFactorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXAmount\",\"type\":\"uint256\"}],\"name\":\"Redeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"Repaid\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdToTransfer\",\"type\":\"uint256\"}],\"name\":\"RequestRedeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"SDUtilized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"finalizationBatchLimit\",\"type\":\"uint256\"}],\"name\":\"UpdatedFinalizationBatchLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxETHWorthOfSDPerValidator\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxETHWorthOfSDPerValidator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxNonRedeemedDelegatorRequestCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minBlockDelayToFinalizeRequest\",\"type\":\"uint256\"}],\"name\":\"UpdatedMinBlockDelayToFinalizeRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"undelegationPeriodInBlocks\",\"type\":\"uint256\"}],\"name\":\"UpdatedUndelegationPeriodInBlocks\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizationRatePerBlock\",\"type\":\"uint256\"}],\"name\":\"UtilizationRatePerBlockUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"slashSDAmount\",\"type\":\"uint256\"}],\"name\":\"UtilizerSDSlashingHandled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmountToWithdraw\",\"type\":\"uint256\"}],\"name\":\"WithdrawRequestReceived\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"accrueFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cTokenTotalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"delegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"delegatorCTokenBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"delegatorWithdrawRequests\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountOfCToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdExpected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdFinalized\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finalizeDelegatorWithdrawalRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDelegationRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_delegator\",\"type\":\"address\"}],\"name\":\"getDelegatorLatestSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLatestExchangeRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPoolAvailableSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"getRequestIdsByDelegator\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_utilizer\",\"type\":\"address\"}],\"name\":\"getUtilizerLatestBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_utilizer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_slashSDAmount\",\"type\":\"uint256\"}],\"name\":\"handleUtilizerSDSlashing\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"liquidationCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxApproveSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"poolUtilization\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repay\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repayOnBehalf\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"requestIdsByDelegatorAddress\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"cTokenAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdrawWithSDAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"utilize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonTerminalKeyCount\",\"type\":\"uint256\"}],\"name\":\"utilizeWhileAddingKeys\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"utilizerData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"principal\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"utilizeIndex\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AccrualBlockNumberNotLatest\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyClaimed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyLiquidated\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotAuthorizedToRedeem\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotManager\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotStaderContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotFindRequestId\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientPoolBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAmountOfWithdraw\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInput\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidWithdrawAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxLimitOnWithdrawRequestCountReached\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotClaimable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotLiquidatable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotLiquidator\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"RequestIdNotFinalized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDUtilizeLimitReached\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UndelegationPeriodNotPassed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAccumulated\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalProtocolFee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalUtilizedSD\",\"type\":\"uint256\"}],\"name\":\"AccruedFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationBonusInEth\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationFeeInEth\",\"type\":\"uint256\"}],\"name\":\"ClaimedLiquidation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXToMint\",\"type\":\"uint256\"}],\"name\":\"Delegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestIdToFinalize\",\"type\":\"uint256\"}],\"name\":\"FinalizedWithdrawRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalLiquidationAmountInEth\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationBonusInEth\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationFeeInEth\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"name\":\"LiquidationCall\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"protocolFeeFactor\",\"type\":\"uint256\"}],\"name\":\"ProtocolFeeFactorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXAmount\",\"type\":\"uint256\"}],\"name\":\"Redeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"Repaid\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdToTransfer\",\"type\":\"uint256\"}],\"name\":\"RequestRedeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationThreshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationBonusPercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationFeePercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ltv\",\"type\":\"uint256\"}],\"name\":\"RiskConfigUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"SDUtilized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"finalizationBatchLimit\",\"type\":\"uint256\"}],\"name\":\"UpdatedFinalizationBatchLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxETHWorthOfSDPerValidator\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxETHWorthOfSDPerValidator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxNonRedeemedDelegatorRequestCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minBlockDelayToFinalizeRequest\",\"type\":\"uint256\"}],\"name\":\"UpdatedMinBlockDelayToFinalizeRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"undelegationPeriodInBlocks\",\"type\":\"uint256\"}],\"name\":\"UpdatedUndelegationPeriodInBlocks\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizationRatePerBlock\",\"type\":\"uint256\"}],\"name\":\"UtilizationRatePerBlockUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmountToWithdraw\",\"type\":\"uint256\"}],\"name\":\"WithdrawRequestReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"WithdrawnProtocolFee\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DECIMAL\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_PROTOCOL_FEE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accrualBlockNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accrueFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accumulatedProtocolFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cTokenTotalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_requestId\",\"type\":\"uint256\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"claimLiquidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"delegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"delegatorCTokenBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"delegatorWithdrawRequestedCTokenCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"delegatorWithdrawRequests\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountOfCToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdExpected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdFinalized\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finalizationBatchLimit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finalizeDelegatorWithdrawalRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDelegationRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_delegator\",\"type\":\"address\"}],\"name\":\"getDelegatorLatestSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLatestExchangeRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLiquidationThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getOperatorLiquidation\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"totalAmountInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalBonusInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalFeeInEth\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isRepaid\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"isClaimed\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"internalType\":\"structOperatorLiquidation\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"getOperatorTotalEth\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPoolAvailableSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_delegator\",\"type\":\"address\"}],\"name\":\"getRequestIdsByDelegator\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getUserData\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"totalInterestSD\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalCollateralInSD\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"healthFactor\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lockedEth\",\"type\":\"uint256\"}],\"internalType\":\"structUserData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_utilizer\",\"type\":\"address\"}],\"name\":\"getUtilizerLatestBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"liquidationCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"liquidations\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"totalAmountInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalBonusInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalFeeInEth\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isRepaid\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"isClaimed\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxApproveSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxETHWorthOfSDPerValidator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxNonRedeemedDelegatorRequestCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minBlockDelayToFinalizeRequest\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextRequestId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextRequestIdToFinalize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"poolUtilization\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"protocolFeeFactor\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repay\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"repaidAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"repayLiquidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repayOnBehalf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"repaidAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"requestIdsByDelegatorAddress\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_cTokenAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_requestId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_sdAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdrawWithSDAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_requestId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"riskConfig\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"liquidationThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"liquidationBonusPercent\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"liquidationFeePercent\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"ltv\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sdRequestedForWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sdReservedForClaim\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"staderConfig\",\"outputs\":[{\"internalType\":\"contractIStaderConfig\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalUtilizedSD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"undelegationPeriodInBlocks\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_finalizationBatchLimit\",\"type\":\"uint256\"}],\"name\":\"updateFinalizationBatchLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxETHWorthOfSDPerValidator\",\"type\":\"uint256\"}],\"name\":\"updateMaxETHWorthOfSDPerValidator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"name\":\"updateMaxNonRedeemedDelegatorRequestCount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minBlockDelayToFinalizeRequest\",\"type\":\"uint256\"}],\"name\":\"updateMinBlockDelayToFinalizeRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_protocolFeeFactor\",\"type\":\"uint256\"}],\"name\":\"updateProtocolFeeFactor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"liquidationThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"liquidationBonusPercent\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"liquidationFeePercent\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"ltv\",\"type\":\"uint256\"}],\"name\":\"updateRiskConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_undelegationPeriodInBlocks\",\"type\":\"uint256\"}],\"name\":\"updateUndelegationPeriodInBlocks\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_utilizationRatePerBlock\",\"type\":\"uint256\"}],\"name\":\"updateUtilizationRatePerBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"utilizationRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"utilize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"utilizeIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonTerminalKeyCount\",\"type\":\"uint256\"}],\"name\":\"utilizeWhileAddingKeys\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"utilizerData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"principal\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"utilizeIndex\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdrawProtocolFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // SDUtilityPoolABI is the input ABI used to generate the binding from. @@ -180,6 +198,161 @@ func (_SDUtilityPool *SDUtilityPoolTransactorRaw) Transact(opts *bind.TransactOp return _SDUtilityPool.Contract.contract.Transact(opts, method, params...) } +// DECIMAL is a free data retrieval call binding the contract method 0x6ab55fd9. +// +// Solidity: function DECIMAL() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) DECIMAL(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "DECIMAL") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// DECIMAL is a free data retrieval call binding the contract method 0x6ab55fd9. +// +// Solidity: function DECIMAL() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) DECIMAL() (*big.Int, error) { + return _SDUtilityPool.Contract.DECIMAL(&_SDUtilityPool.CallOpts) +} + +// DECIMAL is a free data retrieval call binding the contract method 0x6ab55fd9. +// +// Solidity: function DECIMAL() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) DECIMAL() (*big.Int, error) { + return _SDUtilityPool.Contract.DECIMAL(&_SDUtilityPool.CallOpts) +} + +// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. +// +// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) +func (_SDUtilityPool *SDUtilityPoolCaller) DEFAULTADMINROLE(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "DEFAULT_ADMIN_ROLE") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. +// +// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) +func (_SDUtilityPool *SDUtilityPoolSession) DEFAULTADMINROLE() ([32]byte, error) { + return _SDUtilityPool.Contract.DEFAULTADMINROLE(&_SDUtilityPool.CallOpts) +} + +// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. +// +// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) +func (_SDUtilityPool *SDUtilityPoolCallerSession) DEFAULTADMINROLE() ([32]byte, error) { + return _SDUtilityPool.Contract.DEFAULTADMINROLE(&_SDUtilityPool.CallOpts) +} + +// MAXPROTOCOLFEE is a free data retrieval call binding the contract method 0xb8ca3b83. +// +// Solidity: function MAX_PROTOCOL_FEE() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) MAXPROTOCOLFEE(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "MAX_PROTOCOL_FEE") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MAXPROTOCOLFEE is a free data retrieval call binding the contract method 0xb8ca3b83. +// +// Solidity: function MAX_PROTOCOL_FEE() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) MAXPROTOCOLFEE() (*big.Int, error) { + return _SDUtilityPool.Contract.MAXPROTOCOLFEE(&_SDUtilityPool.CallOpts) +} + +// MAXPROTOCOLFEE is a free data retrieval call binding the contract method 0xb8ca3b83. +// +// Solidity: function MAX_PROTOCOL_FEE() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) MAXPROTOCOLFEE() (*big.Int, error) { + return _SDUtilityPool.Contract.MAXPROTOCOLFEE(&_SDUtilityPool.CallOpts) +} + +// AccrualBlockNumber is a free data retrieval call binding the contract method 0x6c540baf. +// +// Solidity: function accrualBlockNumber() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) AccrualBlockNumber(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "accrualBlockNumber") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// AccrualBlockNumber is a free data retrieval call binding the contract method 0x6c540baf. +// +// Solidity: function accrualBlockNumber() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) AccrualBlockNumber() (*big.Int, error) { + return _SDUtilityPool.Contract.AccrualBlockNumber(&_SDUtilityPool.CallOpts) +} + +// AccrualBlockNumber is a free data retrieval call binding the contract method 0x6c540baf. +// +// Solidity: function accrualBlockNumber() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) AccrualBlockNumber() (*big.Int, error) { + return _SDUtilityPool.Contract.AccrualBlockNumber(&_SDUtilityPool.CallOpts) +} + +// AccumulatedProtocolFee is a free data retrieval call binding the contract method 0xa544a62c. +// +// Solidity: function accumulatedProtocolFee() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) AccumulatedProtocolFee(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "accumulatedProtocolFee") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// AccumulatedProtocolFee is a free data retrieval call binding the contract method 0xa544a62c. +// +// Solidity: function accumulatedProtocolFee() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) AccumulatedProtocolFee() (*big.Int, error) { + return _SDUtilityPool.Contract.AccumulatedProtocolFee(&_SDUtilityPool.CallOpts) +} + +// AccumulatedProtocolFee is a free data retrieval call binding the contract method 0xa544a62c. +// +// Solidity: function accumulatedProtocolFee() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) AccumulatedProtocolFee() (*big.Int, error) { + return _SDUtilityPool.Contract.AccumulatedProtocolFee(&_SDUtilityPool.CallOpts) +} + // CTokenTotalSupply is a free data retrieval call binding the contract method 0x37a4adf7. // // Solidity: function cTokenTotalSupply() view returns(uint256) @@ -242,6 +415,37 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) DelegatorCTokenBalance(arg0 co return _SDUtilityPool.Contract.DelegatorCTokenBalance(&_SDUtilityPool.CallOpts, arg0) } +// DelegatorWithdrawRequestedCTokenCount is a free data retrieval call binding the contract method 0x4f8f7a37. +// +// Solidity: function delegatorWithdrawRequestedCTokenCount(address ) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) DelegatorWithdrawRequestedCTokenCount(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "delegatorWithdrawRequestedCTokenCount", arg0) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// DelegatorWithdrawRequestedCTokenCount is a free data retrieval call binding the contract method 0x4f8f7a37. +// +// Solidity: function delegatorWithdrawRequestedCTokenCount(address ) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) DelegatorWithdrawRequestedCTokenCount(arg0 common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.DelegatorWithdrawRequestedCTokenCount(&_SDUtilityPool.CallOpts, arg0) +} + +// DelegatorWithdrawRequestedCTokenCount is a free data retrieval call binding the contract method 0x4f8f7a37. +// +// Solidity: function delegatorWithdrawRequestedCTokenCount(address ) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) DelegatorWithdrawRequestedCTokenCount(arg0 common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.DelegatorWithdrawRequestedCTokenCount(&_SDUtilityPool.CallOpts, arg0) +} + // DelegatorWithdrawRequests is a free data retrieval call binding the contract method 0xe41b55d9. // // Solidity: function delegatorWithdrawRequests(uint256 ) view returns(address owner, uint256 amountOfCToken, uint256 sdExpected, uint256 sdFinalized, uint256 requestBlock) @@ -333,6 +537,37 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) ExchangeRateStored() (*big.Int return _SDUtilityPool.Contract.ExchangeRateStored(&_SDUtilityPool.CallOpts) } +// FinalizationBatchLimit is a free data retrieval call binding the contract method 0x6f2bd0b2. +// +// Solidity: function finalizationBatchLimit() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) FinalizationBatchLimit(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "finalizationBatchLimit") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// FinalizationBatchLimit is a free data retrieval call binding the contract method 0x6f2bd0b2. +// +// Solidity: function finalizationBatchLimit() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) FinalizationBatchLimit() (*big.Int, error) { + return _SDUtilityPool.Contract.FinalizationBatchLimit(&_SDUtilityPool.CallOpts) +} + +// FinalizationBatchLimit is a free data retrieval call binding the contract method 0x6f2bd0b2. +// +// Solidity: function finalizationBatchLimit() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) FinalizationBatchLimit() (*big.Int, error) { + return _SDUtilityPool.Contract.FinalizationBatchLimit(&_SDUtilityPool.CallOpts) +} + // GetDelegationRate is a free data retrieval call binding the contract method 0x0c7e5c23. // // Solidity: function getDelegationRate() view returns(uint256) @@ -426,12 +661,12 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) GetLatestExchangeRate() (*big. return _SDUtilityPool.Contract.GetLatestExchangeRate(&_SDUtilityPool.CallOpts) } -// GetPoolAvailableSDBalance is a free data retrieval call binding the contract method 0xda695857. +// GetLiquidationThreshold is a free data retrieval call binding the contract method 0x4ae9b8bc. // -// Solidity: function getPoolAvailableSDBalance() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) GetPoolAvailableSDBalance(opts *bind.CallOpts) (*big.Int, error) { +// Solidity: function getLiquidationThreshold() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) GetLiquidationThreshold(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "getPoolAvailableSDBalance") + err := _SDUtilityPool.contract.Call(opts, &out, "getLiquidationThreshold") if err != nil { return *new(*big.Int), err @@ -443,57 +678,57 @@ func (_SDUtilityPool *SDUtilityPoolCaller) GetPoolAvailableSDBalance(opts *bind. } -// GetPoolAvailableSDBalance is a free data retrieval call binding the contract method 0xda695857. +// GetLiquidationThreshold is a free data retrieval call binding the contract method 0x4ae9b8bc. // -// Solidity: function getPoolAvailableSDBalance() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) GetPoolAvailableSDBalance() (*big.Int, error) { - return _SDUtilityPool.Contract.GetPoolAvailableSDBalance(&_SDUtilityPool.CallOpts) +// Solidity: function getLiquidationThreshold() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) GetLiquidationThreshold() (*big.Int, error) { + return _SDUtilityPool.Contract.GetLiquidationThreshold(&_SDUtilityPool.CallOpts) } -// GetPoolAvailableSDBalance is a free data retrieval call binding the contract method 0xda695857. +// GetLiquidationThreshold is a free data retrieval call binding the contract method 0x4ae9b8bc. // -// Solidity: function getPoolAvailableSDBalance() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) GetPoolAvailableSDBalance() (*big.Int, error) { - return _SDUtilityPool.Contract.GetPoolAvailableSDBalance(&_SDUtilityPool.CallOpts) +// Solidity: function getLiquidationThreshold() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetLiquidationThreshold() (*big.Int, error) { + return _SDUtilityPool.Contract.GetLiquidationThreshold(&_SDUtilityPool.CallOpts) } -// GetRequestIdsByDelegator is a free data retrieval call binding the contract method 0x99775f40. +// GetOperatorLiquidation is a free data retrieval call binding the contract method 0x12372ffe. // -// Solidity: function getRequestIdsByDelegator(address _owner) view returns(uint256[]) -func (_SDUtilityPool *SDUtilityPoolCaller) GetRequestIdsByDelegator(opts *bind.CallOpts, _owner common.Address) ([]*big.Int, error) { +// Solidity: function getOperatorLiquidation(address account) view returns((uint256,uint256,uint256,bool,bool,address)) +func (_SDUtilityPool *SDUtilityPoolCaller) GetOperatorLiquidation(opts *bind.CallOpts, account common.Address) (OperatorLiquidation, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "getRequestIdsByDelegator", _owner) + err := _SDUtilityPool.contract.Call(opts, &out, "getOperatorLiquidation", account) if err != nil { - return *new([]*big.Int), err + return *new(OperatorLiquidation), err } - out0 := *abi.ConvertType(out[0], new([]*big.Int)).(*[]*big.Int) + out0 := *abi.ConvertType(out[0], new(OperatorLiquidation)).(*OperatorLiquidation) return out0, err } -// GetRequestIdsByDelegator is a free data retrieval call binding the contract method 0x99775f40. +// GetOperatorLiquidation is a free data retrieval call binding the contract method 0x12372ffe. // -// Solidity: function getRequestIdsByDelegator(address _owner) view returns(uint256[]) -func (_SDUtilityPool *SDUtilityPoolSession) GetRequestIdsByDelegator(_owner common.Address) ([]*big.Int, error) { - return _SDUtilityPool.Contract.GetRequestIdsByDelegator(&_SDUtilityPool.CallOpts, _owner) +// Solidity: function getOperatorLiquidation(address account) view returns((uint256,uint256,uint256,bool,bool,address)) +func (_SDUtilityPool *SDUtilityPoolSession) GetOperatorLiquidation(account common.Address) (OperatorLiquidation, error) { + return _SDUtilityPool.Contract.GetOperatorLiquidation(&_SDUtilityPool.CallOpts, account) } -// GetRequestIdsByDelegator is a free data retrieval call binding the contract method 0x99775f40. +// GetOperatorLiquidation is a free data retrieval call binding the contract method 0x12372ffe. // -// Solidity: function getRequestIdsByDelegator(address _owner) view returns(uint256[]) -func (_SDUtilityPool *SDUtilityPoolCallerSession) GetRequestIdsByDelegator(_owner common.Address) ([]*big.Int, error) { - return _SDUtilityPool.Contract.GetRequestIdsByDelegator(&_SDUtilityPool.CallOpts, _owner) +// Solidity: function getOperatorLiquidation(address account) view returns((uint256,uint256,uint256,bool,bool,address)) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetOperatorLiquidation(account common.Address) (OperatorLiquidation, error) { + return _SDUtilityPool.Contract.GetOperatorLiquidation(&_SDUtilityPool.CallOpts, account) } -// GetUtilizerLatestBalance is a free data retrieval call binding the contract method 0x36978412. +// GetOperatorTotalEth is a free data retrieval call binding the contract method 0x2170c14c. // -// Solidity: function getUtilizerLatestBalance(address _utilizer) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) GetUtilizerLatestBalance(opts *bind.CallOpts, _utilizer common.Address) (*big.Int, error) { +// Solidity: function getOperatorTotalEth(address operator) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) GetOperatorTotalEth(opts *bind.CallOpts, operator common.Address) (*big.Int, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "getUtilizerLatestBalance", _utilizer) + err := _SDUtilityPool.contract.Call(opts, &out, "getOperatorTotalEth", operator) if err != nil { return *new(*big.Int), err @@ -505,26 +740,26 @@ func (_SDUtilityPool *SDUtilityPoolCaller) GetUtilizerLatestBalance(opts *bind.C } -// GetUtilizerLatestBalance is a free data retrieval call binding the contract method 0x36978412. +// GetOperatorTotalEth is a free data retrieval call binding the contract method 0x2170c14c. // -// Solidity: function getUtilizerLatestBalance(address _utilizer) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) GetUtilizerLatestBalance(_utilizer common.Address) (*big.Int, error) { - return _SDUtilityPool.Contract.GetUtilizerLatestBalance(&_SDUtilityPool.CallOpts, _utilizer) +// Solidity: function getOperatorTotalEth(address operator) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) GetOperatorTotalEth(operator common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.GetOperatorTotalEth(&_SDUtilityPool.CallOpts, operator) } -// GetUtilizerLatestBalance is a free data retrieval call binding the contract method 0x36978412. +// GetOperatorTotalEth is a free data retrieval call binding the contract method 0x2170c14c. // -// Solidity: function getUtilizerLatestBalance(address _utilizer) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) GetUtilizerLatestBalance(_utilizer common.Address) (*big.Int, error) { - return _SDUtilityPool.Contract.GetUtilizerLatestBalance(&_SDUtilityPool.CallOpts, _utilizer) +// Solidity: function getOperatorTotalEth(address operator) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetOperatorTotalEth(operator common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.GetOperatorTotalEth(&_SDUtilityPool.CallOpts, operator) } -// PoolUtilization is a free data retrieval call binding the contract method 0x9a3263ee. +// GetPoolAvailableSDBalance is a free data retrieval call binding the contract method 0xda695857. // -// Solidity: function poolUtilization() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) PoolUtilization(opts *bind.CallOpts) (*big.Int, error) { +// Solidity: function getPoolAvailableSDBalance() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) GetPoolAvailableSDBalance(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "poolUtilization") + err := _SDUtilityPool.contract.Call(opts, &out, "getPoolAvailableSDBalance") if err != nil { return *new(*big.Int), err @@ -536,445 +771,2841 @@ func (_SDUtilityPool *SDUtilityPoolCaller) PoolUtilization(opts *bind.CallOpts) } -// PoolUtilization is a free data retrieval call binding the contract method 0x9a3263ee. +// GetPoolAvailableSDBalance is a free data retrieval call binding the contract method 0xda695857. // -// Solidity: function poolUtilization() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) PoolUtilization() (*big.Int, error) { - return _SDUtilityPool.Contract.PoolUtilization(&_SDUtilityPool.CallOpts) +// Solidity: function getPoolAvailableSDBalance() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) GetPoolAvailableSDBalance() (*big.Int, error) { + return _SDUtilityPool.Contract.GetPoolAvailableSDBalance(&_SDUtilityPool.CallOpts) } -// PoolUtilization is a free data retrieval call binding the contract method 0x9a3263ee. +// GetPoolAvailableSDBalance is a free data retrieval call binding the contract method 0xda695857. // -// Solidity: function poolUtilization() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) PoolUtilization() (*big.Int, error) { - return _SDUtilityPool.Contract.PoolUtilization(&_SDUtilityPool.CallOpts) +// Solidity: function getPoolAvailableSDBalance() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetPoolAvailableSDBalance() (*big.Int, error) { + return _SDUtilityPool.Contract.GetPoolAvailableSDBalance(&_SDUtilityPool.CallOpts) } -// RequestIdsByDelegatorAddress is a free data retrieval call binding the contract method 0x7844e3af. +// GetRequestIdsByDelegator is a free data retrieval call binding the contract method 0x99775f40. // -// Solidity: function requestIdsByDelegatorAddress(address , uint256 ) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) RequestIdsByDelegatorAddress(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (*big.Int, error) { +// Solidity: function getRequestIdsByDelegator(address _delegator) view returns(uint256[]) +func (_SDUtilityPool *SDUtilityPoolCaller) GetRequestIdsByDelegator(opts *bind.CallOpts, _delegator common.Address) ([]*big.Int, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "requestIdsByDelegatorAddress", arg0, arg1) + err := _SDUtilityPool.contract.Call(opts, &out, "getRequestIdsByDelegator", _delegator) if err != nil { - return *new(*big.Int), err + return *new([]*big.Int), err } - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + out0 := *abi.ConvertType(out[0], new([]*big.Int)).(*[]*big.Int) return out0, err } -// RequestIdsByDelegatorAddress is a free data retrieval call binding the contract method 0x7844e3af. +// GetRequestIdsByDelegator is a free data retrieval call binding the contract method 0x99775f40. // -// Solidity: function requestIdsByDelegatorAddress(address , uint256 ) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) RequestIdsByDelegatorAddress(arg0 common.Address, arg1 *big.Int) (*big.Int, error) { - return _SDUtilityPool.Contract.RequestIdsByDelegatorAddress(&_SDUtilityPool.CallOpts, arg0, arg1) +// Solidity: function getRequestIdsByDelegator(address _delegator) view returns(uint256[]) +func (_SDUtilityPool *SDUtilityPoolSession) GetRequestIdsByDelegator(_delegator common.Address) ([]*big.Int, error) { + return _SDUtilityPool.Contract.GetRequestIdsByDelegator(&_SDUtilityPool.CallOpts, _delegator) } -// RequestIdsByDelegatorAddress is a free data retrieval call binding the contract method 0x7844e3af. +// GetRequestIdsByDelegator is a free data retrieval call binding the contract method 0x99775f40. // -// Solidity: function requestIdsByDelegatorAddress(address , uint256 ) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) RequestIdsByDelegatorAddress(arg0 common.Address, arg1 *big.Int) (*big.Int, error) { - return _SDUtilityPool.Contract.RequestIdsByDelegatorAddress(&_SDUtilityPool.CallOpts, arg0, arg1) +// Solidity: function getRequestIdsByDelegator(address _delegator) view returns(uint256[]) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetRequestIdsByDelegator(_delegator common.Address) ([]*big.Int, error) { + return _SDUtilityPool.Contract.GetRequestIdsByDelegator(&_SDUtilityPool.CallOpts, _delegator) } -// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. +// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. // -// Solidity: function utilizerBalanceStored(address account) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) UtilizerBalanceStored(opts *bind.CallOpts, account common.Address) (*big.Int, error) { +// Solidity: function getRoleAdmin(bytes32 role) view returns(bytes32) +func (_SDUtilityPool *SDUtilityPoolCaller) GetRoleAdmin(opts *bind.CallOpts, role [32]byte) ([32]byte, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "utilizerBalanceStored", account) + err := _SDUtilityPool.contract.Call(opts, &out, "getRoleAdmin", role) if err != nil { - return *new(*big.Int), err + return *new([32]byte), err } - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) return out0, err } -// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. +// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. // -// Solidity: function utilizerBalanceStored(address account) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) UtilizerBalanceStored(account common.Address) (*big.Int, error) { - return _SDUtilityPool.Contract.UtilizerBalanceStored(&_SDUtilityPool.CallOpts, account) +// Solidity: function getRoleAdmin(bytes32 role) view returns(bytes32) +func (_SDUtilityPool *SDUtilityPoolSession) GetRoleAdmin(role [32]byte) ([32]byte, error) { + return _SDUtilityPool.Contract.GetRoleAdmin(&_SDUtilityPool.CallOpts, role) } -// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. +// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. // -// Solidity: function utilizerBalanceStored(address account) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizerBalanceStored(account common.Address) (*big.Int, error) { - return _SDUtilityPool.Contract.UtilizerBalanceStored(&_SDUtilityPool.CallOpts, account) +// Solidity: function getRoleAdmin(bytes32 role) view returns(bytes32) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetRoleAdmin(role [32]byte) ([32]byte, error) { + return _SDUtilityPool.Contract.GetRoleAdmin(&_SDUtilityPool.CallOpts, role) } -// UtilizerData is a free data retrieval call binding the contract method 0x9e070088. +// GetUserData is a free data retrieval call binding the contract method 0xffc9896b. // -// Solidity: function utilizerData(address ) view returns(uint256 principal, uint256 utilizeIndex) -func (_SDUtilityPool *SDUtilityPoolCaller) UtilizerData(opts *bind.CallOpts, arg0 common.Address) (struct { - Principal *big.Int - UtilizeIndex *big.Int -}, error) { +// Solidity: function getUserData(address account) view returns((uint256,uint256,uint256,uint256)) +func (_SDUtilityPool *SDUtilityPoolCaller) GetUserData(opts *bind.CallOpts, account common.Address) (UserData, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "utilizerData", arg0) + err := _SDUtilityPool.contract.Call(opts, &out, "getUserData", account) - outstruct := new(struct { - Principal *big.Int - UtilizeIndex *big.Int - }) if err != nil { - return *outstruct, err + return *new(UserData), err } - outstruct.Principal = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - outstruct.UtilizeIndex = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + out0 := *abi.ConvertType(out[0], new(UserData)).(*UserData) - return *outstruct, err + return out0, err } -// UtilizerData is a free data retrieval call binding the contract method 0x9e070088. +// GetUserData is a free data retrieval call binding the contract method 0xffc9896b. // -// Solidity: function utilizerData(address ) view returns(uint256 principal, uint256 utilizeIndex) -func (_SDUtilityPool *SDUtilityPoolSession) UtilizerData(arg0 common.Address) (struct { - Principal *big.Int - UtilizeIndex *big.Int -}, error) { - return _SDUtilityPool.Contract.UtilizerData(&_SDUtilityPool.CallOpts, arg0) +// Solidity: function getUserData(address account) view returns((uint256,uint256,uint256,uint256)) +func (_SDUtilityPool *SDUtilityPoolSession) GetUserData(account common.Address) (UserData, error) { + return _SDUtilityPool.Contract.GetUserData(&_SDUtilityPool.CallOpts, account) } -// UtilizerData is a free data retrieval call binding the contract method 0x9e070088. +// GetUserData is a free data retrieval call binding the contract method 0xffc9896b. // -// Solidity: function utilizerData(address ) view returns(uint256 principal, uint256 utilizeIndex) -func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizerData(arg0 common.Address) (struct { - Principal *big.Int - UtilizeIndex *big.Int -}, error) { - return _SDUtilityPool.Contract.UtilizerData(&_SDUtilityPool.CallOpts, arg0) +// Solidity: function getUserData(address account) view returns((uint256,uint256,uint256,uint256)) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetUserData(account common.Address) (UserData, error) { + return _SDUtilityPool.Contract.GetUserData(&_SDUtilityPool.CallOpts, account) } -// AccrueFee is a paid mutator transaction binding the contract method 0xb26cc394. +// GetUtilizerLatestBalance is a free data retrieval call binding the contract method 0x36978412. // -// Solidity: function accrueFee() returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) AccrueFee(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "accrueFee") -} +// Solidity: function getUtilizerLatestBalance(address _utilizer) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) GetUtilizerLatestBalance(opts *bind.CallOpts, _utilizer common.Address) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "getUtilizerLatestBalance", _utilizer) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err -// AccrueFee is a paid mutator transaction binding the contract method 0xb26cc394. -// -// Solidity: function accrueFee() returns() -func (_SDUtilityPool *SDUtilityPoolSession) AccrueFee() (*types.Transaction, error) { - return _SDUtilityPool.Contract.AccrueFee(&_SDUtilityPool.TransactOpts) } -// AccrueFee is a paid mutator transaction binding the contract method 0xb26cc394. +// GetUtilizerLatestBalance is a free data retrieval call binding the contract method 0x36978412. // -// Solidity: function accrueFee() returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) AccrueFee() (*types.Transaction, error) { - return _SDUtilityPool.Contract.AccrueFee(&_SDUtilityPool.TransactOpts) +// Solidity: function getUtilizerLatestBalance(address _utilizer) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) GetUtilizerLatestBalance(_utilizer common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.GetUtilizerLatestBalance(&_SDUtilityPool.CallOpts, _utilizer) } -// Claim is a paid mutator transaction binding the contract method 0x379607f5. +// GetUtilizerLatestBalance is a free data retrieval call binding the contract method 0x36978412. // -// Solidity: function claim(uint256 requestId) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) Claim(opts *bind.TransactOpts, requestId *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "claim", requestId) +// Solidity: function getUtilizerLatestBalance(address _utilizer) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetUtilizerLatestBalance(_utilizer common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.GetUtilizerLatestBalance(&_SDUtilityPool.CallOpts, _utilizer) } -// Claim is a paid mutator transaction binding the contract method 0x379607f5. +// HasRole is a free data retrieval call binding the contract method 0x91d14854. // -// Solidity: function claim(uint256 requestId) returns() -func (_SDUtilityPool *SDUtilityPoolSession) Claim(requestId *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Claim(&_SDUtilityPool.TransactOpts, requestId) +// Solidity: function hasRole(bytes32 role, address account) view returns(bool) +func (_SDUtilityPool *SDUtilityPoolCaller) HasRole(opts *bind.CallOpts, role [32]byte, account common.Address) (bool, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "hasRole", role, account) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + } -// Claim is a paid mutator transaction binding the contract method 0x379607f5. +// HasRole is a free data retrieval call binding the contract method 0x91d14854. // -// Solidity: function claim(uint256 requestId) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) Claim(requestId *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Claim(&_SDUtilityPool.TransactOpts, requestId) +// Solidity: function hasRole(bytes32 role, address account) view returns(bool) +func (_SDUtilityPool *SDUtilityPoolSession) HasRole(role [32]byte, account common.Address) (bool, error) { + return _SDUtilityPool.Contract.HasRole(&_SDUtilityPool.CallOpts, role, account) } -// Delegate is a paid mutator transaction binding the contract method 0x9fa6dd35. +// HasRole is a free data retrieval call binding the contract method 0x91d14854. // -// Solidity: function delegate(uint256 sdAmount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) Delegate(opts *bind.TransactOpts, sdAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "delegate", sdAmount) +// Solidity: function hasRole(bytes32 role, address account) view returns(bool) +func (_SDUtilityPool *SDUtilityPoolCallerSession) HasRole(role [32]byte, account common.Address) (bool, error) { + return _SDUtilityPool.Contract.HasRole(&_SDUtilityPool.CallOpts, role, account) } -// Delegate is a paid mutator transaction binding the contract method 0x9fa6dd35. +// Liquidations is a free data retrieval call binding the contract method 0xa66c84f4. // -// Solidity: function delegate(uint256 sdAmount) returns() -func (_SDUtilityPool *SDUtilityPoolSession) Delegate(sdAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Delegate(&_SDUtilityPool.TransactOpts, sdAmount) +// Solidity: function liquidations(uint256 ) view returns(uint256 totalAmountInEth, uint256 totalBonusInEth, uint256 totalFeeInEth, bool isRepaid, bool isClaimed, address liquidator) +func (_SDUtilityPool *SDUtilityPoolCaller) Liquidations(opts *bind.CallOpts, arg0 *big.Int) (struct { + TotalAmountInEth *big.Int + TotalBonusInEth *big.Int + TotalFeeInEth *big.Int + IsRepaid bool + IsClaimed bool + Liquidator common.Address +}, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "liquidations", arg0) + + outstruct := new(struct { + TotalAmountInEth *big.Int + TotalBonusInEth *big.Int + TotalFeeInEth *big.Int + IsRepaid bool + IsClaimed bool + Liquidator common.Address + }) + if err != nil { + return *outstruct, err + } + + outstruct.TotalAmountInEth = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.TotalBonusInEth = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.TotalFeeInEth = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + outstruct.IsRepaid = *abi.ConvertType(out[3], new(bool)).(*bool) + outstruct.IsClaimed = *abi.ConvertType(out[4], new(bool)).(*bool) + outstruct.Liquidator = *abi.ConvertType(out[5], new(common.Address)).(*common.Address) + + return *outstruct, err + } -// Delegate is a paid mutator transaction binding the contract method 0x9fa6dd35. +// Liquidations is a free data retrieval call binding the contract method 0xa66c84f4. // -// Solidity: function delegate(uint256 sdAmount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) Delegate(sdAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Delegate(&_SDUtilityPool.TransactOpts, sdAmount) +// Solidity: function liquidations(uint256 ) view returns(uint256 totalAmountInEth, uint256 totalBonusInEth, uint256 totalFeeInEth, bool isRepaid, bool isClaimed, address liquidator) +func (_SDUtilityPool *SDUtilityPoolSession) Liquidations(arg0 *big.Int) (struct { + TotalAmountInEth *big.Int + TotalBonusInEth *big.Int + TotalFeeInEth *big.Int + IsRepaid bool + IsClaimed bool + Liquidator common.Address +}, error) { + return _SDUtilityPool.Contract.Liquidations(&_SDUtilityPool.CallOpts, arg0) } -// ExchangeRateCurrent is a paid mutator transaction binding the contract method 0xbd6d894d. +// Liquidations is a free data retrieval call binding the contract method 0xa66c84f4. // -// Solidity: function exchangeRateCurrent() returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactor) ExchangeRateCurrent(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "exchangeRateCurrent") +// Solidity: function liquidations(uint256 ) view returns(uint256 totalAmountInEth, uint256 totalBonusInEth, uint256 totalFeeInEth, bool isRepaid, bool isClaimed, address liquidator) +func (_SDUtilityPool *SDUtilityPoolCallerSession) Liquidations(arg0 *big.Int) (struct { + TotalAmountInEth *big.Int + TotalBonusInEth *big.Int + TotalFeeInEth *big.Int + IsRepaid bool + IsClaimed bool + Liquidator common.Address +}, error) { + return _SDUtilityPool.Contract.Liquidations(&_SDUtilityPool.CallOpts, arg0) } -// ExchangeRateCurrent is a paid mutator transaction binding the contract method 0xbd6d894d. +// MaxETHWorthOfSDPerValidator is a free data retrieval call binding the contract method 0x2807c313. // -// Solidity: function exchangeRateCurrent() returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) ExchangeRateCurrent() (*types.Transaction, error) { - return _SDUtilityPool.Contract.ExchangeRateCurrent(&_SDUtilityPool.TransactOpts) +// Solidity: function maxETHWorthOfSDPerValidator() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) MaxETHWorthOfSDPerValidator(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "maxETHWorthOfSDPerValidator") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + } -// ExchangeRateCurrent is a paid mutator transaction binding the contract method 0xbd6d894d. +// MaxETHWorthOfSDPerValidator is a free data retrieval call binding the contract method 0x2807c313. // -// Solidity: function exchangeRateCurrent() returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactorSession) ExchangeRateCurrent() (*types.Transaction, error) { - return _SDUtilityPool.Contract.ExchangeRateCurrent(&_SDUtilityPool.TransactOpts) +// Solidity: function maxETHWorthOfSDPerValidator() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) MaxETHWorthOfSDPerValidator() (*big.Int, error) { + return _SDUtilityPool.Contract.MaxETHWorthOfSDPerValidator(&_SDUtilityPool.CallOpts) } -// FinalizeDelegatorWithdrawalRequest is a paid mutator transaction binding the contract method 0x71898b4e. +// MaxETHWorthOfSDPerValidator is a free data retrieval call binding the contract method 0x2807c313. // -// Solidity: function finalizeDelegatorWithdrawalRequest() returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) FinalizeDelegatorWithdrawalRequest(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "finalizeDelegatorWithdrawalRequest") +// Solidity: function maxETHWorthOfSDPerValidator() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) MaxETHWorthOfSDPerValidator() (*big.Int, error) { + return _SDUtilityPool.Contract.MaxETHWorthOfSDPerValidator(&_SDUtilityPool.CallOpts) } -// FinalizeDelegatorWithdrawalRequest is a paid mutator transaction binding the contract method 0x71898b4e. +// MaxNonRedeemedDelegatorRequestCount is a free data retrieval call binding the contract method 0xc083f3e6. // -// Solidity: function finalizeDelegatorWithdrawalRequest() returns() -func (_SDUtilityPool *SDUtilityPoolSession) FinalizeDelegatorWithdrawalRequest() (*types.Transaction, error) { - return _SDUtilityPool.Contract.FinalizeDelegatorWithdrawalRequest(&_SDUtilityPool.TransactOpts) +// Solidity: function maxNonRedeemedDelegatorRequestCount() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) MaxNonRedeemedDelegatorRequestCount(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "maxNonRedeemedDelegatorRequestCount") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + } -// FinalizeDelegatorWithdrawalRequest is a paid mutator transaction binding the contract method 0x71898b4e. +// MaxNonRedeemedDelegatorRequestCount is a free data retrieval call binding the contract method 0xc083f3e6. // -// Solidity: function finalizeDelegatorWithdrawalRequest() returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) FinalizeDelegatorWithdrawalRequest() (*types.Transaction, error) { - return _SDUtilityPool.Contract.FinalizeDelegatorWithdrawalRequest(&_SDUtilityPool.TransactOpts) +// Solidity: function maxNonRedeemedDelegatorRequestCount() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) MaxNonRedeemedDelegatorRequestCount() (*big.Int, error) { + return _SDUtilityPool.Contract.MaxNonRedeemedDelegatorRequestCount(&_SDUtilityPool.CallOpts) } -// HandleUtilizerSDSlashing is a paid mutator transaction binding the contract method 0xfa72bf63. +// MaxNonRedeemedDelegatorRequestCount is a free data retrieval call binding the contract method 0xc083f3e6. // -// Solidity: function handleUtilizerSDSlashing(address _utilizer, uint256 _slashSDAmount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) HandleUtilizerSDSlashing(opts *bind.TransactOpts, _utilizer common.Address, _slashSDAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "handleUtilizerSDSlashing", _utilizer, _slashSDAmount) +// Solidity: function maxNonRedeemedDelegatorRequestCount() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) MaxNonRedeemedDelegatorRequestCount() (*big.Int, error) { + return _SDUtilityPool.Contract.MaxNonRedeemedDelegatorRequestCount(&_SDUtilityPool.CallOpts) } -// HandleUtilizerSDSlashing is a paid mutator transaction binding the contract method 0xfa72bf63. +// MinBlockDelayToFinalizeRequest is a free data retrieval call binding the contract method 0xbc1428f6. // -// Solidity: function handleUtilizerSDSlashing(address _utilizer, uint256 _slashSDAmount) returns() -func (_SDUtilityPool *SDUtilityPoolSession) HandleUtilizerSDSlashing(_utilizer common.Address, _slashSDAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.HandleUtilizerSDSlashing(&_SDUtilityPool.TransactOpts, _utilizer, _slashSDAmount) +// Solidity: function minBlockDelayToFinalizeRequest() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) MinBlockDelayToFinalizeRequest(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "minBlockDelayToFinalizeRequest") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + } -// HandleUtilizerSDSlashing is a paid mutator transaction binding the contract method 0xfa72bf63. +// MinBlockDelayToFinalizeRequest is a free data retrieval call binding the contract method 0xbc1428f6. // -// Solidity: function handleUtilizerSDSlashing(address _utilizer, uint256 _slashSDAmount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) HandleUtilizerSDSlashing(_utilizer common.Address, _slashSDAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.HandleUtilizerSDSlashing(&_SDUtilityPool.TransactOpts, _utilizer, _slashSDAmount) +// Solidity: function minBlockDelayToFinalizeRequest() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) MinBlockDelayToFinalizeRequest() (*big.Int, error) { + return _SDUtilityPool.Contract.MinBlockDelayToFinalizeRequest(&_SDUtilityPool.CallOpts) } -// LiquidationCall is a paid mutator transaction binding the contract method 0xd2ac4a3d. +// MinBlockDelayToFinalizeRequest is a free data retrieval call binding the contract method 0xbc1428f6. // -// Solidity: function liquidationCall(address account) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) LiquidationCall(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "liquidationCall", account) +// Solidity: function minBlockDelayToFinalizeRequest() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) MinBlockDelayToFinalizeRequest() (*big.Int, error) { + return _SDUtilityPool.Contract.MinBlockDelayToFinalizeRequest(&_SDUtilityPool.CallOpts) } -// LiquidationCall is a paid mutator transaction binding the contract method 0xd2ac4a3d. +// NextRequestId is a free data retrieval call binding the contract method 0x6a84a985. // -// Solidity: function liquidationCall(address account) returns() -func (_SDUtilityPool *SDUtilityPoolSession) LiquidationCall(account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.LiquidationCall(&_SDUtilityPool.TransactOpts, account) +// Solidity: function nextRequestId() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) NextRequestId(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "nextRequestId") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + } -// LiquidationCall is a paid mutator transaction binding the contract method 0xd2ac4a3d. +// NextRequestId is a free data retrieval call binding the contract method 0x6a84a985. // -// Solidity: function liquidationCall(address account) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) LiquidationCall(account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.LiquidationCall(&_SDUtilityPool.TransactOpts, account) +// Solidity: function nextRequestId() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) NextRequestId() (*big.Int, error) { + return _SDUtilityPool.Contract.NextRequestId(&_SDUtilityPool.CallOpts) } -// MaxApproveSD is a paid mutator transaction binding the contract method 0x3e04cd35. +// NextRequestId is a free data retrieval call binding the contract method 0x6a84a985. // -// Solidity: function maxApproveSD() returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) MaxApproveSD(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "maxApproveSD") +// Solidity: function nextRequestId() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) NextRequestId() (*big.Int, error) { + return _SDUtilityPool.Contract.NextRequestId(&_SDUtilityPool.CallOpts) } -// MaxApproveSD is a paid mutator transaction binding the contract method 0x3e04cd35. +// NextRequestIdToFinalize is a free data retrieval call binding the contract method 0xbbb84362. // -// Solidity: function maxApproveSD() returns() -func (_SDUtilityPool *SDUtilityPoolSession) MaxApproveSD() (*types.Transaction, error) { - return _SDUtilityPool.Contract.MaxApproveSD(&_SDUtilityPool.TransactOpts) +// Solidity: function nextRequestIdToFinalize() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) NextRequestIdToFinalize(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "nextRequestIdToFinalize") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + } -// MaxApproveSD is a paid mutator transaction binding the contract method 0x3e04cd35. +// NextRequestIdToFinalize is a free data retrieval call binding the contract method 0xbbb84362. // -// Solidity: function maxApproveSD() returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) MaxApproveSD() (*types.Transaction, error) { - return _SDUtilityPool.Contract.MaxApproveSD(&_SDUtilityPool.TransactOpts) +// Solidity: function nextRequestIdToFinalize() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) NextRequestIdToFinalize() (*big.Int, error) { + return _SDUtilityPool.Contract.NextRequestIdToFinalize(&_SDUtilityPool.CallOpts) } -// Repay is a paid mutator transaction binding the contract method 0x371fd8e6. +// NextRequestIdToFinalize is a free data retrieval call binding the contract method 0xbbb84362. // -// Solidity: function repay(uint256 repayAmount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) Repay(opts *bind.TransactOpts, repayAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "repay", repayAmount) +// Solidity: function nextRequestIdToFinalize() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) NextRequestIdToFinalize() (*big.Int, error) { + return _SDUtilityPool.Contract.NextRequestIdToFinalize(&_SDUtilityPool.CallOpts) } -// Repay is a paid mutator transaction binding the contract method 0x371fd8e6. +// Paused is a free data retrieval call binding the contract method 0x5c975abb. // -// Solidity: function repay(uint256 repayAmount) returns() -func (_SDUtilityPool *SDUtilityPoolSession) Repay(repayAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Repay(&_SDUtilityPool.TransactOpts, repayAmount) +// Solidity: function paused() view returns(bool) +func (_SDUtilityPool *SDUtilityPoolCaller) Paused(opts *bind.CallOpts) (bool, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "paused") + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + } -// Repay is a paid mutator transaction binding the contract method 0x371fd8e6. +// Paused is a free data retrieval call binding the contract method 0x5c975abb. // -// Solidity: function repay(uint256 repayAmount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) Repay(repayAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Repay(&_SDUtilityPool.TransactOpts, repayAmount) +// Solidity: function paused() view returns(bool) +func (_SDUtilityPool *SDUtilityPoolSession) Paused() (bool, error) { + return _SDUtilityPool.Contract.Paused(&_SDUtilityPool.CallOpts) } -// RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. +// Paused is a free data retrieval call binding the contract method 0x5c975abb. // -// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) RepayOnBehalf(opts *bind.TransactOpts, utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "repayOnBehalf", utilizer, repayAmount) +// Solidity: function paused() view returns(bool) +func (_SDUtilityPool *SDUtilityPoolCallerSession) Paused() (bool, error) { + return _SDUtilityPool.Contract.Paused(&_SDUtilityPool.CallOpts) } -// RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. +// PoolUtilization is a free data retrieval call binding the contract method 0x9a3263ee. // -// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns() -func (_SDUtilityPool *SDUtilityPoolSession) RepayOnBehalf(utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RepayOnBehalf(&_SDUtilityPool.TransactOpts, utilizer, repayAmount) +// Solidity: function poolUtilization() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) PoolUtilization(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "poolUtilization") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + } -// RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. +// PoolUtilization is a free data retrieval call binding the contract method 0x9a3263ee. // -// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) RepayOnBehalf(utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RepayOnBehalf(&_SDUtilityPool.TransactOpts, utilizer, repayAmount) +// Solidity: function poolUtilization() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) PoolUtilization() (*big.Int, error) { + return _SDUtilityPool.Contract.PoolUtilization(&_SDUtilityPool.CallOpts) } -// RequestWithdraw is a paid mutator transaction binding the contract method 0x745400c9. +// PoolUtilization is a free data retrieval call binding the contract method 0x9a3263ee. // -// Solidity: function requestWithdraw(uint256 cTokenAmount) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactor) RequestWithdraw(opts *bind.TransactOpts, cTokenAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "requestWithdraw", cTokenAmount) +// Solidity: function poolUtilization() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) PoolUtilization() (*big.Int, error) { + return _SDUtilityPool.Contract.PoolUtilization(&_SDUtilityPool.CallOpts) } -// RequestWithdraw is a paid mutator transaction binding the contract method 0x745400c9. +// ProtocolFeeFactor is a free data retrieval call binding the contract method 0x11e3bdde. // -// Solidity: function requestWithdraw(uint256 cTokenAmount) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) RequestWithdraw(cTokenAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RequestWithdraw(&_SDUtilityPool.TransactOpts, cTokenAmount) +// Solidity: function protocolFeeFactor() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) ProtocolFeeFactor(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "protocolFeeFactor") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + } -// RequestWithdraw is a paid mutator transaction binding the contract method 0x745400c9. +// ProtocolFeeFactor is a free data retrieval call binding the contract method 0x11e3bdde. // -// Solidity: function requestWithdraw(uint256 cTokenAmount) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactorSession) RequestWithdraw(cTokenAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RequestWithdraw(&_SDUtilityPool.TransactOpts, cTokenAmount) +// Solidity: function protocolFeeFactor() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) ProtocolFeeFactor() (*big.Int, error) { + return _SDUtilityPool.Contract.ProtocolFeeFactor(&_SDUtilityPool.CallOpts) } -// RequestWithdrawWithSDAmount is a paid mutator transaction binding the contract method 0xc51cd1cc. +// ProtocolFeeFactor is a free data retrieval call binding the contract method 0x11e3bdde. // -// Solidity: function requestWithdrawWithSDAmount(uint256 sdAmount) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactor) RequestWithdrawWithSDAmount(opts *bind.TransactOpts, sdAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "requestWithdrawWithSDAmount", sdAmount) +// Solidity: function protocolFeeFactor() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) ProtocolFeeFactor() (*big.Int, error) { + return _SDUtilityPool.Contract.ProtocolFeeFactor(&_SDUtilityPool.CallOpts) } -// RequestWithdrawWithSDAmount is a paid mutator transaction binding the contract method 0xc51cd1cc. +// RequestIdsByDelegatorAddress is a free data retrieval call binding the contract method 0x7844e3af. // -// Solidity: function requestWithdrawWithSDAmount(uint256 sdAmount) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) RequestWithdrawWithSDAmount(sdAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RequestWithdrawWithSDAmount(&_SDUtilityPool.TransactOpts, sdAmount) +// Solidity: function requestIdsByDelegatorAddress(address , uint256 ) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) RequestIdsByDelegatorAddress(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "requestIdsByDelegatorAddress", arg0, arg1) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + } -// RequestWithdrawWithSDAmount is a paid mutator transaction binding the contract method 0xc51cd1cc. +// RequestIdsByDelegatorAddress is a free data retrieval call binding the contract method 0x7844e3af. // -// Solidity: function requestWithdrawWithSDAmount(uint256 sdAmount) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactorSession) RequestWithdrawWithSDAmount(sdAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RequestWithdrawWithSDAmount(&_SDUtilityPool.TransactOpts, sdAmount) +// Solidity: function requestIdsByDelegatorAddress(address , uint256 ) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) RequestIdsByDelegatorAddress(arg0 common.Address, arg1 *big.Int) (*big.Int, error) { + return _SDUtilityPool.Contract.RequestIdsByDelegatorAddress(&_SDUtilityPool.CallOpts, arg0, arg1) } -// Utilize is a paid mutator transaction binding the contract method 0xec29c551. +// RequestIdsByDelegatorAddress is a free data retrieval call binding the contract method 0x7844e3af. // -// Solidity: function utilize(uint256 utilizeAmount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) Utilize(opts *bind.TransactOpts, utilizeAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "utilize", utilizeAmount) +// Solidity: function requestIdsByDelegatorAddress(address , uint256 ) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) RequestIdsByDelegatorAddress(arg0 common.Address, arg1 *big.Int) (*big.Int, error) { + return _SDUtilityPool.Contract.RequestIdsByDelegatorAddress(&_SDUtilityPool.CallOpts, arg0, arg1) } -// Utilize is a paid mutator transaction binding the contract method 0xec29c551. +// RiskConfig is a free data retrieval call binding the contract method 0x7c90a6ca. +// +// Solidity: function riskConfig() view returns(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) +func (_SDUtilityPool *SDUtilityPoolCaller) RiskConfig(opts *bind.CallOpts) (struct { + LiquidationThreshold *big.Int + LiquidationBonusPercent *big.Int + LiquidationFeePercent *big.Int + Ltv *big.Int +}, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "riskConfig") + + outstruct := new(struct { + LiquidationThreshold *big.Int + LiquidationBonusPercent *big.Int + LiquidationFeePercent *big.Int + Ltv *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.LiquidationThreshold = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.LiquidationBonusPercent = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.LiquidationFeePercent = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + outstruct.Ltv = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) + + return *outstruct, err + +} + +// RiskConfig is a free data retrieval call binding the contract method 0x7c90a6ca. +// +// Solidity: function riskConfig() view returns(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) +func (_SDUtilityPool *SDUtilityPoolSession) RiskConfig() (struct { + LiquidationThreshold *big.Int + LiquidationBonusPercent *big.Int + LiquidationFeePercent *big.Int + Ltv *big.Int +}, error) { + return _SDUtilityPool.Contract.RiskConfig(&_SDUtilityPool.CallOpts) +} + +// RiskConfig is a free data retrieval call binding the contract method 0x7c90a6ca. +// +// Solidity: function riskConfig() view returns(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) +func (_SDUtilityPool *SDUtilityPoolCallerSession) RiskConfig() (struct { + LiquidationThreshold *big.Int + LiquidationBonusPercent *big.Int + LiquidationFeePercent *big.Int + Ltv *big.Int +}, error) { + return _SDUtilityPool.Contract.RiskConfig(&_SDUtilityPool.CallOpts) +} + +// SdRequestedForWithdraw is a free data retrieval call binding the contract method 0x3b92e3cf. +// +// Solidity: function sdRequestedForWithdraw() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) SdRequestedForWithdraw(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "sdRequestedForWithdraw") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// SdRequestedForWithdraw is a free data retrieval call binding the contract method 0x3b92e3cf. +// +// Solidity: function sdRequestedForWithdraw() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) SdRequestedForWithdraw() (*big.Int, error) { + return _SDUtilityPool.Contract.SdRequestedForWithdraw(&_SDUtilityPool.CallOpts) +} + +// SdRequestedForWithdraw is a free data retrieval call binding the contract method 0x3b92e3cf. +// +// Solidity: function sdRequestedForWithdraw() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) SdRequestedForWithdraw() (*big.Int, error) { + return _SDUtilityPool.Contract.SdRequestedForWithdraw(&_SDUtilityPool.CallOpts) +} + +// SdReservedForClaim is a free data retrieval call binding the contract method 0x2b886941. +// +// Solidity: function sdReservedForClaim() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) SdReservedForClaim(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "sdReservedForClaim") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// SdReservedForClaim is a free data retrieval call binding the contract method 0x2b886941. +// +// Solidity: function sdReservedForClaim() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) SdReservedForClaim() (*big.Int, error) { + return _SDUtilityPool.Contract.SdReservedForClaim(&_SDUtilityPool.CallOpts) +} + +// SdReservedForClaim is a free data retrieval call binding the contract method 0x2b886941. +// +// Solidity: function sdReservedForClaim() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) SdReservedForClaim() (*big.Int, error) { + return _SDUtilityPool.Contract.SdReservedForClaim(&_SDUtilityPool.CallOpts) +} + +// StaderConfig is a free data retrieval call binding the contract method 0x490ffa35. +// +// Solidity: function staderConfig() view returns(address) +func (_SDUtilityPool *SDUtilityPoolCaller) StaderConfig(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "staderConfig") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// StaderConfig is a free data retrieval call binding the contract method 0x490ffa35. +// +// Solidity: function staderConfig() view returns(address) +func (_SDUtilityPool *SDUtilityPoolSession) StaderConfig() (common.Address, error) { + return _SDUtilityPool.Contract.StaderConfig(&_SDUtilityPool.CallOpts) +} + +// StaderConfig is a free data retrieval call binding the contract method 0x490ffa35. +// +// Solidity: function staderConfig() view returns(address) +func (_SDUtilityPool *SDUtilityPoolCallerSession) StaderConfig() (common.Address, error) { + return _SDUtilityPool.Contract.StaderConfig(&_SDUtilityPool.CallOpts) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_SDUtilityPool *SDUtilityPoolCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "supportsInterface", interfaceId) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_SDUtilityPool *SDUtilityPoolSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _SDUtilityPool.Contract.SupportsInterface(&_SDUtilityPool.CallOpts, interfaceId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_SDUtilityPool *SDUtilityPoolCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _SDUtilityPool.Contract.SupportsInterface(&_SDUtilityPool.CallOpts, interfaceId) +} + +// TotalUtilizedSD is a free data retrieval call binding the contract method 0x8763a328. +// +// Solidity: function totalUtilizedSD() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) TotalUtilizedSD(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "totalUtilizedSD") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TotalUtilizedSD is a free data retrieval call binding the contract method 0x8763a328. +// +// Solidity: function totalUtilizedSD() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) TotalUtilizedSD() (*big.Int, error) { + return _SDUtilityPool.Contract.TotalUtilizedSD(&_SDUtilityPool.CallOpts) +} + +// TotalUtilizedSD is a free data retrieval call binding the contract method 0x8763a328. +// +// Solidity: function totalUtilizedSD() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) TotalUtilizedSD() (*big.Int, error) { + return _SDUtilityPool.Contract.TotalUtilizedSD(&_SDUtilityPool.CallOpts) +} + +// UndelegationPeriodInBlocks is a free data retrieval call binding the contract method 0xbbf1a4ef. +// +// Solidity: function undelegationPeriodInBlocks() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) UndelegationPeriodInBlocks(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "undelegationPeriodInBlocks") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// UndelegationPeriodInBlocks is a free data retrieval call binding the contract method 0xbbf1a4ef. +// +// Solidity: function undelegationPeriodInBlocks() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) UndelegationPeriodInBlocks() (*big.Int, error) { + return _SDUtilityPool.Contract.UndelegationPeriodInBlocks(&_SDUtilityPool.CallOpts) +} + +// UndelegationPeriodInBlocks is a free data retrieval call binding the contract method 0xbbf1a4ef. +// +// Solidity: function undelegationPeriodInBlocks() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) UndelegationPeriodInBlocks() (*big.Int, error) { + return _SDUtilityPool.Contract.UndelegationPeriodInBlocks(&_SDUtilityPool.CallOpts) +} + +// UtilizationRatePerBlock is a free data retrieval call binding the contract method 0x962c7070. +// +// Solidity: function utilizationRatePerBlock() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) UtilizationRatePerBlock(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "utilizationRatePerBlock") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// UtilizationRatePerBlock is a free data retrieval call binding the contract method 0x962c7070. +// +// Solidity: function utilizationRatePerBlock() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) UtilizationRatePerBlock() (*big.Int, error) { + return _SDUtilityPool.Contract.UtilizationRatePerBlock(&_SDUtilityPool.CallOpts) +} + +// UtilizationRatePerBlock is a free data retrieval call binding the contract method 0x962c7070. +// +// Solidity: function utilizationRatePerBlock() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizationRatePerBlock() (*big.Int, error) { + return _SDUtilityPool.Contract.UtilizationRatePerBlock(&_SDUtilityPool.CallOpts) +} + +// UtilizeIndex is a free data retrieval call binding the contract method 0x634c48c7. +// +// Solidity: function utilizeIndex() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) UtilizeIndex(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "utilizeIndex") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// UtilizeIndex is a free data retrieval call binding the contract method 0x634c48c7. +// +// Solidity: function utilizeIndex() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) UtilizeIndex() (*big.Int, error) { + return _SDUtilityPool.Contract.UtilizeIndex(&_SDUtilityPool.CallOpts) +} + +// UtilizeIndex is a free data retrieval call binding the contract method 0x634c48c7. +// +// Solidity: function utilizeIndex() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizeIndex() (*big.Int, error) { + return _SDUtilityPool.Contract.UtilizeIndex(&_SDUtilityPool.CallOpts) +} + +// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. +// +// Solidity: function utilizerBalanceStored(address account) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) UtilizerBalanceStored(opts *bind.CallOpts, account common.Address) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "utilizerBalanceStored", account) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. +// +// Solidity: function utilizerBalanceStored(address account) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) UtilizerBalanceStored(account common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.UtilizerBalanceStored(&_SDUtilityPool.CallOpts, account) +} + +// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. +// +// Solidity: function utilizerBalanceStored(address account) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizerBalanceStored(account common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.UtilizerBalanceStored(&_SDUtilityPool.CallOpts, account) +} + +// UtilizerData is a free data retrieval call binding the contract method 0x9e070088. +// +// Solidity: function utilizerData(address ) view returns(uint256 principal, uint256 utilizeIndex) +func (_SDUtilityPool *SDUtilityPoolCaller) UtilizerData(opts *bind.CallOpts, arg0 common.Address) (struct { + Principal *big.Int + UtilizeIndex *big.Int +}, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "utilizerData", arg0) + + outstruct := new(struct { + Principal *big.Int + UtilizeIndex *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.Principal = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.UtilizeIndex = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + + return *outstruct, err + +} + +// UtilizerData is a free data retrieval call binding the contract method 0x9e070088. +// +// Solidity: function utilizerData(address ) view returns(uint256 principal, uint256 utilizeIndex) +func (_SDUtilityPool *SDUtilityPoolSession) UtilizerData(arg0 common.Address) (struct { + Principal *big.Int + UtilizeIndex *big.Int +}, error) { + return _SDUtilityPool.Contract.UtilizerData(&_SDUtilityPool.CallOpts, arg0) +} + +// UtilizerData is a free data retrieval call binding the contract method 0x9e070088. +// +// Solidity: function utilizerData(address ) view returns(uint256 principal, uint256 utilizeIndex) +func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizerData(arg0 common.Address) (struct { + Principal *big.Int + UtilizeIndex *big.Int +}, error) { + return _SDUtilityPool.Contract.UtilizerData(&_SDUtilityPool.CallOpts, arg0) +} + +// AccrueFee is a paid mutator transaction binding the contract method 0xb26cc394. +// +// Solidity: function accrueFee() returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) AccrueFee(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "accrueFee") +} + +// AccrueFee is a paid mutator transaction binding the contract method 0xb26cc394. +// +// Solidity: function accrueFee() returns() +func (_SDUtilityPool *SDUtilityPoolSession) AccrueFee() (*types.Transaction, error) { + return _SDUtilityPool.Contract.AccrueFee(&_SDUtilityPool.TransactOpts) +} + +// AccrueFee is a paid mutator transaction binding the contract method 0xb26cc394. +// +// Solidity: function accrueFee() returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) AccrueFee() (*types.Transaction, error) { + return _SDUtilityPool.Contract.AccrueFee(&_SDUtilityPool.TransactOpts) +} + +// Claim is a paid mutator transaction binding the contract method 0x379607f5. +// +// Solidity: function claim(uint256 _requestId) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) Claim(opts *bind.TransactOpts, _requestId *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "claim", _requestId) +} + +// Claim is a paid mutator transaction binding the contract method 0x379607f5. +// +// Solidity: function claim(uint256 _requestId) returns() +func (_SDUtilityPool *SDUtilityPoolSession) Claim(_requestId *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Claim(&_SDUtilityPool.TransactOpts, _requestId) +} + +// Claim is a paid mutator transaction binding the contract method 0x379607f5. +// +// Solidity: function claim(uint256 _requestId) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Claim(_requestId *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Claim(&_SDUtilityPool.TransactOpts, _requestId) +} + +// ClaimLiquidation is a paid mutator transaction binding the contract method 0x732c8009. +// +// Solidity: function claimLiquidation(uint256 index) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) ClaimLiquidation(opts *bind.TransactOpts, index *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "claimLiquidation", index) +} + +// ClaimLiquidation is a paid mutator transaction binding the contract method 0x732c8009. +// +// Solidity: function claimLiquidation(uint256 index) returns() +func (_SDUtilityPool *SDUtilityPoolSession) ClaimLiquidation(index *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.ClaimLiquidation(&_SDUtilityPool.TransactOpts, index) +} + +// ClaimLiquidation is a paid mutator transaction binding the contract method 0x732c8009. +// +// Solidity: function claimLiquidation(uint256 index) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) ClaimLiquidation(index *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.ClaimLiquidation(&_SDUtilityPool.TransactOpts, index) +} + +// Delegate is a paid mutator transaction binding the contract method 0x9fa6dd35. +// +// Solidity: function delegate(uint256 sdAmount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) Delegate(opts *bind.TransactOpts, sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "delegate", sdAmount) +} + +// Delegate is a paid mutator transaction binding the contract method 0x9fa6dd35. +// +// Solidity: function delegate(uint256 sdAmount) returns() +func (_SDUtilityPool *SDUtilityPoolSession) Delegate(sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Delegate(&_SDUtilityPool.TransactOpts, sdAmount) +} + +// Delegate is a paid mutator transaction binding the contract method 0x9fa6dd35. +// +// Solidity: function delegate(uint256 sdAmount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Delegate(sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Delegate(&_SDUtilityPool.TransactOpts, sdAmount) +} + +// ExchangeRateCurrent is a paid mutator transaction binding the contract method 0xbd6d894d. +// +// Solidity: function exchangeRateCurrent() returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactor) ExchangeRateCurrent(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "exchangeRateCurrent") +} + +// ExchangeRateCurrent is a paid mutator transaction binding the contract method 0xbd6d894d. +// +// Solidity: function exchangeRateCurrent() returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) ExchangeRateCurrent() (*types.Transaction, error) { + return _SDUtilityPool.Contract.ExchangeRateCurrent(&_SDUtilityPool.TransactOpts) +} + +// ExchangeRateCurrent is a paid mutator transaction binding the contract method 0xbd6d894d. +// +// Solidity: function exchangeRateCurrent() returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) ExchangeRateCurrent() (*types.Transaction, error) { + return _SDUtilityPool.Contract.ExchangeRateCurrent(&_SDUtilityPool.TransactOpts) +} + +// FinalizeDelegatorWithdrawalRequest is a paid mutator transaction binding the contract method 0x71898b4e. +// +// Solidity: function finalizeDelegatorWithdrawalRequest() returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) FinalizeDelegatorWithdrawalRequest(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "finalizeDelegatorWithdrawalRequest") +} + +// FinalizeDelegatorWithdrawalRequest is a paid mutator transaction binding the contract method 0x71898b4e. +// +// Solidity: function finalizeDelegatorWithdrawalRequest() returns() +func (_SDUtilityPool *SDUtilityPoolSession) FinalizeDelegatorWithdrawalRequest() (*types.Transaction, error) { + return _SDUtilityPool.Contract.FinalizeDelegatorWithdrawalRequest(&_SDUtilityPool.TransactOpts) +} + +// FinalizeDelegatorWithdrawalRequest is a paid mutator transaction binding the contract method 0x71898b4e. +// +// Solidity: function finalizeDelegatorWithdrawalRequest() returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) FinalizeDelegatorWithdrawalRequest() (*types.Transaction, error) { + return _SDUtilityPool.Contract.FinalizeDelegatorWithdrawalRequest(&_SDUtilityPool.TransactOpts) +} + +// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. +// +// Solidity: function grantRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) GrantRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "grantRole", role, account) +} + +// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. +// +// Solidity: function grantRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolSession) GrantRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.GrantRole(&_SDUtilityPool.TransactOpts, role, account) +} + +// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. +// +// Solidity: function grantRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) GrantRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.GrantRole(&_SDUtilityPool.TransactOpts, role, account) +} + +// Initialize is a paid mutator transaction binding the contract method 0x485cc955. +// +// Solidity: function initialize(address _admin, address _staderConfig) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) Initialize(opts *bind.TransactOpts, _admin common.Address, _staderConfig common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "initialize", _admin, _staderConfig) +} + +// Initialize is a paid mutator transaction binding the contract method 0x485cc955. +// +// Solidity: function initialize(address _admin, address _staderConfig) returns() +func (_SDUtilityPool *SDUtilityPoolSession) Initialize(_admin common.Address, _staderConfig common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Initialize(&_SDUtilityPool.TransactOpts, _admin, _staderConfig) +} + +// Initialize is a paid mutator transaction binding the contract method 0x485cc955. +// +// Solidity: function initialize(address _admin, address _staderConfig) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Initialize(_admin common.Address, _staderConfig common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Initialize(&_SDUtilityPool.TransactOpts, _admin, _staderConfig) +} + +// LiquidationCall is a paid mutator transaction binding the contract method 0xd2ac4a3d. +// +// Solidity: function liquidationCall(address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) LiquidationCall(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "liquidationCall", account) +} + +// LiquidationCall is a paid mutator transaction binding the contract method 0xd2ac4a3d. +// +// Solidity: function liquidationCall(address account) returns() +func (_SDUtilityPool *SDUtilityPoolSession) LiquidationCall(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.LiquidationCall(&_SDUtilityPool.TransactOpts, account) +} + +// LiquidationCall is a paid mutator transaction binding the contract method 0xd2ac4a3d. +// +// Solidity: function liquidationCall(address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) LiquidationCall(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.LiquidationCall(&_SDUtilityPool.TransactOpts, account) +} + +// MaxApproveSD is a paid mutator transaction binding the contract method 0x3e04cd35. +// +// Solidity: function maxApproveSD() returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) MaxApproveSD(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "maxApproveSD") +} + +// MaxApproveSD is a paid mutator transaction binding the contract method 0x3e04cd35. +// +// Solidity: function maxApproveSD() returns() +func (_SDUtilityPool *SDUtilityPoolSession) MaxApproveSD() (*types.Transaction, error) { + return _SDUtilityPool.Contract.MaxApproveSD(&_SDUtilityPool.TransactOpts) +} + +// MaxApproveSD is a paid mutator transaction binding the contract method 0x3e04cd35. +// +// Solidity: function maxApproveSD() returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) MaxApproveSD() (*types.Transaction, error) { + return _SDUtilityPool.Contract.MaxApproveSD(&_SDUtilityPool.TransactOpts) +} + +// Pause is a paid mutator transaction binding the contract method 0x8456cb59. +// +// Solidity: function pause() returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "pause") +} + +// Pause is a paid mutator transaction binding the contract method 0x8456cb59. +// +// Solidity: function pause() returns() +func (_SDUtilityPool *SDUtilityPoolSession) Pause() (*types.Transaction, error) { + return _SDUtilityPool.Contract.Pause(&_SDUtilityPool.TransactOpts) +} + +// Pause is a paid mutator transaction binding the contract method 0x8456cb59. +// +// Solidity: function pause() returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Pause() (*types.Transaction, error) { + return _SDUtilityPool.Contract.Pause(&_SDUtilityPool.TransactOpts) +} + +// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. +// +// Solidity: function renounceRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) RenounceRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "renounceRole", role, account) +} + +// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. +// +// Solidity: function renounceRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolSession) RenounceRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RenounceRole(&_SDUtilityPool.TransactOpts, role, account) +} + +// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. +// +// Solidity: function renounceRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) RenounceRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RenounceRole(&_SDUtilityPool.TransactOpts, role, account) +} + +// Repay is a paid mutator transaction binding the contract method 0x371fd8e6. +// +// Solidity: function repay(uint256 repayAmount) returns(uint256 repaidAmount) +func (_SDUtilityPool *SDUtilityPoolTransactor) Repay(opts *bind.TransactOpts, repayAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "repay", repayAmount) +} + +// Repay is a paid mutator transaction binding the contract method 0x371fd8e6. +// +// Solidity: function repay(uint256 repayAmount) returns(uint256 repaidAmount) +func (_SDUtilityPool *SDUtilityPoolSession) Repay(repayAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Repay(&_SDUtilityPool.TransactOpts, repayAmount) +} + +// Repay is a paid mutator transaction binding the contract method 0x371fd8e6. +// +// Solidity: function repay(uint256 repayAmount) returns(uint256 repaidAmount) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Repay(repayAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Repay(&_SDUtilityPool.TransactOpts, repayAmount) +} + +// RepayLiquidation is a paid mutator transaction binding the contract method 0x24faf5d9. +// +// Solidity: function repayLiquidation(address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) RepayLiquidation(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "repayLiquidation", account) +} + +// RepayLiquidation is a paid mutator transaction binding the contract method 0x24faf5d9. +// +// Solidity: function repayLiquidation(address account) returns() +func (_SDUtilityPool *SDUtilityPoolSession) RepayLiquidation(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RepayLiquidation(&_SDUtilityPool.TransactOpts, account) +} + +// RepayLiquidation is a paid mutator transaction binding the contract method 0x24faf5d9. +// +// Solidity: function repayLiquidation(address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) RepayLiquidation(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RepayLiquidation(&_SDUtilityPool.TransactOpts, account) +} + +// RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. +// +// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns(uint256 repaidAmount) +func (_SDUtilityPool *SDUtilityPoolTransactor) RepayOnBehalf(opts *bind.TransactOpts, utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "repayOnBehalf", utilizer, repayAmount) +} + +// RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. +// +// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns(uint256 repaidAmount) +func (_SDUtilityPool *SDUtilityPoolSession) RepayOnBehalf(utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RepayOnBehalf(&_SDUtilityPool.TransactOpts, utilizer, repayAmount) +} + +// RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. +// +// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns(uint256 repaidAmount) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) RepayOnBehalf(utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RepayOnBehalf(&_SDUtilityPool.TransactOpts, utilizer, repayAmount) +} + +// RequestWithdraw is a paid mutator transaction binding the contract method 0x745400c9. +// +// Solidity: function requestWithdraw(uint256 _cTokenAmount) returns(uint256 _requestId) +func (_SDUtilityPool *SDUtilityPoolTransactor) RequestWithdraw(opts *bind.TransactOpts, _cTokenAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "requestWithdraw", _cTokenAmount) +} + +// RequestWithdraw is a paid mutator transaction binding the contract method 0x745400c9. +// +// Solidity: function requestWithdraw(uint256 _cTokenAmount) returns(uint256 _requestId) +func (_SDUtilityPool *SDUtilityPoolSession) RequestWithdraw(_cTokenAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RequestWithdraw(&_SDUtilityPool.TransactOpts, _cTokenAmount) +} + +// RequestWithdraw is a paid mutator transaction binding the contract method 0x745400c9. +// +// Solidity: function requestWithdraw(uint256 _cTokenAmount) returns(uint256 _requestId) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) RequestWithdraw(_cTokenAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RequestWithdraw(&_SDUtilityPool.TransactOpts, _cTokenAmount) +} + +// RequestWithdrawWithSDAmount is a paid mutator transaction binding the contract method 0xc51cd1cc. +// +// Solidity: function requestWithdrawWithSDAmount(uint256 _sdAmount) returns(uint256 _requestId) +func (_SDUtilityPool *SDUtilityPoolTransactor) RequestWithdrawWithSDAmount(opts *bind.TransactOpts, _sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "requestWithdrawWithSDAmount", _sdAmount) +} + +// RequestWithdrawWithSDAmount is a paid mutator transaction binding the contract method 0xc51cd1cc. +// +// Solidity: function requestWithdrawWithSDAmount(uint256 _sdAmount) returns(uint256 _requestId) +func (_SDUtilityPool *SDUtilityPoolSession) RequestWithdrawWithSDAmount(_sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RequestWithdrawWithSDAmount(&_SDUtilityPool.TransactOpts, _sdAmount) +} + +// RequestWithdrawWithSDAmount is a paid mutator transaction binding the contract method 0xc51cd1cc. +// +// Solidity: function requestWithdrawWithSDAmount(uint256 _sdAmount) returns(uint256 _requestId) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) RequestWithdrawWithSDAmount(_sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RequestWithdrawWithSDAmount(&_SDUtilityPool.TransactOpts, _sdAmount) +} + +// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. +// +// Solidity: function revokeRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) RevokeRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "revokeRole", role, account) +} + +// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. +// +// Solidity: function revokeRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolSession) RevokeRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RevokeRole(&_SDUtilityPool.TransactOpts, role, account) +} + +// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. +// +// Solidity: function revokeRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) RevokeRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RevokeRole(&_SDUtilityPool.TransactOpts, role, account) +} + +// Unpause is a paid mutator transaction binding the contract method 0x3f4ba83a. +// +// Solidity: function unpause() returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) Unpause(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "unpause") +} + +// Unpause is a paid mutator transaction binding the contract method 0x3f4ba83a. +// +// Solidity: function unpause() returns() +func (_SDUtilityPool *SDUtilityPoolSession) Unpause() (*types.Transaction, error) { + return _SDUtilityPool.Contract.Unpause(&_SDUtilityPool.TransactOpts) +} + +// Unpause is a paid mutator transaction binding the contract method 0x3f4ba83a. +// +// Solidity: function unpause() returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Unpause() (*types.Transaction, error) { + return _SDUtilityPool.Contract.Unpause(&_SDUtilityPool.TransactOpts) +} + +// UpdateFinalizationBatchLimit is a paid mutator transaction binding the contract method 0x267fca73. +// +// Solidity: function updateFinalizationBatchLimit(uint256 _finalizationBatchLimit) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateFinalizationBatchLimit(opts *bind.TransactOpts, _finalizationBatchLimit *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateFinalizationBatchLimit", _finalizationBatchLimit) +} + +// UpdateFinalizationBatchLimit is a paid mutator transaction binding the contract method 0x267fca73. +// +// Solidity: function updateFinalizationBatchLimit(uint256 _finalizationBatchLimit) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateFinalizationBatchLimit(_finalizationBatchLimit *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateFinalizationBatchLimit(&_SDUtilityPool.TransactOpts, _finalizationBatchLimit) +} + +// UpdateFinalizationBatchLimit is a paid mutator transaction binding the contract method 0x267fca73. +// +// Solidity: function updateFinalizationBatchLimit(uint256 _finalizationBatchLimit) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateFinalizationBatchLimit(_finalizationBatchLimit *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateFinalizationBatchLimit(&_SDUtilityPool.TransactOpts, _finalizationBatchLimit) +} + +// UpdateMaxETHWorthOfSDPerValidator is a paid mutator transaction binding the contract method 0x5393618e. +// +// Solidity: function updateMaxETHWorthOfSDPerValidator(uint256 _maxETHWorthOfSDPerValidator) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateMaxETHWorthOfSDPerValidator(opts *bind.TransactOpts, _maxETHWorthOfSDPerValidator *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateMaxETHWorthOfSDPerValidator", _maxETHWorthOfSDPerValidator) +} + +// UpdateMaxETHWorthOfSDPerValidator is a paid mutator transaction binding the contract method 0x5393618e. +// +// Solidity: function updateMaxETHWorthOfSDPerValidator(uint256 _maxETHWorthOfSDPerValidator) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateMaxETHWorthOfSDPerValidator(_maxETHWorthOfSDPerValidator *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateMaxETHWorthOfSDPerValidator(&_SDUtilityPool.TransactOpts, _maxETHWorthOfSDPerValidator) +} + +// UpdateMaxETHWorthOfSDPerValidator is a paid mutator transaction binding the contract method 0x5393618e. +// +// Solidity: function updateMaxETHWorthOfSDPerValidator(uint256 _maxETHWorthOfSDPerValidator) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateMaxETHWorthOfSDPerValidator(_maxETHWorthOfSDPerValidator *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateMaxETHWorthOfSDPerValidator(&_SDUtilityPool.TransactOpts, _maxETHWorthOfSDPerValidator) +} + +// UpdateMaxNonRedeemedDelegatorRequestCount is a paid mutator transaction binding the contract method 0xee63e5f9. +// +// Solidity: function updateMaxNonRedeemedDelegatorRequestCount(uint256 _count) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateMaxNonRedeemedDelegatorRequestCount(opts *bind.TransactOpts, _count *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateMaxNonRedeemedDelegatorRequestCount", _count) +} + +// UpdateMaxNonRedeemedDelegatorRequestCount is a paid mutator transaction binding the contract method 0xee63e5f9. +// +// Solidity: function updateMaxNonRedeemedDelegatorRequestCount(uint256 _count) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateMaxNonRedeemedDelegatorRequestCount(_count *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateMaxNonRedeemedDelegatorRequestCount(&_SDUtilityPool.TransactOpts, _count) +} + +// UpdateMaxNonRedeemedDelegatorRequestCount is a paid mutator transaction binding the contract method 0xee63e5f9. +// +// Solidity: function updateMaxNonRedeemedDelegatorRequestCount(uint256 _count) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateMaxNonRedeemedDelegatorRequestCount(_count *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateMaxNonRedeemedDelegatorRequestCount(&_SDUtilityPool.TransactOpts, _count) +} + +// UpdateMinBlockDelayToFinalizeRequest is a paid mutator transaction binding the contract method 0x4a2965af. +// +// Solidity: function updateMinBlockDelayToFinalizeRequest(uint256 _minBlockDelayToFinalizeRequest) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateMinBlockDelayToFinalizeRequest(opts *bind.TransactOpts, _minBlockDelayToFinalizeRequest *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateMinBlockDelayToFinalizeRequest", _minBlockDelayToFinalizeRequest) +} + +// UpdateMinBlockDelayToFinalizeRequest is a paid mutator transaction binding the contract method 0x4a2965af. +// +// Solidity: function updateMinBlockDelayToFinalizeRequest(uint256 _minBlockDelayToFinalizeRequest) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateMinBlockDelayToFinalizeRequest(_minBlockDelayToFinalizeRequest *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateMinBlockDelayToFinalizeRequest(&_SDUtilityPool.TransactOpts, _minBlockDelayToFinalizeRequest) +} + +// UpdateMinBlockDelayToFinalizeRequest is a paid mutator transaction binding the contract method 0x4a2965af. +// +// Solidity: function updateMinBlockDelayToFinalizeRequest(uint256 _minBlockDelayToFinalizeRequest) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateMinBlockDelayToFinalizeRequest(_minBlockDelayToFinalizeRequest *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateMinBlockDelayToFinalizeRequest(&_SDUtilityPool.TransactOpts, _minBlockDelayToFinalizeRequest) +} + +// UpdateProtocolFeeFactor is a paid mutator transaction binding the contract method 0x865cbba3. +// +// Solidity: function updateProtocolFeeFactor(uint256 _protocolFeeFactor) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateProtocolFeeFactor(opts *bind.TransactOpts, _protocolFeeFactor *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateProtocolFeeFactor", _protocolFeeFactor) +} + +// UpdateProtocolFeeFactor is a paid mutator transaction binding the contract method 0x865cbba3. +// +// Solidity: function updateProtocolFeeFactor(uint256 _protocolFeeFactor) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateProtocolFeeFactor(_protocolFeeFactor *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateProtocolFeeFactor(&_SDUtilityPool.TransactOpts, _protocolFeeFactor) +} + +// UpdateProtocolFeeFactor is a paid mutator transaction binding the contract method 0x865cbba3. +// +// Solidity: function updateProtocolFeeFactor(uint256 _protocolFeeFactor) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateProtocolFeeFactor(_protocolFeeFactor *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateProtocolFeeFactor(&_SDUtilityPool.TransactOpts, _protocolFeeFactor) +} + +// UpdateRiskConfig is a paid mutator transaction binding the contract method 0x62569a51. +// +// Solidity: function updateRiskConfig(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateRiskConfig(opts *bind.TransactOpts, liquidationThreshold *big.Int, liquidationBonusPercent *big.Int, liquidationFeePercent *big.Int, ltv *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateRiskConfig", liquidationThreshold, liquidationBonusPercent, liquidationFeePercent, ltv) +} + +// UpdateRiskConfig is a paid mutator transaction binding the contract method 0x62569a51. +// +// Solidity: function updateRiskConfig(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateRiskConfig(liquidationThreshold *big.Int, liquidationBonusPercent *big.Int, liquidationFeePercent *big.Int, ltv *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateRiskConfig(&_SDUtilityPool.TransactOpts, liquidationThreshold, liquidationBonusPercent, liquidationFeePercent, ltv) +} + +// UpdateRiskConfig is a paid mutator transaction binding the contract method 0x62569a51. +// +// Solidity: function updateRiskConfig(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateRiskConfig(liquidationThreshold *big.Int, liquidationBonusPercent *big.Int, liquidationFeePercent *big.Int, ltv *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateRiskConfig(&_SDUtilityPool.TransactOpts, liquidationThreshold, liquidationBonusPercent, liquidationFeePercent, ltv) +} + +// UpdateStaderConfig is a paid mutator transaction binding the contract method 0x9ee804cb. +// +// Solidity: function updateStaderConfig(address _staderConfig) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateStaderConfig(opts *bind.TransactOpts, _staderConfig common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateStaderConfig", _staderConfig) +} + +// UpdateStaderConfig is a paid mutator transaction binding the contract method 0x9ee804cb. +// +// Solidity: function updateStaderConfig(address _staderConfig) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateStaderConfig(_staderConfig common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateStaderConfig(&_SDUtilityPool.TransactOpts, _staderConfig) +} + +// UpdateStaderConfig is a paid mutator transaction binding the contract method 0x9ee804cb. +// +// Solidity: function updateStaderConfig(address _staderConfig) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateStaderConfig(_staderConfig common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateStaderConfig(&_SDUtilityPool.TransactOpts, _staderConfig) +} + +// UpdateUndelegationPeriodInBlocks is a paid mutator transaction binding the contract method 0xf9d1f10a. +// +// Solidity: function updateUndelegationPeriodInBlocks(uint256 _undelegationPeriodInBlocks) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateUndelegationPeriodInBlocks(opts *bind.TransactOpts, _undelegationPeriodInBlocks *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateUndelegationPeriodInBlocks", _undelegationPeriodInBlocks) +} + +// UpdateUndelegationPeriodInBlocks is a paid mutator transaction binding the contract method 0xf9d1f10a. +// +// Solidity: function updateUndelegationPeriodInBlocks(uint256 _undelegationPeriodInBlocks) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateUndelegationPeriodInBlocks(_undelegationPeriodInBlocks *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateUndelegationPeriodInBlocks(&_SDUtilityPool.TransactOpts, _undelegationPeriodInBlocks) +} + +// UpdateUndelegationPeriodInBlocks is a paid mutator transaction binding the contract method 0xf9d1f10a. +// +// Solidity: function updateUndelegationPeriodInBlocks(uint256 _undelegationPeriodInBlocks) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateUndelegationPeriodInBlocks(_undelegationPeriodInBlocks *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateUndelegationPeriodInBlocks(&_SDUtilityPool.TransactOpts, _undelegationPeriodInBlocks) +} + +// UpdateUtilizationRatePerBlock is a paid mutator transaction binding the contract method 0xcb2d89dd. +// +// Solidity: function updateUtilizationRatePerBlock(uint256 _utilizationRatePerBlock) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateUtilizationRatePerBlock(opts *bind.TransactOpts, _utilizationRatePerBlock *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateUtilizationRatePerBlock", _utilizationRatePerBlock) +} + +// UpdateUtilizationRatePerBlock is a paid mutator transaction binding the contract method 0xcb2d89dd. +// +// Solidity: function updateUtilizationRatePerBlock(uint256 _utilizationRatePerBlock) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateUtilizationRatePerBlock(_utilizationRatePerBlock *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateUtilizationRatePerBlock(&_SDUtilityPool.TransactOpts, _utilizationRatePerBlock) +} + +// UpdateUtilizationRatePerBlock is a paid mutator transaction binding the contract method 0xcb2d89dd. +// +// Solidity: function updateUtilizationRatePerBlock(uint256 _utilizationRatePerBlock) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateUtilizationRatePerBlock(_utilizationRatePerBlock *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateUtilizationRatePerBlock(&_SDUtilityPool.TransactOpts, _utilizationRatePerBlock) +} + +// Utilize is a paid mutator transaction binding the contract method 0xec29c551. +// +// Solidity: function utilize(uint256 utilizeAmount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) Utilize(opts *bind.TransactOpts, utilizeAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "utilize", utilizeAmount) +} + +// Utilize is a paid mutator transaction binding the contract method 0xec29c551. // // Solidity: function utilize(uint256 utilizeAmount) returns() func (_SDUtilityPool *SDUtilityPoolSession) Utilize(utilizeAmount *big.Int) (*types.Transaction, error) { return _SDUtilityPool.Contract.Utilize(&_SDUtilityPool.TransactOpts, utilizeAmount) } -// Utilize is a paid mutator transaction binding the contract method 0xec29c551. +// Utilize is a paid mutator transaction binding the contract method 0xec29c551. +// +// Solidity: function utilize(uint256 utilizeAmount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Utilize(utilizeAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Utilize(&_SDUtilityPool.TransactOpts, utilizeAmount) +} + +// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. +// +// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UtilizeWhileAddingKeys(opts *bind.TransactOpts, operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "utilizeWhileAddingKeys", operator, utilizeAmount, nonTerminalKeyCount) +} + +// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. +// +// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UtilizeWhileAddingKeys(operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UtilizeWhileAddingKeys(&_SDUtilityPool.TransactOpts, operator, utilizeAmount, nonTerminalKeyCount) +} + +// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. +// +// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UtilizeWhileAddingKeys(operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UtilizeWhileAddingKeys(&_SDUtilityPool.TransactOpts, operator, utilizeAmount, nonTerminalKeyCount) +} + +// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. +// +// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactor) UtilizerBalanceCurrent(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "utilizerBalanceCurrent", account) +} + +// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. +// +// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) UtilizerBalanceCurrent(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UtilizerBalanceCurrent(&_SDUtilityPool.TransactOpts, account) +} + +// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. +// +// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UtilizerBalanceCurrent(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UtilizerBalanceCurrent(&_SDUtilityPool.TransactOpts, account) +} + +// WithdrawProtocolFee is a paid mutator transaction binding the contract method 0x424cd833. +// +// Solidity: function withdrawProtocolFee(uint256 _amount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) WithdrawProtocolFee(opts *bind.TransactOpts, _amount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "withdrawProtocolFee", _amount) +} + +// WithdrawProtocolFee is a paid mutator transaction binding the contract method 0x424cd833. +// +// Solidity: function withdrawProtocolFee(uint256 _amount) returns() +func (_SDUtilityPool *SDUtilityPoolSession) WithdrawProtocolFee(_amount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.WithdrawProtocolFee(&_SDUtilityPool.TransactOpts, _amount) +} + +// WithdrawProtocolFee is a paid mutator transaction binding the contract method 0x424cd833. +// +// Solidity: function withdrawProtocolFee(uint256 _amount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) WithdrawProtocolFee(_amount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.WithdrawProtocolFee(&_SDUtilityPool.TransactOpts, _amount) +} + +// SDUtilityPoolAccruedFeesIterator is returned from FilterAccruedFees and is used to iterate over the raw logs and unpacked data for AccruedFees events raised by the SDUtilityPool contract. +type SDUtilityPoolAccruedFeesIterator struct { + Event *SDUtilityPoolAccruedFees // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolAccruedFeesIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolAccruedFees) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolAccruedFees) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolAccruedFeesIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolAccruedFeesIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolAccruedFees represents a AccruedFees event raised by the SDUtilityPool contract. +type SDUtilityPoolAccruedFees struct { + FeeAccumulated *big.Int + TotalProtocolFee *big.Int + TotalUtilizedSD *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterAccruedFees is a free log retrieval operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. +// +// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterAccruedFees(opts *bind.FilterOpts) (*SDUtilityPoolAccruedFeesIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "AccruedFees") + if err != nil { + return nil, err + } + return &SDUtilityPoolAccruedFeesIterator{contract: _SDUtilityPool.contract, event: "AccruedFees", logs: logs, sub: sub}, nil +} + +// WatchAccruedFees is a free log subscription operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. +// +// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchAccruedFees(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolAccruedFees) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "AccruedFees") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolAccruedFees) + if err := _SDUtilityPool.contract.UnpackLog(event, "AccruedFees", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseAccruedFees is a log parse operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. +// +// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseAccruedFees(log types.Log) (*SDUtilityPoolAccruedFees, error) { + event := new(SDUtilityPoolAccruedFees) + if err := _SDUtilityPool.contract.UnpackLog(event, "AccruedFees", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolClaimedLiquidationIterator is returned from FilterClaimedLiquidation and is used to iterate over the raw logs and unpacked data for ClaimedLiquidation events raised by the SDUtilityPool contract. +type SDUtilityPoolClaimedLiquidationIterator struct { + Event *SDUtilityPoolClaimedLiquidation // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolClaimedLiquidationIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolClaimedLiquidation) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolClaimedLiquidation) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolClaimedLiquidationIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolClaimedLiquidationIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolClaimedLiquidation represents a ClaimedLiquidation event raised by the SDUtilityPool contract. +type SDUtilityPoolClaimedLiquidation struct { + Liquidator common.Address + LiquidationBonusInEth *big.Int + LiquidationFeeInEth *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterClaimedLiquidation is a free log retrieval operation binding the contract event 0x87e8e54247cd0a3f2aae4999ad6838c60057f6de710e7b4eec301fe80eb55199. +// +// Solidity: event ClaimedLiquidation(address indexed liquidator, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterClaimedLiquidation(opts *bind.FilterOpts, liquidator []common.Address) (*SDUtilityPoolClaimedLiquidationIterator, error) { + + var liquidatorRule []interface{} + for _, liquidatorItem := range liquidator { + liquidatorRule = append(liquidatorRule, liquidatorItem) + } + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "ClaimedLiquidation", liquidatorRule) + if err != nil { + return nil, err + } + return &SDUtilityPoolClaimedLiquidationIterator{contract: _SDUtilityPool.contract, event: "ClaimedLiquidation", logs: logs, sub: sub}, nil +} + +// WatchClaimedLiquidation is a free log subscription operation binding the contract event 0x87e8e54247cd0a3f2aae4999ad6838c60057f6de710e7b4eec301fe80eb55199. +// +// Solidity: event ClaimedLiquidation(address indexed liquidator, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchClaimedLiquidation(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolClaimedLiquidation, liquidator []common.Address) (event.Subscription, error) { + + var liquidatorRule []interface{} + for _, liquidatorItem := range liquidator { + liquidatorRule = append(liquidatorRule, liquidatorItem) + } + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "ClaimedLiquidation", liquidatorRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolClaimedLiquidation) + if err := _SDUtilityPool.contract.UnpackLog(event, "ClaimedLiquidation", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseClaimedLiquidation is a log parse operation binding the contract event 0x87e8e54247cd0a3f2aae4999ad6838c60057f6de710e7b4eec301fe80eb55199. +// +// Solidity: event ClaimedLiquidation(address indexed liquidator, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseClaimedLiquidation(log types.Log) (*SDUtilityPoolClaimedLiquidation, error) { + event := new(SDUtilityPoolClaimedLiquidation) + if err := _SDUtilityPool.contract.UnpackLog(event, "ClaimedLiquidation", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolDelegatedIterator is returned from FilterDelegated and is used to iterate over the raw logs and unpacked data for Delegated events raised by the SDUtilityPool contract. +type SDUtilityPoolDelegatedIterator struct { + Event *SDUtilityPoolDelegated // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolDelegatedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolDelegated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolDelegated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolDelegatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolDelegatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolDelegated represents a Delegated event raised by the SDUtilityPool contract. +type SDUtilityPoolDelegated struct { + Delegator common.Address + SdAmount *big.Int + SdXToMint *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterDelegated is a free log retrieval operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// +// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterDelegated(opts *bind.FilterOpts, delegator []common.Address) (*SDUtilityPoolDelegatedIterator, error) { + + var delegatorRule []interface{} + for _, delegatorItem := range delegator { + delegatorRule = append(delegatorRule, delegatorItem) + } + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Delegated", delegatorRule) + if err != nil { + return nil, err + } + return &SDUtilityPoolDelegatedIterator{contract: _SDUtilityPool.contract, event: "Delegated", logs: logs, sub: sub}, nil +} + +// WatchDelegated is a free log subscription operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// +// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchDelegated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolDelegated, delegator []common.Address) (event.Subscription, error) { + + var delegatorRule []interface{} + for _, delegatorItem := range delegator { + delegatorRule = append(delegatorRule, delegatorItem) + } + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Delegated", delegatorRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolDelegated) + if err := _SDUtilityPool.contract.UnpackLog(event, "Delegated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseDelegated is a log parse operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// +// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseDelegated(log types.Log) (*SDUtilityPoolDelegated, error) { + event := new(SDUtilityPoolDelegated) + if err := _SDUtilityPool.contract.UnpackLog(event, "Delegated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolFinalizedWithdrawRequestIterator is returned from FilterFinalizedWithdrawRequest and is used to iterate over the raw logs and unpacked data for FinalizedWithdrawRequest events raised by the SDUtilityPool contract. +type SDUtilityPoolFinalizedWithdrawRequestIterator struct { + Event *SDUtilityPoolFinalizedWithdrawRequest // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolFinalizedWithdrawRequest) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolFinalizedWithdrawRequest) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolFinalizedWithdrawRequest represents a FinalizedWithdrawRequest event raised by the SDUtilityPool contract. +type SDUtilityPoolFinalizedWithdrawRequest struct { + NextRequestIdToFinalize *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterFinalizedWithdrawRequest is a free log retrieval operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. +// +// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterFinalizedWithdrawRequest(opts *bind.FilterOpts) (*SDUtilityPoolFinalizedWithdrawRequestIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "FinalizedWithdrawRequest") + if err != nil { + return nil, err + } + return &SDUtilityPoolFinalizedWithdrawRequestIterator{contract: _SDUtilityPool.contract, event: "FinalizedWithdrawRequest", logs: logs, sub: sub}, nil +} + +// WatchFinalizedWithdrawRequest is a free log subscription operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. +// +// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchFinalizedWithdrawRequest(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolFinalizedWithdrawRequest) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "FinalizedWithdrawRequest") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolFinalizedWithdrawRequest) + if err := _SDUtilityPool.contract.UnpackLog(event, "FinalizedWithdrawRequest", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseFinalizedWithdrawRequest is a log parse operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. +// +// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseFinalizedWithdrawRequest(log types.Log) (*SDUtilityPoolFinalizedWithdrawRequest, error) { + event := new(SDUtilityPoolFinalizedWithdrawRequest) + if err := _SDUtilityPool.contract.UnpackLog(event, "FinalizedWithdrawRequest", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the SDUtilityPool contract. +type SDUtilityPoolInitializedIterator struct { + Event *SDUtilityPoolInitialized // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolInitializedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolInitialized) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolInitialized) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolInitializedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolInitializedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolInitialized represents a Initialized event raised by the SDUtilityPool contract. +type SDUtilityPoolInitialized struct { + Version uint8 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterInitialized is a free log retrieval operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterInitialized(opts *bind.FilterOpts) (*SDUtilityPoolInitializedIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Initialized") + if err != nil { + return nil, err + } + return &SDUtilityPoolInitializedIterator{contract: _SDUtilityPool.contract, event: "Initialized", logs: logs, sub: sub}, nil +} + +// WatchInitialized is a free log subscription operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolInitialized) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Initialized") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolInitialized) + if err := _SDUtilityPool.contract.UnpackLog(event, "Initialized", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseInitialized is a log parse operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseInitialized(log types.Log) (*SDUtilityPoolInitialized, error) { + event := new(SDUtilityPoolInitialized) + if err := _SDUtilityPool.contract.UnpackLog(event, "Initialized", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolLiquidationCallIterator is returned from FilterLiquidationCall and is used to iterate over the raw logs and unpacked data for LiquidationCall events raised by the SDUtilityPool contract. +type SDUtilityPoolLiquidationCallIterator struct { + Event *SDUtilityPoolLiquidationCall // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolLiquidationCallIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolLiquidationCall) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolLiquidationCall) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolLiquidationCallIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolLiquidationCallIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolLiquidationCall represents a LiquidationCall event raised by the SDUtilityPool contract. +type SDUtilityPoolLiquidationCall struct { + Account common.Address + TotalLiquidationAmountInEth *big.Int + LiquidationBonusInEth *big.Int + LiquidationFeeInEth *big.Int + Liquidator common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterLiquidationCall is a free log retrieval operation binding the contract event 0xcc9de8be9ac1f02b70a8ca2612f451a769d6d160ad91de17dcc38e54c567a532. +// +// Solidity: event LiquidationCall(address indexed account, uint256 totalLiquidationAmountInEth, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth, address indexed liquidator) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterLiquidationCall(opts *bind.FilterOpts, account []common.Address, liquidator []common.Address) (*SDUtilityPoolLiquidationCallIterator, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + var liquidatorRule []interface{} + for _, liquidatorItem := range liquidator { + liquidatorRule = append(liquidatorRule, liquidatorItem) + } + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "LiquidationCall", accountRule, liquidatorRule) + if err != nil { + return nil, err + } + return &SDUtilityPoolLiquidationCallIterator{contract: _SDUtilityPool.contract, event: "LiquidationCall", logs: logs, sub: sub}, nil +} + +// WatchLiquidationCall is a free log subscription operation binding the contract event 0xcc9de8be9ac1f02b70a8ca2612f451a769d6d160ad91de17dcc38e54c567a532. +// +// Solidity: event LiquidationCall(address indexed account, uint256 totalLiquidationAmountInEth, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth, address indexed liquidator) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchLiquidationCall(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolLiquidationCall, account []common.Address, liquidator []common.Address) (event.Subscription, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + var liquidatorRule []interface{} + for _, liquidatorItem := range liquidator { + liquidatorRule = append(liquidatorRule, liquidatorItem) + } + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "LiquidationCall", accountRule, liquidatorRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolLiquidationCall) + if err := _SDUtilityPool.contract.UnpackLog(event, "LiquidationCall", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseLiquidationCall is a log parse operation binding the contract event 0xcc9de8be9ac1f02b70a8ca2612f451a769d6d160ad91de17dcc38e54c567a532. +// +// Solidity: event LiquidationCall(address indexed account, uint256 totalLiquidationAmountInEth, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth, address indexed liquidator) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseLiquidationCall(log types.Log) (*SDUtilityPoolLiquidationCall, error) { + event := new(SDUtilityPoolLiquidationCall) + if err := _SDUtilityPool.contract.UnpackLog(event, "LiquidationCall", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolPausedIterator is returned from FilterPaused and is used to iterate over the raw logs and unpacked data for Paused events raised by the SDUtilityPool contract. +type SDUtilityPoolPausedIterator struct { + Event *SDUtilityPoolPaused // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolPausedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolPaused) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolPaused) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolPausedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolPausedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolPaused represents a Paused event raised by the SDUtilityPool contract. +type SDUtilityPoolPaused struct { + Account common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterPaused is a free log retrieval operation binding the contract event 0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258. // -// Solidity: function utilize(uint256 utilizeAmount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) Utilize(utilizeAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Utilize(&_SDUtilityPool.TransactOpts, utilizeAmount) +// Solidity: event Paused(address account) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterPaused(opts *bind.FilterOpts) (*SDUtilityPoolPausedIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Paused") + if err != nil { + return nil, err + } + return &SDUtilityPoolPausedIterator{contract: _SDUtilityPool.contract, event: "Paused", logs: logs, sub: sub}, nil } -// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. +// WatchPaused is a free log subscription operation binding the contract event 0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258. // -// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) UtilizeWhileAddingKeys(opts *bind.TransactOpts, operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "utilizeWhileAddingKeys", operator, utilizeAmount, nonTerminalKeyCount) +// Solidity: event Paused(address account) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchPaused(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolPaused) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Paused") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolPaused) + if err := _SDUtilityPool.contract.UnpackLog(event, "Paused", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParsePaused is a log parse operation binding the contract event 0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258. +// +// Solidity: event Paused(address account) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParsePaused(log types.Log) (*SDUtilityPoolPaused, error) { + event := new(SDUtilityPoolPaused) + if err := _SDUtilityPool.contract.UnpackLog(event, "Paused", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolProtocolFeeFactorUpdatedIterator is returned from FilterProtocolFeeFactorUpdated and is used to iterate over the raw logs and unpacked data for ProtocolFeeFactorUpdated events raised by the SDUtilityPool contract. +type SDUtilityPoolProtocolFeeFactorUpdatedIterator struct { + Event *SDUtilityPoolProtocolFeeFactorUpdated // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolProtocolFeeFactorUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolProtocolFeeFactorUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolProtocolFeeFactorUpdated represents a ProtocolFeeFactorUpdated event raised by the SDUtilityPool contract. +type SDUtilityPoolProtocolFeeFactorUpdated struct { + ProtocolFeeFactor *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterProtocolFeeFactorUpdated is a free log retrieval operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. +// +// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterProtocolFeeFactorUpdated(opts *bind.FilterOpts) (*SDUtilityPoolProtocolFeeFactorUpdatedIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "ProtocolFeeFactorUpdated") + if err != nil { + return nil, err + } + return &SDUtilityPoolProtocolFeeFactorUpdatedIterator{contract: _SDUtilityPool.contract, event: "ProtocolFeeFactorUpdated", logs: logs, sub: sub}, nil +} + +// WatchProtocolFeeFactorUpdated is a free log subscription operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. +// +// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchProtocolFeeFactorUpdated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolProtocolFeeFactorUpdated) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "ProtocolFeeFactorUpdated") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolProtocolFeeFactorUpdated) + if err := _SDUtilityPool.contract.UnpackLog(event, "ProtocolFeeFactorUpdated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseProtocolFeeFactorUpdated is a log parse operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. +// +// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseProtocolFeeFactorUpdated(log types.Log) (*SDUtilityPoolProtocolFeeFactorUpdated, error) { + event := new(SDUtilityPoolProtocolFeeFactorUpdated) + if err := _SDUtilityPool.contract.UnpackLog(event, "ProtocolFeeFactorUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolRedeemedIterator is returned from FilterRedeemed and is used to iterate over the raw logs and unpacked data for Redeemed events raised by the SDUtilityPool contract. +type SDUtilityPoolRedeemedIterator struct { + Event *SDUtilityPoolRedeemed // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolRedeemedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolRedeemed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolRedeemed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolRedeemedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolRedeemedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolRedeemed represents a Redeemed event raised by the SDUtilityPool contract. +type SDUtilityPoolRedeemed struct { + Delegator common.Address + SdAmount *big.Int + SdXAmount *big.Int + Raw types.Log // Blockchain specific contextual infos } -// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. +// FilterRedeemed is a free log retrieval operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. // -// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() -func (_SDUtilityPool *SDUtilityPoolSession) UtilizeWhileAddingKeys(operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UtilizeWhileAddingKeys(&_SDUtilityPool.TransactOpts, operator, utilizeAmount, nonTerminalKeyCount) -} +// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRedeemed(opts *bind.FilterOpts, delegator []common.Address) (*SDUtilityPoolRedeemedIterator, error) { -// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. -// -// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UtilizeWhileAddingKeys(operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UtilizeWhileAddingKeys(&_SDUtilityPool.TransactOpts, operator, utilizeAmount, nonTerminalKeyCount) -} + var delegatorRule []interface{} + for _, delegatorItem := range delegator { + delegatorRule = append(delegatorRule, delegatorItem) + } -// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. -// -// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactor) UtilizerBalanceCurrent(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "utilizerBalanceCurrent", account) + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Redeemed", delegatorRule) + if err != nil { + return nil, err + } + return &SDUtilityPoolRedeemedIterator{contract: _SDUtilityPool.contract, event: "Redeemed", logs: logs, sub: sub}, nil } -// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. +// WatchRedeemed is a free log subscription operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. // -// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) UtilizerBalanceCurrent(account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UtilizerBalanceCurrent(&_SDUtilityPool.TransactOpts, account) +// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRedeemed(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRedeemed, delegator []common.Address) (event.Subscription, error) { + + var delegatorRule []interface{} + for _, delegatorItem := range delegator { + delegatorRule = append(delegatorRule, delegatorItem) + } + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Redeemed", delegatorRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolRedeemed) + if err := _SDUtilityPool.contract.UnpackLog(event, "Redeemed", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil } -// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. +// ParseRedeemed is a log parse operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. // -// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UtilizerBalanceCurrent(account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UtilizerBalanceCurrent(&_SDUtilityPool.TransactOpts, account) +// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRedeemed(log types.Log) (*SDUtilityPoolRedeemed, error) { + event := new(SDUtilityPoolRedeemed) + if err := _SDUtilityPool.contract.UnpackLog(event, "Redeemed", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil } -// SDUtilityPoolAccruedFeesIterator is returned from FilterAccruedFees and is used to iterate over the raw logs and unpacked data for AccruedFees events raised by the SDUtilityPool contract. -type SDUtilityPoolAccruedFeesIterator struct { - Event *SDUtilityPoolAccruedFees // Event containing the contract specifics and raw log +// SDUtilityPoolRepaidIterator is returned from FilterRepaid and is used to iterate over the raw logs and unpacked data for Repaid events raised by the SDUtilityPool contract. +type SDUtilityPoolRepaidIterator struct { + Event *SDUtilityPoolRepaid // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -988,7 +3619,7 @@ type SDUtilityPoolAccruedFeesIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolAccruedFeesIterator) Next() bool { +func (it *SDUtilityPoolRepaidIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -997,7 +3628,7 @@ func (it *SDUtilityPoolAccruedFeesIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolAccruedFees) + it.Event = new(SDUtilityPoolRepaid) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1012,7 +3643,7 @@ func (it *SDUtilityPoolAccruedFeesIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolAccruedFees) + it.Event = new(SDUtilityPoolRepaid) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1028,43 +3659,52 @@ func (it *SDUtilityPoolAccruedFeesIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolAccruedFeesIterator) Error() error { +func (it *SDUtilityPoolRepaidIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolAccruedFeesIterator) Close() error { +func (it *SDUtilityPoolRepaidIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolAccruedFees represents a AccruedFees event raised by the SDUtilityPool contract. -type SDUtilityPoolAccruedFees struct { - FeeAccumulated *big.Int - TotalProtocolFee *big.Int - TotalUtilizedSD *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolRepaid represents a Repaid event raised by the SDUtilityPool contract. +type SDUtilityPoolRepaid struct { + Utilizer common.Address + RepayAmount *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterAccruedFees is a free log retrieval operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. +// FilterRepaid is a free log retrieval operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. // -// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterAccruedFees(opts *bind.FilterOpts) (*SDUtilityPoolAccruedFeesIterator, error) { +// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRepaid(opts *bind.FilterOpts, utilizer []common.Address) (*SDUtilityPoolRepaidIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "AccruedFees") + var utilizerRule []interface{} + for _, utilizerItem := range utilizer { + utilizerRule = append(utilizerRule, utilizerItem) + } + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Repaid", utilizerRule) if err != nil { return nil, err } - return &SDUtilityPoolAccruedFeesIterator{contract: _SDUtilityPool.contract, event: "AccruedFees", logs: logs, sub: sub}, nil + return &SDUtilityPoolRepaidIterator{contract: _SDUtilityPool.contract, event: "Repaid", logs: logs, sub: sub}, nil } -// WatchAccruedFees is a free log subscription operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. +// WatchRepaid is a free log subscription operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. // -// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchAccruedFees(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolAccruedFees) (event.Subscription, error) { +// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRepaid(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRepaid, utilizer []common.Address) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "AccruedFees") + var utilizerRule []interface{} + for _, utilizerItem := range utilizer { + utilizerRule = append(utilizerRule, utilizerItem) + } + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Repaid", utilizerRule) if err != nil { return nil, err } @@ -1074,8 +3714,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchAccruedFees(opts *bind.WatchOp select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolAccruedFees) - if err := _SDUtilityPool.contract.UnpackLog(event, "AccruedFees", log); err != nil { + event := new(SDUtilityPoolRepaid) + if err := _SDUtilityPool.contract.UnpackLog(event, "Repaid", log); err != nil { return err } event.Raw = log @@ -1096,21 +3736,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchAccruedFees(opts *bind.WatchOp }), nil } -// ParseAccruedFees is a log parse operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. +// ParseRepaid is a log parse operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. // -// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseAccruedFees(log types.Log) (*SDUtilityPoolAccruedFees, error) { - event := new(SDUtilityPoolAccruedFees) - if err := _SDUtilityPool.contract.UnpackLog(event, "AccruedFees", log); err != nil { +// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRepaid(log types.Log) (*SDUtilityPoolRepaid, error) { + event := new(SDUtilityPoolRepaid) + if err := _SDUtilityPool.contract.UnpackLog(event, "Repaid", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolDelegatedIterator is returned from FilterDelegated and is used to iterate over the raw logs and unpacked data for Delegated events raised by the SDUtilityPool contract. -type SDUtilityPoolDelegatedIterator struct { - Event *SDUtilityPoolDelegated // Event containing the contract specifics and raw log +// SDUtilityPoolRequestRedeemedIterator is returned from FilterRequestRedeemed and is used to iterate over the raw logs and unpacked data for RequestRedeemed events raised by the SDUtilityPool contract. +type SDUtilityPoolRequestRedeemedIterator struct { + Event *SDUtilityPoolRequestRedeemed // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1124,7 +3764,7 @@ type SDUtilityPoolDelegatedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolDelegatedIterator) Next() bool { +func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1133,7 +3773,7 @@ func (it *SDUtilityPoolDelegatedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolDelegated) + it.Event = new(SDUtilityPoolRequestRedeemed) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1148,7 +3788,7 @@ func (it *SDUtilityPoolDelegatedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolDelegated) + it.Event = new(SDUtilityPoolRequestRedeemed) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1164,53 +3804,42 @@ func (it *SDUtilityPoolDelegatedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolDelegatedIterator) Error() error { +func (it *SDUtilityPoolRequestRedeemedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolDelegatedIterator) Close() error { +func (it *SDUtilityPoolRequestRedeemedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolDelegated represents a Delegated event raised by the SDUtilityPool contract. -type SDUtilityPoolDelegated struct { - Delegator common.Address - SdAmount *big.Int - SdXToMint *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolRequestRedeemed represents a RequestRedeemed event raised by the SDUtilityPool contract. +type SDUtilityPoolRequestRedeemed struct { + Caller common.Address + SdToTransfer *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterDelegated is a free log retrieval operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// FilterRequestRedeemed is a free log retrieval operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. // -// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterDelegated(opts *bind.FilterOpts, delegator []common.Address) (*SDUtilityPoolDelegatedIterator, error) { - - var delegatorRule []interface{} - for _, delegatorItem := range delegator { - delegatorRule = append(delegatorRule, delegatorItem) - } +// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRequestRedeemed(opts *bind.FilterOpts) (*SDUtilityPoolRequestRedeemedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Delegated", delegatorRule) + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RequestRedeemed") if err != nil { return nil, err } - return &SDUtilityPoolDelegatedIterator{contract: _SDUtilityPool.contract, event: "Delegated", logs: logs, sub: sub}, nil + return &SDUtilityPoolRequestRedeemedIterator{contract: _SDUtilityPool.contract, event: "RequestRedeemed", logs: logs, sub: sub}, nil } -// WatchDelegated is a free log subscription operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// WatchRequestRedeemed is a free log subscription operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. // -// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchDelegated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolDelegated, delegator []common.Address) (event.Subscription, error) { - - var delegatorRule []interface{} - for _, delegatorItem := range delegator { - delegatorRule = append(delegatorRule, delegatorItem) - } +// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRequestRedeemed(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRequestRedeemed) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Delegated", delegatorRule) + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RequestRedeemed") if err != nil { return nil, err } @@ -1220,8 +3849,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchDelegated(opts *bind.WatchOpts select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolDelegated) - if err := _SDUtilityPool.contract.UnpackLog(event, "Delegated", log); err != nil { + event := new(SDUtilityPoolRequestRedeemed) + if err := _SDUtilityPool.contract.UnpackLog(event, "RequestRedeemed", log); err != nil { return err } event.Raw = log @@ -1242,21 +3871,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchDelegated(opts *bind.WatchOpts }), nil } -// ParseDelegated is a log parse operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// ParseRequestRedeemed is a log parse operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. // -// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseDelegated(log types.Log) (*SDUtilityPoolDelegated, error) { - event := new(SDUtilityPoolDelegated) - if err := _SDUtilityPool.contract.UnpackLog(event, "Delegated", log); err != nil { +// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRequestRedeemed(log types.Log) (*SDUtilityPoolRequestRedeemed, error) { + event := new(SDUtilityPoolRequestRedeemed) + if err := _SDUtilityPool.contract.UnpackLog(event, "RequestRedeemed", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolFinalizedWithdrawRequestIterator is returned from FilterFinalizedWithdrawRequest and is used to iterate over the raw logs and unpacked data for FinalizedWithdrawRequest events raised by the SDUtilityPool contract. -type SDUtilityPoolFinalizedWithdrawRequestIterator struct { - Event *SDUtilityPoolFinalizedWithdrawRequest // Event containing the contract specifics and raw log +// SDUtilityPoolRiskConfigUpdatedIterator is returned from FilterRiskConfigUpdated and is used to iterate over the raw logs and unpacked data for RiskConfigUpdated events raised by the SDUtilityPool contract. +type SDUtilityPoolRiskConfigUpdatedIterator struct { + Event *SDUtilityPoolRiskConfigUpdated // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1270,7 +3899,7 @@ type SDUtilityPoolFinalizedWithdrawRequestIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Next() bool { +func (it *SDUtilityPoolRiskConfigUpdatedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1279,7 +3908,7 @@ func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolFinalizedWithdrawRequest) + it.Event = new(SDUtilityPoolRiskConfigUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1294,7 +3923,7 @@ func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolFinalizedWithdrawRequest) + it.Event = new(SDUtilityPoolRiskConfigUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1310,41 +3939,44 @@ func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Error() error { +func (it *SDUtilityPoolRiskConfigUpdatedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Close() error { +func (it *SDUtilityPoolRiskConfigUpdatedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolFinalizedWithdrawRequest represents a FinalizedWithdrawRequest event raised by the SDUtilityPool contract. -type SDUtilityPoolFinalizedWithdrawRequest struct { - NextRequestIdToFinalize *big.Int +// SDUtilityPoolRiskConfigUpdated represents a RiskConfigUpdated event raised by the SDUtilityPool contract. +type SDUtilityPoolRiskConfigUpdated struct { + LiquidationThreshold *big.Int + LiquidationBonusPercent *big.Int + LiquidationFeePercent *big.Int + Ltv *big.Int Raw types.Log // Blockchain specific contextual infos } -// FilterFinalizedWithdrawRequest is a free log retrieval operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. +// FilterRiskConfigUpdated is a free log retrieval operation binding the contract event 0x62dd46f943681bd727e339f4baaa19fb66ea209fbe7d9b4a75aa74c33acc18f3. // -// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterFinalizedWithdrawRequest(opts *bind.FilterOpts) (*SDUtilityPoolFinalizedWithdrawRequestIterator, error) { +// Solidity: event RiskConfigUpdated(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRiskConfigUpdated(opts *bind.FilterOpts) (*SDUtilityPoolRiskConfigUpdatedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "FinalizedWithdrawRequest") + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RiskConfigUpdated") if err != nil { return nil, err } - return &SDUtilityPoolFinalizedWithdrawRequestIterator{contract: _SDUtilityPool.contract, event: "FinalizedWithdrawRequest", logs: logs, sub: sub}, nil + return &SDUtilityPoolRiskConfigUpdatedIterator{contract: _SDUtilityPool.contract, event: "RiskConfigUpdated", logs: logs, sub: sub}, nil } -// WatchFinalizedWithdrawRequest is a free log subscription operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. +// WatchRiskConfigUpdated is a free log subscription operation binding the contract event 0x62dd46f943681bd727e339f4baaa19fb66ea209fbe7d9b4a75aa74c33acc18f3. // -// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchFinalizedWithdrawRequest(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolFinalizedWithdrawRequest) (event.Subscription, error) { +// Solidity: event RiskConfigUpdated(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRiskConfigUpdated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRiskConfigUpdated) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "FinalizedWithdrawRequest") + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RiskConfigUpdated") if err != nil { return nil, err } @@ -1354,8 +3986,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchFinalizedWithdrawRequest(opts select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolFinalizedWithdrawRequest) - if err := _SDUtilityPool.contract.UnpackLog(event, "FinalizedWithdrawRequest", log); err != nil { + event := new(SDUtilityPoolRiskConfigUpdated) + if err := _SDUtilityPool.contract.UnpackLog(event, "RiskConfigUpdated", log); err != nil { return err } event.Raw = log @@ -1376,21 +4008,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchFinalizedWithdrawRequest(opts }), nil } -// ParseFinalizedWithdrawRequest is a log parse operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. +// ParseRiskConfigUpdated is a log parse operation binding the contract event 0x62dd46f943681bd727e339f4baaa19fb66ea209fbe7d9b4a75aa74c33acc18f3. // -// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseFinalizedWithdrawRequest(log types.Log) (*SDUtilityPoolFinalizedWithdrawRequest, error) { - event := new(SDUtilityPoolFinalizedWithdrawRequest) - if err := _SDUtilityPool.contract.UnpackLog(event, "FinalizedWithdrawRequest", log); err != nil { +// Solidity: event RiskConfigUpdated(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRiskConfigUpdated(log types.Log) (*SDUtilityPoolRiskConfigUpdated, error) { + event := new(SDUtilityPoolRiskConfigUpdated) + if err := _SDUtilityPool.contract.UnpackLog(event, "RiskConfigUpdated", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolProtocolFeeFactorUpdatedIterator is returned from FilterProtocolFeeFactorUpdated and is used to iterate over the raw logs and unpacked data for ProtocolFeeFactorUpdated events raised by the SDUtilityPool contract. -type SDUtilityPoolProtocolFeeFactorUpdatedIterator struct { - Event *SDUtilityPoolProtocolFeeFactorUpdated // Event containing the contract specifics and raw log +// SDUtilityPoolRoleAdminChangedIterator is returned from FilterRoleAdminChanged and is used to iterate over the raw logs and unpacked data for RoleAdminChanged events raised by the SDUtilityPool contract. +type SDUtilityPoolRoleAdminChangedIterator struct { + Event *SDUtilityPoolRoleAdminChanged // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1404,7 +4036,7 @@ type SDUtilityPoolProtocolFeeFactorUpdatedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Next() bool { +func (it *SDUtilityPoolRoleAdminChangedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1413,7 +4045,7 @@ func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolProtocolFeeFactorUpdated) + it.Event = new(SDUtilityPoolRoleAdminChanged) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1428,7 +4060,7 @@ func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolProtocolFeeFactorUpdated) + it.Event = new(SDUtilityPoolRoleAdminChanged) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1444,41 +4076,69 @@ func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Error() error { +func (it *SDUtilityPoolRoleAdminChangedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Close() error { +func (it *SDUtilityPoolRoleAdminChangedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolProtocolFeeFactorUpdated represents a ProtocolFeeFactorUpdated event raised by the SDUtilityPool contract. -type SDUtilityPoolProtocolFeeFactorUpdated struct { - ProtocolFeeFactor *big.Int +// SDUtilityPoolRoleAdminChanged represents a RoleAdminChanged event raised by the SDUtilityPool contract. +type SDUtilityPoolRoleAdminChanged struct { + Role [32]byte + PreviousAdminRole [32]byte + NewAdminRole [32]byte Raw types.Log // Blockchain specific contextual infos } -// FilterProtocolFeeFactorUpdated is a free log retrieval operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. +// FilterRoleAdminChanged is a free log retrieval operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. // -// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterProtocolFeeFactorUpdated(opts *bind.FilterOpts) (*SDUtilityPoolProtocolFeeFactorUpdatedIterator, error) { +// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRoleAdminChanged(opts *bind.FilterOpts, role [][32]byte, previousAdminRole [][32]byte, newAdminRole [][32]byte) (*SDUtilityPoolRoleAdminChangedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "ProtocolFeeFactorUpdated") + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var previousAdminRoleRule []interface{} + for _, previousAdminRoleItem := range previousAdminRole { + previousAdminRoleRule = append(previousAdminRoleRule, previousAdminRoleItem) + } + var newAdminRoleRule []interface{} + for _, newAdminRoleItem := range newAdminRole { + newAdminRoleRule = append(newAdminRoleRule, newAdminRoleItem) + } + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RoleAdminChanged", roleRule, previousAdminRoleRule, newAdminRoleRule) if err != nil { return nil, err } - return &SDUtilityPoolProtocolFeeFactorUpdatedIterator{contract: _SDUtilityPool.contract, event: "ProtocolFeeFactorUpdated", logs: logs, sub: sub}, nil + return &SDUtilityPoolRoleAdminChangedIterator{contract: _SDUtilityPool.contract, event: "RoleAdminChanged", logs: logs, sub: sub}, nil } -// WatchProtocolFeeFactorUpdated is a free log subscription operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. +// WatchRoleAdminChanged is a free log subscription operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. // -// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchProtocolFeeFactorUpdated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolProtocolFeeFactorUpdated) (event.Subscription, error) { +// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRoleAdminChanged(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRoleAdminChanged, role [][32]byte, previousAdminRole [][32]byte, newAdminRole [][32]byte) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "ProtocolFeeFactorUpdated") + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var previousAdminRoleRule []interface{} + for _, previousAdminRoleItem := range previousAdminRole { + previousAdminRoleRule = append(previousAdminRoleRule, previousAdminRoleItem) + } + var newAdminRoleRule []interface{} + for _, newAdminRoleItem := range newAdminRole { + newAdminRoleRule = append(newAdminRoleRule, newAdminRoleItem) + } + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RoleAdminChanged", roleRule, previousAdminRoleRule, newAdminRoleRule) if err != nil { return nil, err } @@ -1488,8 +4148,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchProtocolFeeFactorUpdated(opts select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolProtocolFeeFactorUpdated) - if err := _SDUtilityPool.contract.UnpackLog(event, "ProtocolFeeFactorUpdated", log); err != nil { + event := new(SDUtilityPoolRoleAdminChanged) + if err := _SDUtilityPool.contract.UnpackLog(event, "RoleAdminChanged", log); err != nil { return err } event.Raw = log @@ -1510,21 +4170,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchProtocolFeeFactorUpdated(opts }), nil } -// ParseProtocolFeeFactorUpdated is a log parse operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. +// ParseRoleAdminChanged is a log parse operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. // -// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseProtocolFeeFactorUpdated(log types.Log) (*SDUtilityPoolProtocolFeeFactorUpdated, error) { - event := new(SDUtilityPoolProtocolFeeFactorUpdated) - if err := _SDUtilityPool.contract.UnpackLog(event, "ProtocolFeeFactorUpdated", log); err != nil { +// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRoleAdminChanged(log types.Log) (*SDUtilityPoolRoleAdminChanged, error) { + event := new(SDUtilityPoolRoleAdminChanged) + if err := _SDUtilityPool.contract.UnpackLog(event, "RoleAdminChanged", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolRedeemedIterator is returned from FilterRedeemed and is used to iterate over the raw logs and unpacked data for Redeemed events raised by the SDUtilityPool contract. -type SDUtilityPoolRedeemedIterator struct { - Event *SDUtilityPoolRedeemed // Event containing the contract specifics and raw log +// SDUtilityPoolRoleGrantedIterator is returned from FilterRoleGranted and is used to iterate over the raw logs and unpacked data for RoleGranted events raised by the SDUtilityPool contract. +type SDUtilityPoolRoleGrantedIterator struct { + Event *SDUtilityPoolRoleGranted // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1538,7 +4198,7 @@ type SDUtilityPoolRedeemedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolRedeemedIterator) Next() bool { +func (it *SDUtilityPoolRoleGrantedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1547,7 +4207,7 @@ func (it *SDUtilityPoolRedeemedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRedeemed) + it.Event = new(SDUtilityPoolRoleGranted) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1562,7 +4222,7 @@ func (it *SDUtilityPoolRedeemedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRedeemed) + it.Event = new(SDUtilityPoolRoleGranted) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1578,53 +4238,69 @@ func (it *SDUtilityPoolRedeemedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolRedeemedIterator) Error() error { +func (it *SDUtilityPoolRoleGrantedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolRedeemedIterator) Close() error { +func (it *SDUtilityPoolRoleGrantedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolRedeemed represents a Redeemed event raised by the SDUtilityPool contract. -type SDUtilityPoolRedeemed struct { - Delegator common.Address - SdAmount *big.Int - SdXAmount *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolRoleGranted represents a RoleGranted event raised by the SDUtilityPool contract. +type SDUtilityPoolRoleGranted struct { + Role [32]byte + Account common.Address + Sender common.Address + Raw types.Log // Blockchain specific contextual infos } -// FilterRedeemed is a free log retrieval operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. +// FilterRoleGranted is a free log retrieval operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. // -// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRedeemed(opts *bind.FilterOpts, delegator []common.Address) (*SDUtilityPoolRedeemedIterator, error) { +// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRoleGranted(opts *bind.FilterOpts, role [][32]byte, account []common.Address, sender []common.Address) (*SDUtilityPoolRoleGrantedIterator, error) { - var delegatorRule []interface{} - for _, delegatorItem := range delegator { - delegatorRule = append(delegatorRule, delegatorItem) + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) } - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Redeemed", delegatorRule) + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RoleGranted", roleRule, accountRule, senderRule) if err != nil { return nil, err } - return &SDUtilityPoolRedeemedIterator{contract: _SDUtilityPool.contract, event: "Redeemed", logs: logs, sub: sub}, nil + return &SDUtilityPoolRoleGrantedIterator{contract: _SDUtilityPool.contract, event: "RoleGranted", logs: logs, sub: sub}, nil } -// WatchRedeemed is a free log subscription operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. +// WatchRoleGranted is a free log subscription operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. // -// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRedeemed(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRedeemed, delegator []common.Address) (event.Subscription, error) { +// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRoleGranted(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRoleGranted, role [][32]byte, account []common.Address, sender []common.Address) (event.Subscription, error) { - var delegatorRule []interface{} - for _, delegatorItem := range delegator { - delegatorRule = append(delegatorRule, delegatorItem) + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) } - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Redeemed", delegatorRule) + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RoleGranted", roleRule, accountRule, senderRule) if err != nil { return nil, err } @@ -1634,8 +4310,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRedeemed(opts *bind.WatchOpts, select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolRedeemed) - if err := _SDUtilityPool.contract.UnpackLog(event, "Redeemed", log); err != nil { + event := new(SDUtilityPoolRoleGranted) + if err := _SDUtilityPool.contract.UnpackLog(event, "RoleGranted", log); err != nil { return err } event.Raw = log @@ -1656,21 +4332,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRedeemed(opts *bind.WatchOpts, }), nil } -// ParseRedeemed is a log parse operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. +// ParseRoleGranted is a log parse operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. // -// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRedeemed(log types.Log) (*SDUtilityPoolRedeemed, error) { - event := new(SDUtilityPoolRedeemed) - if err := _SDUtilityPool.contract.UnpackLog(event, "Redeemed", log); err != nil { +// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRoleGranted(log types.Log) (*SDUtilityPoolRoleGranted, error) { + event := new(SDUtilityPoolRoleGranted) + if err := _SDUtilityPool.contract.UnpackLog(event, "RoleGranted", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolRepaidIterator is returned from FilterRepaid and is used to iterate over the raw logs and unpacked data for Repaid events raised by the SDUtilityPool contract. -type SDUtilityPoolRepaidIterator struct { - Event *SDUtilityPoolRepaid // Event containing the contract specifics and raw log +// SDUtilityPoolRoleRevokedIterator is returned from FilterRoleRevoked and is used to iterate over the raw logs and unpacked data for RoleRevoked events raised by the SDUtilityPool contract. +type SDUtilityPoolRoleRevokedIterator struct { + Event *SDUtilityPoolRoleRevoked // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1684,7 +4360,7 @@ type SDUtilityPoolRepaidIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolRepaidIterator) Next() bool { +func (it *SDUtilityPoolRoleRevokedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1693,7 +4369,7 @@ func (it *SDUtilityPoolRepaidIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRepaid) + it.Event = new(SDUtilityPoolRoleRevoked) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1708,7 +4384,7 @@ func (it *SDUtilityPoolRepaidIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRepaid) + it.Event = new(SDUtilityPoolRoleRevoked) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1724,52 +4400,69 @@ func (it *SDUtilityPoolRepaidIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolRepaidIterator) Error() error { +func (it *SDUtilityPoolRoleRevokedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolRepaidIterator) Close() error { +func (it *SDUtilityPoolRoleRevokedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolRepaid represents a Repaid event raised by the SDUtilityPool contract. -type SDUtilityPoolRepaid struct { - Utilizer common.Address - RepayAmount *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolRoleRevoked represents a RoleRevoked event raised by the SDUtilityPool contract. +type SDUtilityPoolRoleRevoked struct { + Role [32]byte + Account common.Address + Sender common.Address + Raw types.Log // Blockchain specific contextual infos } -// FilterRepaid is a free log retrieval operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. +// FilterRoleRevoked is a free log retrieval operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. // -// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRepaid(opts *bind.FilterOpts, utilizer []common.Address) (*SDUtilityPoolRepaidIterator, error) { +// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRoleRevoked(opts *bind.FilterOpts, role [][32]byte, account []common.Address, sender []common.Address) (*SDUtilityPoolRoleRevokedIterator, error) { - var utilizerRule []interface{} - for _, utilizerItem := range utilizer { - utilizerRule = append(utilizerRule, utilizerItem) + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) } - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Repaid", utilizerRule) + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RoleRevoked", roleRule, accountRule, senderRule) if err != nil { return nil, err } - return &SDUtilityPoolRepaidIterator{contract: _SDUtilityPool.contract, event: "Repaid", logs: logs, sub: sub}, nil + return &SDUtilityPoolRoleRevokedIterator{contract: _SDUtilityPool.contract, event: "RoleRevoked", logs: logs, sub: sub}, nil } -// WatchRepaid is a free log subscription operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. +// WatchRoleRevoked is a free log subscription operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. // -// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRepaid(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRepaid, utilizer []common.Address) (event.Subscription, error) { +// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRoleRevoked(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRoleRevoked, role [][32]byte, account []common.Address, sender []common.Address) (event.Subscription, error) { - var utilizerRule []interface{} - for _, utilizerItem := range utilizer { - utilizerRule = append(utilizerRule, utilizerItem) + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) } - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Repaid", utilizerRule) + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RoleRevoked", roleRule, accountRule, senderRule) if err != nil { return nil, err } @@ -1779,8 +4472,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRepaid(opts *bind.WatchOpts, s select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolRepaid) - if err := _SDUtilityPool.contract.UnpackLog(event, "Repaid", log); err != nil { + event := new(SDUtilityPoolRoleRevoked) + if err := _SDUtilityPool.contract.UnpackLog(event, "RoleRevoked", log); err != nil { return err } event.Raw = log @@ -1801,21 +4494,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRepaid(opts *bind.WatchOpts, s }), nil } -// ParseRepaid is a log parse operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. +// ParseRoleRevoked is a log parse operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. // -// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRepaid(log types.Log) (*SDUtilityPoolRepaid, error) { - event := new(SDUtilityPoolRepaid) - if err := _SDUtilityPool.contract.UnpackLog(event, "Repaid", log); err != nil { +// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRoleRevoked(log types.Log) (*SDUtilityPoolRoleRevoked, error) { + event := new(SDUtilityPoolRoleRevoked) + if err := _SDUtilityPool.contract.UnpackLog(event, "RoleRevoked", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolRequestRedeemedIterator is returned from FilterRequestRedeemed and is used to iterate over the raw logs and unpacked data for RequestRedeemed events raised by the SDUtilityPool contract. -type SDUtilityPoolRequestRedeemedIterator struct { - Event *SDUtilityPoolRequestRedeemed // Event containing the contract specifics and raw log +// SDUtilityPoolSDUtilizedIterator is returned from FilterSDUtilized and is used to iterate over the raw logs and unpacked data for SDUtilized events raised by the SDUtilityPool contract. +type SDUtilityPoolSDUtilizedIterator struct { + Event *SDUtilityPoolSDUtilized // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1829,7 +4522,7 @@ type SDUtilityPoolRequestRedeemedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { +func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1838,7 +4531,7 @@ func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRequestRedeemed) + it.Event = new(SDUtilityPoolSDUtilized) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1853,7 +4546,7 @@ func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRequestRedeemed) + it.Event = new(SDUtilityPoolSDUtilized) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1869,42 +4562,42 @@ func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolRequestRedeemedIterator) Error() error { +func (it *SDUtilityPoolSDUtilizedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolRequestRedeemedIterator) Close() error { +func (it *SDUtilityPoolSDUtilizedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolRequestRedeemed represents a RequestRedeemed event raised by the SDUtilityPool contract. -type SDUtilityPoolRequestRedeemed struct { - Caller common.Address - SdToTransfer *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolSDUtilized represents a SDUtilized event raised by the SDUtilityPool contract. +type SDUtilityPoolSDUtilized struct { + Utilizer common.Address + UtilizeAmount *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterRequestRedeemed is a free log retrieval operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. +// FilterSDUtilized is a free log retrieval operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. // -// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRequestRedeemed(opts *bind.FilterOpts) (*SDUtilityPoolRequestRedeemedIterator, error) { +// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterSDUtilized(opts *bind.FilterOpts) (*SDUtilityPoolSDUtilizedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RequestRedeemed") + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "SDUtilized") if err != nil { return nil, err } - return &SDUtilityPoolRequestRedeemedIterator{contract: _SDUtilityPool.contract, event: "RequestRedeemed", logs: logs, sub: sub}, nil + return &SDUtilityPoolSDUtilizedIterator{contract: _SDUtilityPool.contract, event: "SDUtilized", logs: logs, sub: sub}, nil } -// WatchRequestRedeemed is a free log subscription operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. +// WatchSDUtilized is a free log subscription operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. // -// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRequestRedeemed(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRequestRedeemed) (event.Subscription, error) { +// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchSDUtilized(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolSDUtilized) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RequestRedeemed") + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "SDUtilized") if err != nil { return nil, err } @@ -1914,8 +4607,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRequestRedeemed(opts *bind.Wat select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolRequestRedeemed) - if err := _SDUtilityPool.contract.UnpackLog(event, "RequestRedeemed", log); err != nil { + event := new(SDUtilityPoolSDUtilized) + if err := _SDUtilityPool.contract.UnpackLog(event, "SDUtilized", log); err != nil { return err } event.Raw = log @@ -1936,21 +4629,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRequestRedeemed(opts *bind.Wat }), nil } -// ParseRequestRedeemed is a log parse operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. +// ParseSDUtilized is a log parse operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. // -// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRequestRedeemed(log types.Log) (*SDUtilityPoolRequestRedeemed, error) { - event := new(SDUtilityPoolRequestRedeemed) - if err := _SDUtilityPool.contract.UnpackLog(event, "RequestRedeemed", log); err != nil { +// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseSDUtilized(log types.Log) (*SDUtilityPoolSDUtilized, error) { + event := new(SDUtilityPoolSDUtilized) + if err := _SDUtilityPool.contract.UnpackLog(event, "SDUtilized", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolSDUtilizedIterator is returned from FilterSDUtilized and is used to iterate over the raw logs and unpacked data for SDUtilized events raised by the SDUtilityPool contract. -type SDUtilityPoolSDUtilizedIterator struct { - Event *SDUtilityPoolSDUtilized // Event containing the contract specifics and raw log +// SDUtilityPoolUnpausedIterator is returned from FilterUnpaused and is used to iterate over the raw logs and unpacked data for Unpaused events raised by the SDUtilityPool contract. +type SDUtilityPoolUnpausedIterator struct { + Event *SDUtilityPoolUnpaused // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1964,7 +4657,7 @@ type SDUtilityPoolSDUtilizedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { +func (it *SDUtilityPoolUnpausedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1973,7 +4666,7 @@ func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolSDUtilized) + it.Event = new(SDUtilityPoolUnpaused) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1988,7 +4681,7 @@ func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolSDUtilized) + it.Event = new(SDUtilityPoolUnpaused) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2004,42 +4697,41 @@ func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolSDUtilizedIterator) Error() error { +func (it *SDUtilityPoolUnpausedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolSDUtilizedIterator) Close() error { +func (it *SDUtilityPoolUnpausedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolSDUtilized represents a SDUtilized event raised by the SDUtilityPool contract. -type SDUtilityPoolSDUtilized struct { - Utilizer common.Address - UtilizeAmount *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolUnpaused represents a Unpaused event raised by the SDUtilityPool contract. +type SDUtilityPoolUnpaused struct { + Account common.Address + Raw types.Log // Blockchain specific contextual infos } -// FilterSDUtilized is a free log retrieval operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. +// FilterUnpaused is a free log retrieval operation binding the contract event 0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa. // -// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterSDUtilized(opts *bind.FilterOpts) (*SDUtilityPoolSDUtilizedIterator, error) { +// Solidity: event Unpaused(address account) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterUnpaused(opts *bind.FilterOpts) (*SDUtilityPoolUnpausedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "SDUtilized") + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Unpaused") if err != nil { return nil, err } - return &SDUtilityPoolSDUtilizedIterator{contract: _SDUtilityPool.contract, event: "SDUtilized", logs: logs, sub: sub}, nil + return &SDUtilityPoolUnpausedIterator{contract: _SDUtilityPool.contract, event: "Unpaused", logs: logs, sub: sub}, nil } -// WatchSDUtilized is a free log subscription operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. +// WatchUnpaused is a free log subscription operation binding the contract event 0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa. // -// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchSDUtilized(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolSDUtilized) (event.Subscription, error) { +// Solidity: event Unpaused(address account) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchUnpaused(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolUnpaused) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "SDUtilized") + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Unpaused") if err != nil { return nil, err } @@ -2049,8 +4741,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchSDUtilized(opts *bind.WatchOpt select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolSDUtilized) - if err := _SDUtilityPool.contract.UnpackLog(event, "SDUtilized", log); err != nil { + event := new(SDUtilityPoolUnpaused) + if err := _SDUtilityPool.contract.UnpackLog(event, "Unpaused", log); err != nil { return err } event.Raw = log @@ -2071,12 +4763,12 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchSDUtilized(opts *bind.WatchOpt }), nil } -// ParseSDUtilized is a log parse operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. +// ParseUnpaused is a log parse operation binding the contract event 0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa. // -// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseSDUtilized(log types.Log) (*SDUtilityPoolSDUtilized, error) { - event := new(SDUtilityPoolSDUtilized) - if err := _SDUtilityPool.contract.UnpackLog(event, "SDUtilized", log); err != nil { +// Solidity: event Unpaused(address account) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseUnpaused(log types.Log) (*SDUtilityPoolUnpaused, error) { + event := new(SDUtilityPoolUnpaused) + if err := _SDUtilityPool.contract.UnpackLog(event, "Unpaused", log); err != nil { return nil, err } event.Raw = log @@ -3031,9 +5723,9 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) ParseUtilizationRatePerBlockUpdated return event, nil } -// SDUtilityPoolUtilizerSDSlashingHandledIterator is returned from FilterUtilizerSDSlashingHandled and is used to iterate over the raw logs and unpacked data for UtilizerSDSlashingHandled events raised by the SDUtilityPool contract. -type SDUtilityPoolUtilizerSDSlashingHandledIterator struct { - Event *SDUtilityPoolUtilizerSDSlashingHandled // Event containing the contract specifics and raw log +// SDUtilityPoolWithdrawRequestReceivedIterator is returned from FilterWithdrawRequestReceived and is used to iterate over the raw logs and unpacked data for WithdrawRequestReceived events raised by the SDUtilityPool contract. +type SDUtilityPoolWithdrawRequestReceivedIterator struct { + Event *SDUtilityPoolWithdrawRequestReceived // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -3047,7 +5739,7 @@ type SDUtilityPoolUtilizerSDSlashingHandledIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolUtilizerSDSlashingHandledIterator) Next() bool { +func (it *SDUtilityPoolWithdrawRequestReceivedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -3056,7 +5748,7 @@ func (it *SDUtilityPoolUtilizerSDSlashingHandledIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolUtilizerSDSlashingHandled) + it.Event = new(SDUtilityPoolWithdrawRequestReceived) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -3071,7 +5763,7 @@ func (it *SDUtilityPoolUtilizerSDSlashingHandledIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolUtilizerSDSlashingHandled) + it.Event = new(SDUtilityPoolWithdrawRequestReceived) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -3087,42 +5779,43 @@ func (it *SDUtilityPoolUtilizerSDSlashingHandledIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolUtilizerSDSlashingHandledIterator) Error() error { +func (it *SDUtilityPoolWithdrawRequestReceivedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolUtilizerSDSlashingHandledIterator) Close() error { +func (it *SDUtilityPoolWithdrawRequestReceivedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolUtilizerSDSlashingHandled represents a UtilizerSDSlashingHandled event raised by the SDUtilityPool contract. -type SDUtilityPoolUtilizerSDSlashingHandled struct { - Utilizer common.Address - SlashSDAmount *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolWithdrawRequestReceived represents a WithdrawRequestReceived event raised by the SDUtilityPool contract. +type SDUtilityPoolWithdrawRequestReceived struct { + Caller common.Address + NextRequestId *big.Int + SdAmountToWithdraw *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterUtilizerSDSlashingHandled is a free log retrieval operation binding the contract event 0xf583a13dc98ab9935d418df5efc1b6e0b3b4f642ccc3a8601aec4646e965dc0b. +// FilterWithdrawRequestReceived is a free log retrieval operation binding the contract event 0x0edfc24f4f80277416f78f699d4733f7bb58fd6fb8838e2b1033162cee5fd7aa. // -// Solidity: event UtilizerSDSlashingHandled(address utilizer, uint256 slashSDAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterUtilizerSDSlashingHandled(opts *bind.FilterOpts) (*SDUtilityPoolUtilizerSDSlashingHandledIterator, error) { +// Solidity: event WithdrawRequestReceived(address caller, uint256 nextRequestId, uint256 sdAmountToWithdraw) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterWithdrawRequestReceived(opts *bind.FilterOpts) (*SDUtilityPoolWithdrawRequestReceivedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "UtilizerSDSlashingHandled") + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "WithdrawRequestReceived") if err != nil { return nil, err } - return &SDUtilityPoolUtilizerSDSlashingHandledIterator{contract: _SDUtilityPool.contract, event: "UtilizerSDSlashingHandled", logs: logs, sub: sub}, nil + return &SDUtilityPoolWithdrawRequestReceivedIterator{contract: _SDUtilityPool.contract, event: "WithdrawRequestReceived", logs: logs, sub: sub}, nil } -// WatchUtilizerSDSlashingHandled is a free log subscription operation binding the contract event 0xf583a13dc98ab9935d418df5efc1b6e0b3b4f642ccc3a8601aec4646e965dc0b. +// WatchWithdrawRequestReceived is a free log subscription operation binding the contract event 0x0edfc24f4f80277416f78f699d4733f7bb58fd6fb8838e2b1033162cee5fd7aa. // -// Solidity: event UtilizerSDSlashingHandled(address utilizer, uint256 slashSDAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchUtilizerSDSlashingHandled(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolUtilizerSDSlashingHandled) (event.Subscription, error) { +// Solidity: event WithdrawRequestReceived(address caller, uint256 nextRequestId, uint256 sdAmountToWithdraw) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchWithdrawRequestReceived(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolWithdrawRequestReceived) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "UtilizerSDSlashingHandled") + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "WithdrawRequestReceived") if err != nil { return nil, err } @@ -3132,8 +5825,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchUtilizerSDSlashingHandled(opts select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolUtilizerSDSlashingHandled) - if err := _SDUtilityPool.contract.UnpackLog(event, "UtilizerSDSlashingHandled", log); err != nil { + event := new(SDUtilityPoolWithdrawRequestReceived) + if err := _SDUtilityPool.contract.UnpackLog(event, "WithdrawRequestReceived", log); err != nil { return err } event.Raw = log @@ -3154,21 +5847,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchUtilizerSDSlashingHandled(opts }), nil } -// ParseUtilizerSDSlashingHandled is a log parse operation binding the contract event 0xf583a13dc98ab9935d418df5efc1b6e0b3b4f642ccc3a8601aec4646e965dc0b. +// ParseWithdrawRequestReceived is a log parse operation binding the contract event 0x0edfc24f4f80277416f78f699d4733f7bb58fd6fb8838e2b1033162cee5fd7aa. // -// Solidity: event UtilizerSDSlashingHandled(address utilizer, uint256 slashSDAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseUtilizerSDSlashingHandled(log types.Log) (*SDUtilityPoolUtilizerSDSlashingHandled, error) { - event := new(SDUtilityPoolUtilizerSDSlashingHandled) - if err := _SDUtilityPool.contract.UnpackLog(event, "UtilizerSDSlashingHandled", log); err != nil { +// Solidity: event WithdrawRequestReceived(address caller, uint256 nextRequestId, uint256 sdAmountToWithdraw) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseWithdrawRequestReceived(log types.Log) (*SDUtilityPoolWithdrawRequestReceived, error) { + event := new(SDUtilityPoolWithdrawRequestReceived) + if err := _SDUtilityPool.contract.UnpackLog(event, "WithdrawRequestReceived", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolWithdrawRequestReceivedIterator is returned from FilterWithdrawRequestReceived and is used to iterate over the raw logs and unpacked data for WithdrawRequestReceived events raised by the SDUtilityPool contract. -type SDUtilityPoolWithdrawRequestReceivedIterator struct { - Event *SDUtilityPoolWithdrawRequestReceived // Event containing the contract specifics and raw log +// SDUtilityPoolWithdrawnProtocolFeeIterator is returned from FilterWithdrawnProtocolFee and is used to iterate over the raw logs and unpacked data for WithdrawnProtocolFee events raised by the SDUtilityPool contract. +type SDUtilityPoolWithdrawnProtocolFeeIterator struct { + Event *SDUtilityPoolWithdrawnProtocolFee // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -3182,7 +5875,7 @@ type SDUtilityPoolWithdrawRequestReceivedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolWithdrawRequestReceivedIterator) Next() bool { +func (it *SDUtilityPoolWithdrawnProtocolFeeIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -3191,7 +5884,7 @@ func (it *SDUtilityPoolWithdrawRequestReceivedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolWithdrawRequestReceived) + it.Event = new(SDUtilityPoolWithdrawnProtocolFee) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -3206,7 +5899,7 @@ func (it *SDUtilityPoolWithdrawRequestReceivedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolWithdrawRequestReceived) + it.Event = new(SDUtilityPoolWithdrawnProtocolFee) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -3222,43 +5915,41 @@ func (it *SDUtilityPoolWithdrawRequestReceivedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolWithdrawRequestReceivedIterator) Error() error { +func (it *SDUtilityPoolWithdrawnProtocolFeeIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolWithdrawRequestReceivedIterator) Close() error { +func (it *SDUtilityPoolWithdrawnProtocolFeeIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolWithdrawRequestReceived represents a WithdrawRequestReceived event raised by the SDUtilityPool contract. -type SDUtilityPoolWithdrawRequestReceived struct { - Caller common.Address - NextRequestId *big.Int - SdAmountToWithdraw *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolWithdrawnProtocolFee represents a WithdrawnProtocolFee event raised by the SDUtilityPool contract. +type SDUtilityPoolWithdrawnProtocolFee struct { + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterWithdrawRequestReceived is a free log retrieval operation binding the contract event 0x0edfc24f4f80277416f78f699d4733f7bb58fd6fb8838e2b1033162cee5fd7aa. +// FilterWithdrawnProtocolFee is a free log retrieval operation binding the contract event 0xa32a67c2a472d948ee4cdcce3fdf2df7a9a99b762c69858f0651b1b22067efdf. // -// Solidity: event WithdrawRequestReceived(address caller, uint256 nextRequestId, uint256 sdAmountToWithdraw) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterWithdrawRequestReceived(opts *bind.FilterOpts) (*SDUtilityPoolWithdrawRequestReceivedIterator, error) { +// Solidity: event WithdrawnProtocolFee(uint256 amount) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterWithdrawnProtocolFee(opts *bind.FilterOpts) (*SDUtilityPoolWithdrawnProtocolFeeIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "WithdrawRequestReceived") + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "WithdrawnProtocolFee") if err != nil { return nil, err } - return &SDUtilityPoolWithdrawRequestReceivedIterator{contract: _SDUtilityPool.contract, event: "WithdrawRequestReceived", logs: logs, sub: sub}, nil + return &SDUtilityPoolWithdrawnProtocolFeeIterator{contract: _SDUtilityPool.contract, event: "WithdrawnProtocolFee", logs: logs, sub: sub}, nil } -// WatchWithdrawRequestReceived is a free log subscription operation binding the contract event 0x0edfc24f4f80277416f78f699d4733f7bb58fd6fb8838e2b1033162cee5fd7aa. +// WatchWithdrawnProtocolFee is a free log subscription operation binding the contract event 0xa32a67c2a472d948ee4cdcce3fdf2df7a9a99b762c69858f0651b1b22067efdf. // -// Solidity: event WithdrawRequestReceived(address caller, uint256 nextRequestId, uint256 sdAmountToWithdraw) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchWithdrawRequestReceived(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolWithdrawRequestReceived) (event.Subscription, error) { +// Solidity: event WithdrawnProtocolFee(uint256 amount) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchWithdrawnProtocolFee(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolWithdrawnProtocolFee) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "WithdrawRequestReceived") + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "WithdrawnProtocolFee") if err != nil { return nil, err } @@ -3268,8 +5959,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchWithdrawRequestReceived(opts * select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolWithdrawRequestReceived) - if err := _SDUtilityPool.contract.UnpackLog(event, "WithdrawRequestReceived", log); err != nil { + event := new(SDUtilityPoolWithdrawnProtocolFee) + if err := _SDUtilityPool.contract.UnpackLog(event, "WithdrawnProtocolFee", log); err != nil { return err } event.Raw = log @@ -3290,12 +5981,12 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchWithdrawRequestReceived(opts * }), nil } -// ParseWithdrawRequestReceived is a log parse operation binding the contract event 0x0edfc24f4f80277416f78f699d4733f7bb58fd6fb8838e2b1033162cee5fd7aa. +// ParseWithdrawnProtocolFee is a log parse operation binding the contract event 0xa32a67c2a472d948ee4cdcce3fdf2df7a9a99b762c69858f0651b1b22067efdf. // -// Solidity: event WithdrawRequestReceived(address caller, uint256 nextRequestId, uint256 sdAmountToWithdraw) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseWithdrawRequestReceived(log types.Log) (*SDUtilityPoolWithdrawRequestReceived, error) { - event := new(SDUtilityPoolWithdrawRequestReceived) - if err := _SDUtilityPool.contract.UnpackLog(event, "WithdrawRequestReceived", log); err != nil { +// Solidity: event WithdrawnProtocolFee(uint256 amount) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseWithdrawnProtocolFee(log types.Log) (*SDUtilityPoolWithdrawnProtocolFee, error) { + event := new(SDUtilityPoolWithdrawnProtocolFee) + if err := _SDUtilityPool.contract.UnpackLog(event, "WithdrawnProtocolFee", log); err != nil { return nil, err } event.Raw = log diff --git a/stader-lib/sdutility/sd-utility.go b/stader-lib/sdutility/sd-utility.go index 8be135a74..514418c98 100644 --- a/stader-lib/sdutility/sd-utility.go +++ b/stader-lib/sdutility/sd-utility.go @@ -33,3 +33,20 @@ func EstimateRepay(sp *stader.SDUtilityPoolContractManager, utilityAmount *big.I func Repay(sp *stader.SDUtilityPoolContractManager, utilityAmount *big.Int, opts *bind.TransactOpts) (*types.Transaction, error) { return sp.SDUtilityPool.Repay(opts, utilityAmount) } + +func SDMaxUtilizableAmount(sp *stader.SDUtilityPoolContractManager, + sdc *stader.SdCollateralContractManager, numValidators *big.Int, opts *bind.CallOpts) (*big.Int, error) { + maxThreshold, err := sp.SDUtilityPool.MaxETHWorthOfSDPerValidator(opts) + if err != nil { + return nil, err + } + + ethAmount := new(big.Int).Mul(maxThreshold, numValidators) + + sdAmount, err := sdc.SdCollateral.ConvertETHToSD(opts, ethAmount) + if err != nil { + return nil, err + } + + return sdAmount, nil +} diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index f7f032f6d..5010d60cc 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -68,8 +68,10 @@ func GetSDStatus( return nil, err } - sdMaxUtilizableAmount := new(big.Int).Mul(minimumSDToBond, big.NewInt(MinToUtilizeRatioNum)) - sdMaxUtilizableAmount = new(big.Int).Div(sdMaxUtilizableAmount, big.NewInt(MinToUtilizeRatioDenom)) + sdMaxUtilizableAmount, err := sdutility.SDMaxUtilizableAmount(sdu, sdc, totalValidatorsPostAddition, nil) + if err != nil { + return nil, err + } hasEnoughSdCollateral, err := sd_collateral.HasEnoughSdCollateral(sdc, operatorAddress, 1, totalValidatorsPostAddition, nil) if err != nil { From a79924a33c63717b77de6675b4c9f50cfe4856c5 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Mon, 11 Dec 2023 12:01:19 +0700 Subject: [PATCH 052/159] Update InsufficientEthBalance in SD status --- shared/services/stader/node.go | 4 ++-- shared/types/api/node.go | 1 + stader-cli/node/claim-rewards.go | 2 +- stader-cli/node/repay-sd.go | 2 +- stader-cli/node/status.go | 2 +- stader-cli/node/utilize-sd.go | 2 +- stader-cli/node/withdraw-sd.go | 2 +- stader-cli/validator/deposit.go | 12 ++++++------ stader/api/node/commands.go | 12 +++++++++--- stader/api/node/sd-status.go | 22 ++++++++++++++++++++-- 10 files changed, 43 insertions(+), 18 deletions(-) diff --git a/shared/services/stader/node.go b/shared/services/stader/node.go index 10ae5d51b..3ac2227ed 100644 --- a/shared/services/stader/node.go +++ b/shared/services/stader/node.go @@ -710,8 +710,8 @@ func (c *Client) CanNodeUtilizeSd(amountWei *big.Int) (api.CanUtilitySDResponse, return response, nil } -func (c *Client) GetSDStatus(numValidators *big.Int) (api.GetSdStatusResponse, error) { - responseBytes, err := c.callAPI(fmt.Sprintf("node get-sd-status %s", numValidators)) +func (c *Client) GetSDStatus(numValidators *big.Int, checkEth bool) (api.GetSdStatusResponse, error) { + responseBytes, err := c.callAPI(fmt.Sprintf("node get-sd-status %s %s", numValidators, strconv.FormatBool(checkEth))) if err != nil { return api.GetSdStatusResponse{}, fmt.Errorf("could not get-sd-status: %w", err) } diff --git a/shared/types/api/node.go b/shared/types/api/node.go index 5be530f42..d9e59873c 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -452,6 +452,7 @@ type SdStatusResponse struct { PoolAvailableSDBalance *big.Int `json:"poolAvailableSDBalance"` SdRewardEligible *big.Int `json:"sdRewardEligible"` NotEnoughSdCollateral bool `json:"notEnoughSdCollateral"` + InsufficientEthBalance bool `json:"insufficientEthBalance"` } type NodeRepayExcessSDResponse struct { diff --git a/stader-cli/node/claim-rewards.go b/stader-cli/node/claim-rewards.go index a158485ce..e9c08bbe8 100644 --- a/stader-cli/node/claim-rewards.go +++ b/stader-cli/node/claim-rewards.go @@ -38,7 +38,7 @@ func ClaimRewards(c *cli.Context) error { return nil } - sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0)) + sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0), false) if err != nil { return err } diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index e7ec40775..cc45bbbdb 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -60,7 +60,7 @@ func repaySD(c *cli.Context) error { } } - sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0)) + sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0), false) if err != nil { return err } diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index d92774971..9e273f08f 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -162,7 +162,7 @@ func getNodeStatus(c *cli.Context) error { fmt.Printf("To view details of each validator, please use the %sstader-cli validator status%s command\n\n", log.ColorGreen, log.ColorReset) // Get node SD status - sdStatusResp, err := staderClient.GetSDStatus(big.NewInt(0)) + sdStatusResp, err := staderClient.GetSDStatus(big.NewInt(0), false) if err != nil { return err } diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index e0b2a818c..d9d13b9b4 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -34,7 +34,7 @@ func utilizeSD(c *cli.Context) error { return err } - sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0)) + sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0), false) if err != nil { return err } diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index 176e5daf3..3bd82f3c1 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -46,7 +46,7 @@ func WithdrawSd(c *cli.Context) error { return nil } - sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0)) + sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0), false) if err != nil { return err } diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 83d7197fe..354824498 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -59,11 +59,16 @@ func nodeDeposit(c *cli.Context) error { } // Get node SD status - sdStatusResp, err := staderClient.GetSDStatus(big.NewInt(int64(numValidators))) + sdStatusResp, err := staderClient.GetSDStatus(big.NewInt(int64(numValidators)), true) if err != nil { return err } + if sdStatusResp.SDStatus.InsufficientEthBalance { + fmt.Printf("Account does not have enough ETH balance!") + return nil + } + sdStatus := sdStatusResp.SDStatus amountToCollateral := new(big.Int).Sub(sdStatus.SdCollateralRequireAmount, sdStatus.SdCollateralCurrentAmount) @@ -107,11 +112,6 @@ func nodeDeposit(c *cli.Context) error { return err } - if canNodeDepositResponse.InsufficientBalance { - fmt.Printf("Account does not have enough ETH balance!") - return nil - } - if canNodeDepositResponse.DepositPaused { fmt.Printf("Deposit is paused") return nil diff --git a/stader/api/node/commands.go b/stader/api/node/commands.go index 845235879..f6cff67cf 100644 --- a/stader/api/node/commands.go +++ b/stader/api/node/commands.go @@ -811,18 +811,24 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { Name: "get-sd-status", Usage: "Get SD Status", Aliases: []string{"gsd"}, - UsageText: "stader-cli api node get-sd-status num-validators", + UsageText: "stader-cli api node get-sd-status num-validators check-eth", Action: func(c *cli.Context) error { // Validate args - if err := cliutils.ValidateArgCount(c, 1); err != nil { + if err := cliutils.ValidateArgCount(c, 2); err != nil { return err } numValidators, err := cliutils.ValidateBigInt("num-validators", c.Args().Get(0)) if err != nil { return err } + + checkEth, err := cliutils.ValidateBool("check-eth", c.Args().Get(1)) + if err != nil { + return err + } + // Run - api.PrintResponse(getSDStatus(c, numValidators)) + api.PrintResponse(getSDStatus(c, numValidators, checkEth)) return nil }, }, diff --git a/stader/api/node/sd-status.go b/stader/api/node/sd-status.go index c7551c228..c4b8e1493 100644 --- a/stader/api/node/sd-status.go +++ b/stader/api/node/sd-status.go @@ -5,6 +5,7 @@ import ( "github.com/stader-labs/stader-node/stader-lib/node" sd_collateral "github.com/stader-labs/stader-node/stader-lib/sd-collateral" + "github.com/stader-labs/stader-node/stader-lib/tokens" "github.com/stader-labs/stader-node/stader/api/validator" "github.com/urfave/cli" @@ -13,7 +14,7 @@ import ( "github.com/stader-labs/stader-node/shared/types/api" ) -func getSDStatus(c *cli.Context, numValidators *big.Int) (*api.GetSdStatusResponse, error) { +func getSDStatus(c *cli.Context, numValidators *big.Int, checkEth bool) (*api.GetSdStatusResponse, error) { sdc, err := services.GetSdCollateralContract(c) if err != nil { return nil, err @@ -68,12 +69,29 @@ func getSDStatus(c *cli.Context, numValidators *big.Int) (*api.GetSdStatusRespon } hasEnoughSdCollateral, err := sd_collateral.HasEnoughSdCollateral(sdc, nodeAccount.Address, 1, numValidatorsPostAdd, nil) - if err != nil { return nil, err } + if checkEth { + userBalance, err := tokens.GetEthBalance(prn.Client, nodeAccount.Address, nil) + if err != nil { + return nil, err + } + + poolThreshold, err := sd_collateral.GetPoolThreshold(sdc, 1, nil) + if err != nil { + return nil, err + } + + amountToSend := new(big.Int).Mul(poolThreshold.MinThreshold, numValidators) + if userBalance.Cmp(amountToSend) < 0 { + sdStatus.InsufficientEthBalance = true + } + } + sdStatus.NotEnoughSdCollateral = !hasEnoughSdCollateral + return &api.GetSdStatusResponse{ SDStatus: sdStatus, }, nil From 8b0ea08a9dd05e0181c023bf4050f5189df9c1ab Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Mon, 11 Dec 2023 10:36:24 +0530 Subject: [PATCH 053/159] improve text for repay-sd --- stader-cli/node/repay-sd.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index e7ec40775..8e828864b 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -66,15 +66,20 @@ func repaySD(c *cli.Context) error { } sdStatus := sdStatusResponse.SDStatus + if sdStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) == 0 { + fmt.Println("You do not have an existing Utilization Position.") + return nil + } + // 1. Check if repay more than need if amountWei.Cmp(sdStatus.SdUtilizerLatestBalance) > 0 { - cliutils.PrintError(fmt.Sprintf("Repayment amount greater than the Utilization position: %s \n", sdStatus.SdUtilizerLatestBalance.String())) + fmt.Printf("Repayment amount greater than the Utilization position. Your current Utilization Position is %0.6f \n", eth.WeiToEth(sdStatus.SdUtilizerLatestBalance)) return nil } // 2. If user had enough to repay if amountWei.Cmp(sdStatus.SdBalance) > 0 { - cliutils.PrintError(fmt.Sprintf("The node's SD balance is not enough SD, current SD available: %f \n", eth.WeiToEth(sdStatus.SdBalance))) + fmt.Printf("You don't have sufficient SD in your Operator Address for the repayment. Please deposit SD into your Operator Address and try again.\n") return nil } @@ -90,7 +95,7 @@ func repaySD(c *cli.Context) error { // Prompt for confirmation if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( - "Are you sure you want to repay %f SD?", amount))) { + "Are you sure you want to repay %0.6f SD from your Operator Address and reduce or close your Utilization Position?", eth.WeiToEth(amountWei)))) { fmt.Println("Cancelled.") return nil } From fadf5dc04973b96a3eb921030d82cf3436213958 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Mon, 11 Dec 2023 10:55:53 +0530 Subject: [PATCH 054/159] improve texts for utilize-sd --- shared/types/api/node.go | 7 ++++--- stader-cli/node/utilize-sd.go | 7 ++++++- stader/api/node/utility-sd.go | 27 +++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/shared/types/api/node.go b/shared/types/api/node.go index 5be530f42..a510b3510 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -431,9 +431,10 @@ type NodeUtilitySDResponse struct { } type CanUtilitySDResponse struct { - Status string `json:"status"` - Error string `json:"error"` - GasInfo stader.GasInfo `json:"gasInfo"` + Status string `json:"status"` + Error string `json:"error"` + NonTerminalValidators uint64 `json:"nonTerminalValidators"` + GasInfo stader.GasInfo `json:"gasInfo"` } type GetSdStatusResponse struct { diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index e0b2a818c..bf5001a17 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -49,6 +49,11 @@ func utilizeSD(c *cli.Context) error { return err } + if canNodeUtilizeSdResponse.NonTerminalValidators == 0 { + fmt.Printf("Please add a validator to your node first before utilizing SD from a Utility Pool. Execute the following command to add a validator to your node: stader-cli validator deposit --num-validators \n") + return nil + } + err = gas.AssignMaxFeeAndLimit(canNodeUtilizeSdResponse.GasInfo, staderClient, c.Bool("yes")) if err != nil { return err @@ -101,7 +106,7 @@ func PromptChooseUtilityAmount(sdStatus *api.SdStatusResponse) (*big.Int, error) // 1. If the pool had enough SD if minUtility.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { - msg := fmt.Sprintf("Pool available SD: %f not enough to min utility : %f \n", eth.WeiToEth(sdStatus.PoolAvailableSDBalance), eth.WeiToEth(minUtility)) + msg := fmt.Sprintf("There is no sufficient free SD in the utility pool for utilization at the moment. Please try again later when there is enough free SD in the utility pool.") return nil, errors.New(msg) } diff --git a/stader/api/node/utility-sd.go b/stader/api/node/utility-sd.go index 7c800e530..0f031c6d3 100644 --- a/stader/api/node/utility-sd.go +++ b/stader/api/node/utility-sd.go @@ -3,6 +3,7 @@ package node import ( "math/big" + "github.com/stader-labs/stader-node/stader-lib/node" "github.com/urfave/cli" "github.com/stader-labs/stader-node/shared/services" @@ -20,6 +21,16 @@ func canUtilitySd(c *cli.Context, amountWei *big.Int) (*api.CanUtilitySDResponse return nil, err } + nodeAccount, err := w.GetNodeAccount() + if err != nil { + return nil, err + } + + prn, err := services.GetPermissionlessNodeRegistry(c) + if err != nil { + return nil, err + } + // Response response := api.CanUtilitySDResponse{} @@ -28,6 +39,22 @@ func canUtilitySd(c *cli.Context, amountWei *big.Int) (*api.CanUtilitySDResponse return nil, err } + operatorId, err := node.GetOperatorId(prn, nodeAccount.Address, nil) + if err != nil { + return nil, err + } + + totalValidatorKeys, err := node.GetTotalValidatorKeys(prn, operatorId, nil) + if err != nil { + return nil, err + } + totalValidatorNonTerminalKeys, err := node.GetTotalNonTerminalValidatorKeys(prn, nodeAccount.Address, totalValidatorKeys, nil) + if err != nil { + return nil, err + } + + response.NonTerminalValidators = totalValidatorNonTerminalKeys + // Get gas estimates opts, err := w.GetNodeAccountTransactor() if err != nil { From 50fbb4e46329c54087d47b86f82bc6a218d0920d Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Mon, 11 Dec 2023 11:22:28 +0530 Subject: [PATCH 055/159] improve texts --- stader-cli/node/repay-sd.go | 28 ++++++++++++++-------------- stader-cli/node/utilize-sd.go | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index 8e828864b..dca338094 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -46,20 +46,6 @@ func repaySD(c *cli.Context) error { return err } - // Check allowance - allowance, err := staderClient.GetNodeSdAllowance(contracts.SdUtilityContract) - if err != nil { - return err - } - - if allowance.Allowance.Cmp(amountWei) < 0 { - fmt.Println("Before repay SD, you must first give the utility contract approval to interact with your SD. Amount to approve: ", eth.WeiToEth(amountWei)) - err = nodeApproveUtilitySd(c, amountInString) - if err != nil { - return err - } - } - sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0)) if err != nil { return err @@ -83,6 +69,20 @@ func repaySD(c *cli.Context) error { return nil } + // Check allowance + allowance, err := staderClient.GetNodeSdAllowance(contracts.SdUtilityContract) + if err != nil { + return err + } + + if allowance.Allowance.Cmp(amountWei) < 0 { + fmt.Println("Before repaying the SD, you must first give the utility contract approval to interact with your SD. Amount to approve: ", eth.WeiToEth(amountWei)) + err = nodeApproveUtilitySd(c, amountInString) + if err != nil { + return err + } + } + canRepaySdResponse, err := staderClient.CanRepaySd(amountWei) if err != nil { return err diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index bf5001a17..9f5526e06 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -61,7 +61,7 @@ func utilizeSD(c *cli.Context) error { // Prompt for confirmation if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( - "Are you sure you want to utilize %f SD? ", eth.WeiToEth(amountWei)))) { + "Are you sure you want to use %f SD from the utility pool? (y/n). Note: A Utilization fee of %.6f APR will be applied to the utilized SD from the utility pool.\n", eth.WeiToEth(amountWei), 0.5))) { fmt.Println("Cancelled.") return nil } From 36f81a1242673f7ede0a03d12befa8bdb164f879 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Mon, 11 Dec 2023 13:00:00 +0700 Subject: [PATCH 056/159] Update deposit flow --- stader-cli/node/utilize-sd.go | 61 +++++++++++++++++++++++--- stader-cli/validator/deposit.go | 77 ++++++++++++++++++++------------- stader-lib/utils/eth/units.go | 7 +-- stader/api/node/sd-status.go | 10 ++--- stader/api/validator/deposit.go | 1 + 5 files changed, 108 insertions(+), 48 deletions(-) diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index d9d13b9b4..8d620b4f4 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -101,9 +101,7 @@ func PromptChooseUtilityAmount(sdStatus *api.SdStatusResponse) (*big.Int, error) // 1. If the pool had enough SD if minUtility.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { - msg := fmt.Sprintf("Pool available SD: %f not enough to min utility : %f \n", eth.WeiToEth(sdStatus.PoolAvailableSDBalance), eth.WeiToEth(minUtility)) - - return nil, errors.New(msg) + return nil, errors.New("There is not sufficient free SD in the Utility Pool for utilization at the moment. Please try again later when there is enough free SD in the Utility Pool") } // 2. If user had enough Eth @@ -125,22 +123,71 @@ func PromptChooseUtilityAmount(sdStatus *api.SdStatusResponse) (*big.Int, error) var err error - msg := fmt.Sprintf("Please enter a number of SD to utilize in range %f and %f: ", min, max) + msg := fmt.Sprintf(`Please enter the amount of SD you wish to utilize from the SD Utility Pool: +SD Utility Pool balance: %f SD +Minimum utilization amount: %f SD +Maximum utilization amount: %f SD`, eth.WeiToEth(sdStatus.PoolAvailableSDBalance), min, max) + + errMsg := fmt.Sprintf("Invalid input, please specify an amount within %f and %f SD range\n", min, max) + + for { + s := cliutils.Prompt( + msg, + "^[1-9][0-9]*$", + errMsg) + + _utilityAmount, err = strconv.Atoi(s) + if err != nil { + fmt.Println(errMsg) + continue + } + + if _utilityAmount < int(min) || _utilityAmount > int(max) { + fmt.Println(errMsg) + continue + } + + break + } + + utilityAmount := eth.EthToWei(float64(_utilityAmount)) + + return utilityAmount, nil +} + +func PromptChooseSelfBondAmount(sdStatus *api.SdStatusResponse) (*big.Int, error) { + + amountToCollateralRemain := new(big.Int).Sub(sdStatus.SdCollateralRequireAmount, sdStatus.SdCollateralCurrentAmount) + + sdRewardEligibleRemain := new(big.Int).Sub(sdStatus.SdRewardEligible, sdStatus.SdCollateralCurrentAmount) + + min := eth.WeiToEth(amountToCollateralRemain) + max := eth.WeiToEth(sdRewardEligibleRemain) + + var _utilityAmount int + + var err error + + msg := fmt.Sprintf(`Please enter the amount of SD you wish to deposit as collateral. +Minimum bond: %f SD +Maximum bond: %f SD`, min, max) + + errMsg := fmt.Sprintf("Invalid input, please specify an amount within %f and %f SD range\n", min, max) for { s := cliutils.Prompt( msg, "^[1-9][0-9]*$", - msg) + errMsg) _utilityAmount, err = strconv.Atoi(s) if err != nil { - fmt.Println("Please enter a valid number.") + fmt.Println(errMsg) continue } if _utilityAmount < int(min) || _utilityAmount > int(max) { - fmt.Printf("Invalid input, please specify an amount within %f and %f range:\n", min, max) + fmt.Println(errMsg) continue } diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 354824498..8c85e3e91 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -6,6 +6,7 @@ import ( "github.com/stader-labs/stader-node/shared/services/gas" "github.com/stader-labs/stader-node/shared/utils/log" + "github.com/stader-labs/stader-node/shared/utils/math" "github.com/stader-labs/stader-node/stader-cli/node" "github.com/stader-labs/stader-node/shared/services/stader" @@ -30,8 +31,7 @@ func nodeDeposit(c *cli.Context) error { numValidators := c.Uint64("num-validators") - baseAmountInEth := 4 - baseAmount := eth.EthToWei(4.0) + baseAmount := eth.EthToWei(eth.BaseAmountInEth) // Check to see if eth2 is synced syncResponse, err := staderClient.NodeSync() @@ -65,43 +65,69 @@ func nodeDeposit(c *cli.Context) error { } if sdStatusResp.SDStatus.InsufficientEthBalance { - fmt.Printf("Account does not have enough ETH balance!") + fmt.Printf("You don't have sufficient ETH in your Operator Address to add validators. Please deposit ETH into your Operator Address and try again to add validators to your node.") + return nil + } + + // Prompt for confirmation + if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( + "You are about to deposit %d ETH to create %d validators.\n"+ + "%sAre you sure you want to do this? Running a validator is a long-term commitment, and this action cannot be undone!%s", + uint64(eth.BaseAmountInEth)*numValidators, numValidators, + log.ColorYellow, + log.ColorReset))) { + fmt.Println("Cancelled.") return nil } sdStatus := sdStatusResp.SDStatus - amountToCollateral := new(big.Int).Sub(sdStatus.SdCollateralRequireAmount, sdStatus.SdCollateralCurrentAmount) utilityAmount := big.NewInt(0) if sdStatus.NotEnoughSdCollateral { - fmt.Printf( - "The node %s%s%s had not enough SD in collateral please deposit SD.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - ) - - ops := []string{"Deposit from node wallet", "Utility SD"} - i, _ := cliutils.Select("Choose option", ops) + ops := []string{"Utilize SD from the SD Utility Pool", "Use your own SD (Self Bond)"} + i, _ := cliutils.Select("You do not have sufficient SD collateral to add validators. Please choose one of the following options to add SD collateral. Enter 1 or 2:", ops) switch i { case 0: - if status.AccountBalances.Sd.Cmp(amountToCollateral) < 0 { - fmt.Printf("You need to deposit %f more SD to collateralize your node to create %d validators\n. Please use the stader-cli node deposit-sd command to deposit SD", eth.WeiToEth(amountToCollateral), numValidators) - return nil + utilityAmount, err = node.PromptChooseUtilityAmount(sdStatus) + if err != nil { + return err } + if !cliutils.Confirm(fmt.Sprintf("Are you sure you want to use %f SD from the Utility Pool? [Y/N] \nNote: A Utilization Fee of APR will be applied to the utilized SD from the Utility Pool. ", eth.WeiToEth(utilityAmount))) { + fmt.Printf("Cancelled\n") + return nil + } case 1: - utilityAmount, err = node.PromptChooseUtilityAmount(sdStatus) + selfBondAmount, err := node.PromptChooseSelfBondAmount(sdStatus) if err != nil { return err } - if !cliutils.Confirm(fmt.Sprintf("You're about to utilize %f SD: ", eth.WeiToEth(utilityAmount))) { - fmt.Printf("Cancel \n") + if status.AccountBalances.Sd.Cmp(selfBondAmount) < 0 { + fmt.Printf("You don't have sufficient SD in your Operator Address to add as collateral. Please deposit SD into your Operator Address and try again.\n") + return nil + } + + if !cliutils.Confirm(fmt.Sprintf("Are you sure you want to deposit %f SD as collateral? [Y/N] ", eth.WeiToEth(selfBondAmount))) { + fmt.Printf("Cancelled\n") return nil } + + depositSdResponse, err := staderClient.NodeDepositSd(selfBondAmount) + if err != nil { + return err + } + + fmt.Printf("Depositing SD...\n") + cliutils.PrintTransactionHash(staderClient, depositSdResponse.DepositTxHash) + + if _, err = staderClient.WaitForTransaction(depositSdResponse.DepositTxHash); err != nil { + return err + } + + fmt.Printf("Successfully deposited %.6f SD.\n", math.RoundDown(eth.WeiToEth(selfBondAmount), 6)) default: return nil } @@ -132,17 +158,6 @@ func nodeDeposit(c *cli.Context) error { return err } - // Prompt for confirmation - if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( - "You are about to deposit %d ETH to create %d validators.\n"+ - "%sARE YOU SURE YOU WANT TO DO THIS? Running a validator is a long-term commitment, and this action cannot be undone!%s", - uint64(baseAmountInEth)*numValidators, numValidators, - log.ColorYellow, - log.ColorReset))) { - fmt.Println("Cancelled.") - return nil - } - // Make deposit response, err := staderClient.NodeDeposit(baseAmount, big.NewInt(int64(numValidators)), utilityAmount, false) if err != nil { @@ -157,7 +172,7 @@ func nodeDeposit(c *cli.Context) error { } // Log & return - fmt.Printf("The node deposit of %d ETH was made successfully!\n", uint64(baseAmountInEth)*numValidators) + fmt.Printf("The node deposit of %d ETH was made successfully!\n", uint64(eth.BaseAmountInEth)*numValidators) fmt.Printf("Total %d validators were created\n", numValidators) fmt.Println("Your validators are now in Initialized status.") diff --git a/stader-lib/utils/eth/units.go b/stader-lib/utils/eth/units.go index 674510451..f2f252a19 100644 --- a/stader-lib/utils/eth/units.go +++ b/stader-lib/utils/eth/units.go @@ -26,9 +26,10 @@ import ( // Conversion factors const ( - WeiPerEth float64 = 1e18 - WeiPerGwei float64 = 1e9 - Decimal = 18 + WeiPerEth float64 = 1e18 + WeiPerGwei float64 = 1e9 + Decimal = 18 + BaseAmountInEth = 4 ) // Convert wei to eth diff --git a/stader/api/node/sd-status.go b/stader/api/node/sd-status.go index c4b8e1493..dcd0bc5cf 100644 --- a/stader/api/node/sd-status.go +++ b/stader/api/node/sd-status.go @@ -6,6 +6,7 @@ import ( "github.com/stader-labs/stader-node/stader-lib/node" sd_collateral "github.com/stader-labs/stader-node/stader-lib/sd-collateral" "github.com/stader-labs/stader-node/stader-lib/tokens" + "github.com/stader-labs/stader-node/stader-lib/utils/eth" "github.com/stader-labs/stader-node/stader/api/validator" "github.com/urfave/cli" @@ -63,7 +64,7 @@ func getSDStatus(c *cli.Context, numValidators *big.Int, checkEth bool) (*api.Ge numValidatorsPostAdd := new(big.Int).Add(numValidators, big.NewInt(int64(totalValidatorNonTerminalKeys))) - sdStatus, err := validator.GetSDStatus(sdc, sdu, sdt, nodeAccount.Address, numValidatorsPostAdd) + sdStatus, err := validator.GetSDStatus(sdc, sdu, sdt, nodeAccount.Address, numValidatorsPostAdd, checkEth) if err != nil { return nil, err } @@ -79,12 +80,7 @@ func getSDStatus(c *cli.Context, numValidators *big.Int, checkEth bool) (*api.Ge return nil, err } - poolThreshold, err := sd_collateral.GetPoolThreshold(sdc, 1, nil) - if err != nil { - return nil, err - } - - amountToSend := new(big.Int).Mul(poolThreshold.MinThreshold, numValidators) + amountToSend := new(big.Int).Mul(eth.EthToWei(eth.BaseAmountInEth), numValidators) if userBalance.Cmp(amountToSend) < 0 { sdStatus.InsufficientEthBalance = true } diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index f7f032f6d..85fe76ba4 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -31,6 +31,7 @@ func GetSDStatus( sdt *stader.Erc20TokenContractManager, operatorAddress common.Address, totalValidatorsPostAddition *big.Int, + checkEth bool, ) (*api.SdStatusResponse, error) { sdUtilityLatestBalance, err := sdutility.GetUtilizerLatestBalance(sdu, operatorAddress, nil) if err != nil { From d92152f69d31e0ce718670bb44f99e5de004215a Mon Sep 17 00:00:00 2001 From: batphonghan Date: Mon, 11 Dec 2023 13:28:41 +0700 Subject: [PATCH 057/159] Remove check eth in sd status --- shared/services/stader/node.go | 4 ++-- shared/types/api/node.go | 1 - stader-cli/node/claim-rewards.go | 2 +- stader-cli/node/repay-sd.go | 2 +- stader-cli/node/status.go | 2 +- stader-cli/node/utilize-sd.go | 2 +- stader-cli/node/withdraw-sd.go | 2 +- stader-cli/validator/deposit.go | 7 +++++-- stader/api/node/commands.go | 11 +++-------- stader/api/node/sd-status.go | 18 ++---------------- stader/api/validator/deposit.go | 1 - 11 files changed, 17 insertions(+), 35 deletions(-) diff --git a/shared/services/stader/node.go b/shared/services/stader/node.go index 3ac2227ed..10ae5d51b 100644 --- a/shared/services/stader/node.go +++ b/shared/services/stader/node.go @@ -710,8 +710,8 @@ func (c *Client) CanNodeUtilizeSd(amountWei *big.Int) (api.CanUtilitySDResponse, return response, nil } -func (c *Client) GetSDStatus(numValidators *big.Int, checkEth bool) (api.GetSdStatusResponse, error) { - responseBytes, err := c.callAPI(fmt.Sprintf("node get-sd-status %s %s", numValidators, strconv.FormatBool(checkEth))) +func (c *Client) GetSDStatus(numValidators *big.Int) (api.GetSdStatusResponse, error) { + responseBytes, err := c.callAPI(fmt.Sprintf("node get-sd-status %s", numValidators)) if err != nil { return api.GetSdStatusResponse{}, fmt.Errorf("could not get-sd-status: %w", err) } diff --git a/shared/types/api/node.go b/shared/types/api/node.go index d9e59873c..5be530f42 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -452,7 +452,6 @@ type SdStatusResponse struct { PoolAvailableSDBalance *big.Int `json:"poolAvailableSDBalance"` SdRewardEligible *big.Int `json:"sdRewardEligible"` NotEnoughSdCollateral bool `json:"notEnoughSdCollateral"` - InsufficientEthBalance bool `json:"insufficientEthBalance"` } type NodeRepayExcessSDResponse struct { diff --git a/stader-cli/node/claim-rewards.go b/stader-cli/node/claim-rewards.go index e9c08bbe8..a158485ce 100644 --- a/stader-cli/node/claim-rewards.go +++ b/stader-cli/node/claim-rewards.go @@ -38,7 +38,7 @@ func ClaimRewards(c *cli.Context) error { return nil } - sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0), false) + sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0)) if err != nil { return err } diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index cc45bbbdb..e7ec40775 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -60,7 +60,7 @@ func repaySD(c *cli.Context) error { } } - sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0), false) + sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0)) if err != nil { return err } diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 9e273f08f..d92774971 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -162,7 +162,7 @@ func getNodeStatus(c *cli.Context) error { fmt.Printf("To view details of each validator, please use the %sstader-cli validator status%s command\n\n", log.ColorGreen, log.ColorReset) // Get node SD status - sdStatusResp, err := staderClient.GetSDStatus(big.NewInt(0), false) + sdStatusResp, err := staderClient.GetSDStatus(big.NewInt(0)) if err != nil { return err } diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index 8d620b4f4..5afe0aa5a 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -34,7 +34,7 @@ func utilizeSD(c *cli.Context) error { return err } - sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0), false) + sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0)) if err != nil { return err } diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index 3bd82f3c1..176e5daf3 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -46,7 +46,7 @@ func WithdrawSd(c *cli.Context) error { return nil } - sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0), false) + sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0)) if err != nil { return err } diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 8c85e3e91..793484733 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -59,12 +59,15 @@ func nodeDeposit(c *cli.Context) error { } // Get node SD status - sdStatusResp, err := staderClient.GetSDStatus(big.NewInt(int64(numValidators)), true) + sdStatusResp, err := staderClient.GetSDStatus(big.NewInt(int64(numValidators))) if err != nil { return err } - if sdStatusResp.SDStatus.InsufficientEthBalance { + userBalance := status.AccountBalances.ETH + amountToSend := new(big.Int).Mul(eth.EthToWei(eth.BaseAmountInEth), big.NewInt(int64(numValidators))) + + if userBalance.Cmp(amountToSend) < 0 { fmt.Printf("You don't have sufficient ETH in your Operator Address to add validators. Please deposit ETH into your Operator Address and try again to add validators to your node.") return nil } diff --git a/stader/api/node/commands.go b/stader/api/node/commands.go index f6cff67cf..8f5916d75 100644 --- a/stader/api/node/commands.go +++ b/stader/api/node/commands.go @@ -811,10 +811,10 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { Name: "get-sd-status", Usage: "Get SD Status", Aliases: []string{"gsd"}, - UsageText: "stader-cli api node get-sd-status num-validators check-eth", + UsageText: "stader-cli api node get-sd-status num-validators", Action: func(c *cli.Context) error { // Validate args - if err := cliutils.ValidateArgCount(c, 2); err != nil { + if err := cliutils.ValidateArgCount(c, 1); err != nil { return err } numValidators, err := cliutils.ValidateBigInt("num-validators", c.Args().Get(0)) @@ -822,13 +822,8 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { return err } - checkEth, err := cliutils.ValidateBool("check-eth", c.Args().Get(1)) - if err != nil { - return err - } - // Run - api.PrintResponse(getSDStatus(c, numValidators, checkEth)) + api.PrintResponse(getSDStatus(c, numValidators)) return nil }, }, diff --git a/stader/api/node/sd-status.go b/stader/api/node/sd-status.go index dcd0bc5cf..697862e8e 100644 --- a/stader/api/node/sd-status.go +++ b/stader/api/node/sd-status.go @@ -5,8 +5,6 @@ import ( "github.com/stader-labs/stader-node/stader-lib/node" sd_collateral "github.com/stader-labs/stader-node/stader-lib/sd-collateral" - "github.com/stader-labs/stader-node/stader-lib/tokens" - "github.com/stader-labs/stader-node/stader-lib/utils/eth" "github.com/stader-labs/stader-node/stader/api/validator" "github.com/urfave/cli" @@ -15,7 +13,7 @@ import ( "github.com/stader-labs/stader-node/shared/types/api" ) -func getSDStatus(c *cli.Context, numValidators *big.Int, checkEth bool) (*api.GetSdStatusResponse, error) { +func getSDStatus(c *cli.Context, numValidators *big.Int) (*api.GetSdStatusResponse, error) { sdc, err := services.GetSdCollateralContract(c) if err != nil { return nil, err @@ -64,7 +62,7 @@ func getSDStatus(c *cli.Context, numValidators *big.Int, checkEth bool) (*api.Ge numValidatorsPostAdd := new(big.Int).Add(numValidators, big.NewInt(int64(totalValidatorNonTerminalKeys))) - sdStatus, err := validator.GetSDStatus(sdc, sdu, sdt, nodeAccount.Address, numValidatorsPostAdd, checkEth) + sdStatus, err := validator.GetSDStatus(sdc, sdu, sdt, nodeAccount.Address, numValidatorsPostAdd) if err != nil { return nil, err } @@ -74,18 +72,6 @@ func getSDStatus(c *cli.Context, numValidators *big.Int, checkEth bool) (*api.Ge return nil, err } - if checkEth { - userBalance, err := tokens.GetEthBalance(prn.Client, nodeAccount.Address, nil) - if err != nil { - return nil, err - } - - amountToSend := new(big.Int).Mul(eth.EthToWei(eth.BaseAmountInEth), numValidators) - if userBalance.Cmp(amountToSend) < 0 { - sdStatus.InsufficientEthBalance = true - } - } - sdStatus.NotEnoughSdCollateral = !hasEnoughSdCollateral return &api.GetSdStatusResponse{ diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index 85fe76ba4..f7f032f6d 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -31,7 +31,6 @@ func GetSDStatus( sdt *stader.Erc20TokenContractManager, operatorAddress common.Address, totalValidatorsPostAddition *big.Int, - checkEth bool, ) (*api.SdStatusResponse, error) { sdUtilityLatestBalance, err := sdutility.GetUtilizerLatestBalance(sdu, operatorAddress, nil) if err != nil { From 9b7f3b1ca93ccaef571f53e345d185282e3f8c38 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Mon, 11 Dec 2023 13:41:31 +0700 Subject: [PATCH 058/159] Refactor --- stader-cli/validator/deposit.go | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 793484733..0c0d44bda 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -6,7 +6,6 @@ import ( "github.com/stader-labs/stader-node/shared/services/gas" "github.com/stader-labs/stader-node/shared/utils/log" - "github.com/stader-labs/stader-node/shared/utils/math" "github.com/stader-labs/stader-node/stader-cli/node" "github.com/stader-labs/stader-node/shared/services/stader" @@ -113,27 +112,24 @@ func nodeDeposit(c *cli.Context) error { return nil } - if !cliutils.Confirm(fmt.Sprintf("Are you sure you want to deposit %f SD as collateral? [Y/N] ", eth.WeiToEth(selfBondAmount))) { + if !cliutils.Confirm(fmt.Sprintf("Are you sure you want to deposit %f SD as collateral?", eth.WeiToEth(selfBondAmount))) { fmt.Printf("Cancelled\n") return nil } - depositSdResponse, err := staderClient.NodeDepositSd(selfBondAmount) - if err != nil { - return err - } + autoConfirm := c.Bool("yes") + nounce := c.GlobalUint64("nonce") - fmt.Printf("Depositing SD...\n") - cliutils.PrintTransactionHash(staderClient, depositSdResponse.DepositTxHash) - - if _, err = staderClient.WaitForTransaction(depositSdResponse.DepositTxHash); err != nil { + err = node.DepositSdWithAmount(staderClient, selfBondAmount, autoConfirm, nounce) + if err != nil { return err } - fmt.Printf("Successfully deposited %.6f SD.\n", math.RoundDown(eth.WeiToEth(selfBondAmount), 6)) default: return nil } + + fmt.Println("Continue with create validator...") } canNodeDepositResponse, err := staderClient.CanNodeDeposit(baseAmount, utilityAmount, big.NewInt(int64(numValidators)), true) From 4e0f26a0f8a42ac2afc64c8e190e36bbcbdb520d Mon Sep 17 00:00:00 2001 From: batphonghan Date: Mon, 11 Dec 2023 15:09:47 +0700 Subject: [PATCH 059/159] Update copies --- stader-cli/node/deposit-sd.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stader-cli/node/deposit-sd.go b/stader-cli/node/deposit-sd.go index b361c2cf4..c1fd4f787 100644 --- a/stader-cli/node/deposit-sd.go +++ b/stader-cli/node/deposit-sd.go @@ -74,7 +74,7 @@ func DepositSdWithAmount(staderClient *stader.Client, amountWei *big.Int, autoCo } if canDeposit.InsufficientBalance { - fmt.Println("The node's SD balance is insufficient.") + fmt.Println("You don't have sufficient SD in your Operator Address to add as collateral. Please deposit SD into your Operator Address and try again.") return nil } @@ -90,7 +90,7 @@ func DepositSdWithAmount(staderClient *stader.Client, amountWei *big.Int, autoCo } // Prompt for confirmation - if !(autoConfirm || cliutils.Confirm(fmt.Sprintf("Are you sure you want to deposit %.6f SD? You will not be able to withdraw this SD until you exit your validators", math.RoundDown(eth.WeiToEth(amountWei), 6)))) { + if !(autoConfirm || cliutils.Confirm(fmt.Sprintf("Are you sure you want to deposit %f SD as collateral?", math.RoundDown(eth.WeiToEth(amountWei), 6)))) { fmt.Println("Cancelled.") return nil } From b83e22b0bca8a333cb3f24f6d4b9f7453daf1084 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Mon, 11 Dec 2023 15:17:04 +0700 Subject: [PATCH 060/159] Get utilizationRate --- shared/types/api/node.go | 1 + stader-cli/validator/deposit.go | 2 +- stader-lib/sdutility/sd-utility.go | 5 +++++ stader/api/validator/deposit.go | 6 ++++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/shared/types/api/node.go b/shared/types/api/node.go index 5be530f42..efddd7308 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -448,6 +448,7 @@ type SdStatusResponse struct { SdCollateralCurrentAmount *big.Int `json:"sdCollateralCurrentAmount"` SdCollateralRequireAmount *big.Int `json:"sdCollateralRequireAmount"` SdMaxUtilizableAmount *big.Int `json:"sdMaxUtilizableAmount"` + UtilizationRate *big.Int `json:"utilizationRate"` SdBalance *big.Int `json:"sdBalance"` PoolAvailableSDBalance *big.Int `json:"poolAvailableSDBalance"` SdRewardEligible *big.Int `json:"sdRewardEligible"` diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 0c0d44bda..7bc52db6f 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -97,7 +97,7 @@ func nodeDeposit(c *cli.Context) error { return err } - if !cliutils.Confirm(fmt.Sprintf("Are you sure you want to use %f SD from the Utility Pool? [Y/N] \nNote: A Utilization Fee of APR will be applied to the utilized SD from the Utility Pool. ", eth.WeiToEth(utilityAmount))) { + if !cliutils.Confirm(fmt.Sprintf("Are you sure you want to use %f SD from the Utility Pool? [Y/N] \nNote: A Utilization Fee of %s APR will be applied to the utilized SD from the Utility Pool. ", eth.WeiToEth(utilityAmount), sdStatus.UtilizationRate.String())) { fmt.Printf("Cancelled\n") return nil } diff --git a/stader-lib/sdutility/sd-utility.go b/stader-lib/sdutility/sd-utility.go index 8be135a74..c512da629 100644 --- a/stader-lib/sdutility/sd-utility.go +++ b/stader-lib/sdutility/sd-utility.go @@ -33,3 +33,8 @@ func EstimateRepay(sp *stader.SDUtilityPoolContractManager, utilityAmount *big.I func Repay(sp *stader.SDUtilityPoolContractManager, utilityAmount *big.Int, opts *bind.TransactOpts) (*types.Transaction, error) { return sp.SDUtilityPool.Repay(opts, utilityAmount) } + +func GetUtilizationRate(sp *stader.SDUtilityPoolContractManager, opts *bind.CallOpts) (*big.Int, error) { + // TODO: fetch from contract + return big.NewInt(50), nil +} diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index f7f032f6d..0aee715bf 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -42,6 +42,11 @@ func GetSDStatus( return nil, err } + utilizationRate, err := sdutility.GetUtilizationRate(sdu, nil) + if err != nil { + return nil, err + } + minimumSDToBond, err := sd_collateral.MinimumSDToBond(sdc, 1, totalValidatorsPostAddition, nil) if err != nil { return nil, err @@ -83,6 +88,7 @@ func GetSDStatus( SdCollateralCurrentAmount: sdCollateralCurrentAmount, SdCollateralRequireAmount: minimumSDToBond, SdMaxUtilizableAmount: sdMaxUtilizableAmount, + UtilizationRate: utilizationRate, SdUtilizedBalance: sdUtilizedBalance, PoolAvailableSDBalance: poolAvailableSDBalance, SdRewardEligible: rewardEligibleSD, From 1c0963f093e9a540d7bfd3e5d1e998128b7c89c6 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Mon, 11 Dec 2023 17:24:38 +0700 Subject: [PATCH 061/159] Update APR --- abis/SDUtilityPool.abi.json | 1478 ++++++++++++++++++++++----- stader-cli/validator/deposit.go | 14 +- stader-lib/contracts/sd-utility.go | 1491 ++++++++++++++++++++++------ stader-lib/sdutility/sd-utility.go | 12 +- 4 files changed, 2393 insertions(+), 602 deletions(-) diff --git a/abis/SDUtilityPool.abi.json b/abis/SDUtilityPool.abi.json index 92be5ffd9..5cd338445 100644 --- a/abis/SDUtilityPool.abi.json +++ b/abis/SDUtilityPool.abi.json @@ -1,16 +1,84 @@ [ - { "inputs": [], "name": "AccrualBlockNumberNotLatest", "type": "error" }, - { "inputs": [], "name": "CallerNotAuthorizedToRedeem", "type": "error" }, - { "inputs": [], "name": "CannotFindRequestId", "type": "error" }, - { "inputs": [], "name": "InsufficientPoolBalance", "type": "error" }, - { "inputs": [], "name": "InvalidAmountOfWithdraw", "type": "error" }, - { "inputs": [], "name": "InvalidInput", "type": "error" }, - { "inputs": [], "name": "InvalidWithdrawAmount", "type": "error" }, + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AccrualBlockNumberNotLatest", + "type": "error" + }, + { + "inputs": [], + "name": "AlreadyClaimed", + "type": "error" + }, + { + "inputs": [], + "name": "AlreadyLiquidated", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotAuthorizedToRedeem", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotManager", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotStaderContract", + "type": "error" + }, + { + "inputs": [], + "name": "CannotFindRequestId", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientPoolBalance", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAmountOfWithdraw", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidInput", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidWithdrawAmount", + "type": "error" + }, { "inputs": [], "name": "MaxLimitOnWithdrawRequestCountReached", "type": "error" }, + { + "inputs": [], + "name": "NotClaimable", + "type": "error" + }, + { + "inputs": [], + "name": "NotLiquidatable", + "type": "error" + }, + { + "inputs": [], + "name": "NotLiquidator", + "type": "error" + }, { "inputs": [ { @@ -22,9 +90,21 @@ "name": "RequestIdNotFinalized", "type": "error" }, - { "inputs": [], "name": "SDTransferFailed", "type": "error" }, - { "inputs": [], "name": "SDUtilizeLimitReached", "type": "error" }, - { "inputs": [], "name": "UndelegationPeriodNotPassed", "type": "error" }, + { + "inputs": [], + "name": "SDTransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "SDUtilizeLimitReached", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, { "anonymous": false, "inputs": [ @@ -55,24 +135,12 @@ "inputs": [ { "indexed": true, - "internalType": "address", - "name": "liquidator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "liquidationBonusInEth", - "type": "uint256" - }, - { - "indexed": false, "internalType": "uint256", - "name": "liquidationFeeInEth", + "name": "index", "type": "uint256" } ], - "name": "ClaimedLiquidation", + "name": "CompleteLiquidation", "type": "event" }, { @@ -113,6 +181,19 @@ "name": "FinalizedWithdrawRequest", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -150,6 +231,19 @@ "name": "LiquidationCall", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -226,6 +320,112 @@ "name": "RequestRedeemed", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "liquidationThreshold", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidationBonusPercent", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidationFeePercent", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "ltv", + "type": "uint256" + } + ], + "name": "RiskConfigUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -245,6 +445,32 @@ "name": "SDUtilized", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "conservativeEthPerKey", + "type": "uint256" + } + ], + "name": "UpdatedConservativeEthPerKey", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -310,19 +536,6 @@ "name": "UpdatedStaderConfig", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "undelegationPeriodInBlocks", - "type": "uint256" - } - ], - "name": "UpdatedUndelegationPeriodInBlocks", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -376,45 +589,148 @@ }, { "inputs": [], - "name": "accrueFee", - "outputs": [], - "stateMutability": "nonpayable", + "name": "DECIMAL", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", "type": "function" }, { "inputs": [], - "name": "cTokenTotalSupply", + "name": "DEFAULT_ADMIN_ROLE", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } ], "stateMutability": "view", "type": "function" }, { - "inputs": [ + "inputs": [], + "name": "MAX_PROTOCOL_FEE", + "outputs": [ { "internalType": "uint256", - "name": "requestId", + "name": "", "type": "uint256" } ], - "name": "claim", - "outputs": [], - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { - "inputs": [ - { "internalType": "uint256", "name": "index", "type": "uint256" } + "inputs": [], + "name": "MAX_UTILIZATION_RATE_PER_BLOCK", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], - "name": "claimLiquidation", - "outputs": [], - "stateMutability": "nonpayable", + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "accrualBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "accrueFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "accumulatedProtocolFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "cTokenTotalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_requestId", + "type": "uint256" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "completeLiquidation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "conservativeEthPerKey", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "sdAmount", "type": "uint256" } + { + "internalType": "uint256", + "name": "sdAmount", + "type": "uint256" + } ], "name": "delegate", "outputs": [], @@ -423,51 +739,774 @@ }, { "inputs": [ - { "internalType": "address", "name": "", "type": "address" } + { + "internalType": "address", + "name": "", + "type": "address" + } ], "name": "delegatorCTokenBalance", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "", "type": "address" } + { + "internalType": "address", + "name": "", + "type": "address" + } ], "name": "delegatorWithdrawRequestedCTokenCount", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "delegatorWithdrawRequests", + "outputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountOfCToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "sdExpected", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "sdFinalized", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestBlock", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "exchangeRateCurrent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "exchangeRateStored", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "finalizationBatchLimit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "finalizeDelegatorWithdrawalRequest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getDelegationRatePerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_delegator", + "type": "address" + } + ], + "name": "getDelegatorLatestSDBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getLatestExchangeRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getLiquidationThreshold", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { - "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } - ], - "name": "delegatorWithdrawRequests", + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getOperatorLiquidation", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "totalAmountInEth", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBonusInEth", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalFeeInEth", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isRepaid", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isClaimed", + "type": "bool" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + } + ], + "internalType": "struct OperatorLiquidation", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "getOperatorTotalEth", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPoolAvailableSDBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_delegator", + "type": "address" + } + ], + "name": "getRequestIdsByDelegator", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getUserData", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "totalInterestSD", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalCollateralInSD", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "healthFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lockedEth", + "type": "uint256" + } + ], + "internalType": "struct UserData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_utilizer", + "type": "address" + } + ], + "name": "getUtilizerLatestBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_admin", + "type": "address" + }, + { + "internalType": "address", + "name": "_staderConfig", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "liquidationCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "liquidations", + "outputs": [ + { + "internalType": "uint256", + "name": "totalAmountInEth", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBonusInEth", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalFeeInEth", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isRepaid", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isClaimed", + "type": "bool" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxApproveSD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "maxETHWorthOfSDPerValidator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxNonRedeemedDelegatorRequestCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minBlockDelayToFinalizeRequest", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextRequestId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextRequestIdToFinalize", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poolUtilization", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "protocolFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repay", + "outputs": [ + { + "internalType": "uint256", + "name": "repaidAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feePaid", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "utilizer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repayOnBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "repaidAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feePaid", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "requestIdsByDelegatorAddress", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_cTokenAmount", + "type": "uint256" + } + ], + "name": "requestWithdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "_requestId", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_sdAmount", + "type": "uint256" + } + ], + "name": "requestWithdrawWithSDAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "_requestId", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "riskConfig", "outputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "uint256", - "name": "amountOfCToken", + "name": "liquidationThreshold", "type": "uint256" }, { "internalType": "uint256", - "name": "sdExpected", + "name": "liquidationBonusPercent", "type": "uint256" }, { "internalType": "uint256", - "name": "sdFinalized", + "name": "liquidationFeePercent", "type": "uint256" }, { "internalType": "uint256", - "name": "requestBlock", + "name": "ltv", "type": "uint256" } ], @@ -476,104 +1515,57 @@ }, { "inputs": [], - "name": "exchangeRateCurrent", - "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "exchangeRateStored", + "name": "sdRequestedForWithdraw", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [], - "name": "finalizeDelegatorWithdrawalRequest", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "getDelegationRate", + "name": "sdReservedForClaim", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ { - "internalType": "address", - "name": "_delegator", - "type": "address" + "internalType": "uint256", + "name": "", + "type": "uint256" } ], - "name": "getDelegatorLatestSDBalance", - "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } - ], "stateMutability": "view", "type": "function" }, { "inputs": [], - "name": "getLatestExchangeRate", + "name": "staderConfig", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "contract IStaderConfig", + "name": "", + "type": "address" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "", "type": "address" } + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } ], - "name": "getOperatorLiquidation", + "name": "supportsInterface", "outputs": [ { - "components": [ - { - "internalType": "uint256", - "name": "totalAmountInEth", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBonusInEth", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalFeeInEth", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isRepaid", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isClaimed", - "type": "bool" - }, - { - "internalType": "address", - "name": "liquidator", - "type": "address" - } - ], - "internalType": "struct OperatorLiquidation", + "internalType": "bool", "name": "", - "type": "tuple" + "type": "bool" } ], "stateMutability": "view", @@ -581,143 +1573,60 @@ }, { "inputs": [], - "name": "getPoolAvailableSDBalance", - "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_owner", "type": "address" } - ], - "name": "getRequestIdsByDelegator", + "name": "totalUtilizedSD", "outputs": [ - { "internalType": "uint256[]", "name": "", "type": "uint256[]" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ { - "internalType": "address", - "name": "_utilizer", - "type": "address" + "internalType": "uint256", + "name": "", + "type": "uint256" } ], - "name": "getUtilizerLatestBalance", - "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } - ], "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } - ], - "name": "liquidationCall", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [], - "name": "maxApproveSD", + "name": "unpause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "poolUtilization", - "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { "internalType": "uint256", - "name": "repayAmount", + "name": "_newEthPerKey", "type": "uint256" } ], - "name": "repay", - "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } - ], - "name": "repayLiquidation", + "name": "updateConservativeEthPerKey", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { - "internalType": "address", - "name": "utilizer", - "type": "address" - }, { "internalType": "uint256", - "name": "repayAmount", + "name": "_finalizationBatchLimit", "type": "uint256" } ], - "name": "repayOnBehalf", - "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } - ], + "name": "updateFinalizationBatchLimit", + "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "uint256", "name": "", "type": "uint256" } - ], - "name": "requestIdsByDelegatorAddress", - "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { "internalType": "uint256", - "name": "cTokenAmount", + "name": "_maxETHWorthOfSDPerValidator", "type": "uint256" } ], - "name": "requestWithdraw", - "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "sdAmount", "type": "uint256" } - ], - "name": "requestWithdrawWithSDAmount", - "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } - ], + "name": "updateMaxETHWorthOfSDPerValidator", + "outputs": [], "stateMutability": "nonpayable", "type": "function" }, @@ -725,11 +1634,11 @@ "inputs": [ { "internalType": "uint256", - "name": "_finalizationBatchLimit", + "name": "_count", "type": "uint256" } ], - "name": "updateFinalizationBatchLimit", + "name": "updateMaxNonRedeemedDelegatorRequestCount", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -738,20 +1647,11 @@ "inputs": [ { "internalType": "uint256", - "name": "_maxETHWorthOfSDPerValidator", + "name": "_minBlockDelayToFinalizeRequest", "type": "uint256" } ], - "name": "updateMaxETHWorthOfSDPerValidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_count", "type": "uint256" } - ], - "name": "updateMaxNonRedeemedDelegatorRequestCount", + "name": "updateMinBlockDelayToFinalizeRequest", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -760,11 +1660,11 @@ "inputs": [ { "internalType": "uint256", - "name": "_minBlockDelayToFinalizeRequest", + "name": "_protocolFee", "type": "uint256" } ], - "name": "updateMinBlockDelayToFinalizeRequest", + "name": "updateProtocolFee", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -773,11 +1673,26 @@ "inputs": [ { "internalType": "uint256", - "name": "_protocolFeeFactor", + "name": "liquidationThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationBonusPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationFeePercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "ltv", "type": "uint256" } ], - "name": "updateProtocolFeeFactor", + "name": "updateRiskConfig", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -799,26 +1714,26 @@ "inputs": [ { "internalType": "uint256", - "name": "_undelegationPeriodInBlocks", + "name": "_utilizationRatePerBlock", "type": "uint256" } ], - "name": "updateUndelegationPeriodInBlocks", + "name": "updateUtilizationRatePerBlock", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { - "inputs": [ + "inputs": [], + "name": "utilizationRatePerBlock", + "outputs": [ { "internalType": "uint256", - "name": "_utilizationRatePerBlock", + "name": "", "type": "uint256" } ], - "name": "updateUtilizationRatePerBlock", - "outputs": [], - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { @@ -834,6 +1749,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "utilizeIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -859,29 +1787,49 @@ }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "utilizerBalanceCurrent", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "utilizerBalanceStored", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "", "type": "address" } + { + "internalType": "address", + "name": "", + "type": "address" + } ], "name": "utilizerData", "outputs": [ @@ -901,7 +1849,11 @@ }, { "inputs": [ - { "internalType": "uint256", "name": "_amount", "type": "uint256" } + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } ], "name": "withdrawProtocolFee", "outputs": [], diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 7bc52db6f..bf86057a7 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -63,13 +63,13 @@ func nodeDeposit(c *cli.Context) error { return err } - userBalance := status.AccountBalances.ETH - amountToSend := new(big.Int).Mul(eth.EthToWei(eth.BaseAmountInEth), big.NewInt(int64(numValidators))) + // userBalance := status.AccountBalances.ETH + // amountToSend := new(big.Int).Mul(eth.EthToWei(eth.BaseAmountInEth), big.NewInt(int64(numValidators))) - if userBalance.Cmp(amountToSend) < 0 { - fmt.Printf("You don't have sufficient ETH in your Operator Address to add validators. Please deposit ETH into your Operator Address and try again to add validators to your node.") - return nil - } + // if userBalance.Cmp(amountToSend) < 0 { + // fmt.Printf("You don't have sufficient ETH in your Operator Address to add validators. Please deposit ETH into your Operator Address and try again to add validators to your node.") + // return nil + // } // Prompt for confirmation if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( @@ -97,7 +97,7 @@ func nodeDeposit(c *cli.Context) error { return err } - if !cliutils.Confirm(fmt.Sprintf("Are you sure you want to use %f SD from the Utility Pool? [Y/N] \nNote: A Utilization Fee of %s APR will be applied to the utilized SD from the Utility Pool. ", eth.WeiToEth(utilityAmount), sdStatus.UtilizationRate.String())) { + if !cliutils.Confirm(fmt.Sprintf("Are you sure you want to use %f SD from the Utility Pool? [Y/N] \nNote: A Utilization Fee of %s%s APR will be applied to the utilized SD from the Utility Pool. ", eth.WeiToEth(utilityAmount), sdStatus.UtilizationRate.String(), "%")) { fmt.Printf("Cancelled\n") return nil } diff --git a/stader-lib/contracts/sd-utility.go b/stader-lib/contracts/sd-utility.go index 51cbdb05e..67fb5db3d 100644 --- a/stader-lib/contracts/sd-utility.go +++ b/stader-lib/contracts/sd-utility.go @@ -29,9 +29,27 @@ var ( _ = abi.ConvertType ) +// OperatorLiquidation is an auto generated low-level Go binding around an user-defined struct. +type OperatorLiquidation struct { + TotalAmountInEth *big.Int + TotalBonusInEth *big.Int + TotalFeeInEth *big.Int + IsRepaid bool + IsClaimed bool + Liquidator common.Address +} + +// UserData is an auto generated low-level Go binding around an user-defined struct. +type UserData struct { + TotalInterestSD *big.Int + TotalCollateralInSD *big.Int + HealthFactor *big.Int + LockedEth *big.Int +} + // SDUtilityPoolMetaData contains all meta data concerning the SDUtilityPool contract. var SDUtilityPoolMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"AccrualBlockNumberNotLatest\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotAuthorizedToRedeem\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotFindRequestId\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientPoolBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAmountOfWithdraw\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxLimitOnWithdrawRequestCountReached\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"RequestIdNotFinalized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDUtilizeLimitReached\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UndelegationPeriodNotPassed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAccumulated\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalProtocolFee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalUtilizedSD\",\"type\":\"uint256\"}],\"name\":\"AccruedFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXToMint\",\"type\":\"uint256\"}],\"name\":\"Delegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestIdToFinalize\",\"type\":\"uint256\"}],\"name\":\"FinalizedWithdrawRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"protocolFeeFactor\",\"type\":\"uint256\"}],\"name\":\"ProtocolFeeFactorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXAmount\",\"type\":\"uint256\"}],\"name\":\"Redeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"Repaid\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdToTransfer\",\"type\":\"uint256\"}],\"name\":\"RequestRedeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"SDUtilized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"finalizationBatchLimit\",\"type\":\"uint256\"}],\"name\":\"UpdatedFinalizationBatchLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxETHWorthOfSDPerValidator\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxETHWorthOfSDPerValidator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxNonRedeemedDelegatorRequestCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minBlockDelayToFinalizeRequest\",\"type\":\"uint256\"}],\"name\":\"UpdatedMinBlockDelayToFinalizeRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"undelegationPeriodInBlocks\",\"type\":\"uint256\"}],\"name\":\"UpdatedUndelegationPeriodInBlocks\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizationRatePerBlock\",\"type\":\"uint256\"}],\"name\":\"UtilizationRatePerBlockUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"slashSDAmount\",\"type\":\"uint256\"}],\"name\":\"UtilizerSDSlashingHandled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmountToWithdraw\",\"type\":\"uint256\"}],\"name\":\"WithdrawRequestReceived\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"accrueFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cTokenTotalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"delegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"delegatorCTokenBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"delegatorWithdrawRequests\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountOfCToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdExpected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdFinalized\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finalizeDelegatorWithdrawalRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDelegationRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_delegator\",\"type\":\"address\"}],\"name\":\"getDelegatorLatestSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLatestExchangeRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPoolAvailableSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"getRequestIdsByDelegator\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_utilizer\",\"type\":\"address\"}],\"name\":\"getUtilizerLatestBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_utilizer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_slashSDAmount\",\"type\":\"uint256\"}],\"name\":\"handleUtilizerSDSlashing\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"liquidationCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxApproveSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"poolUtilization\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repay\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repayOnBehalf\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"requestIdsByDelegatorAddress\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"cTokenAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdrawWithSDAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"utilize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonTerminalKeyCount\",\"type\":\"uint256\"}],\"name\":\"utilizeWhileAddingKeys\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"utilizerData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"principal\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"utilizeIndex\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"name\":\"AccrualBlockNumberNotLatest\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyClaimed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyLiquidated\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotAuthorizedToRedeem\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotFindRequestId\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientPoolBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAmountOfWithdraw\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInput\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidWithdrawAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxLimitOnWithdrawRequestCountReached\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotClaimable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotLiquidatable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotLiquidator\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"RequestIdNotFinalized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDUtilizeLimitReached\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAccumulated\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalProtocolFee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalUtilizedSD\",\"type\":\"uint256\"}],\"name\":\"AccruedFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"CompleteLiquidation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXToMint\",\"type\":\"uint256\"}],\"name\":\"Delegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestIdToFinalize\",\"type\":\"uint256\"}],\"name\":\"FinalizedWithdrawRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalLiquidationAmountInEth\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationBonusInEth\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationFeeInEth\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"name\":\"LiquidationCall\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"protocolFeeFactor\",\"type\":\"uint256\"}],\"name\":\"ProtocolFeeFactorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXAmount\",\"type\":\"uint256\"}],\"name\":\"Redeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"Repaid\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdToTransfer\",\"type\":\"uint256\"}],\"name\":\"RequestRedeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationThreshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationBonusPercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationFeePercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ltv\",\"type\":\"uint256\"}],\"name\":\"RiskConfigUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"SDUtilized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"conservativeEthPerKey\",\"type\":\"uint256\"}],\"name\":\"UpdatedConservativeEthPerKey\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"finalizationBatchLimit\",\"type\":\"uint256\"}],\"name\":\"UpdatedFinalizationBatchLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxETHWorthOfSDPerValidator\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxETHWorthOfSDPerValidator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxNonRedeemedDelegatorRequestCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minBlockDelayToFinalizeRequest\",\"type\":\"uint256\"}],\"name\":\"UpdatedMinBlockDelayToFinalizeRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizationRatePerBlock\",\"type\":\"uint256\"}],\"name\":\"UtilizationRatePerBlockUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmountToWithdraw\",\"type\":\"uint256\"}],\"name\":\"WithdrawRequestReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"WithdrawnProtocolFee\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"accrueFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cTokenTotalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"completeLiquidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"delegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"delegatorCTokenBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"delegatorWithdrawRequestedCTokenCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"delegatorWithdrawRequests\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountOfCToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdExpected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdFinalized\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finalizeDelegatorWithdrawalRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDelegationRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_delegator\",\"type\":\"address\"}],\"name\":\"getDelegatorLatestSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLatestExchangeRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLiquidationThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"getOperatorLiquidation\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"totalAmountInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalBonusInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalFeeInEth\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isRepaid\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"isClaimed\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"internalType\":\"structOperatorLiquidation\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPoolAvailableSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"getRequestIdsByDelegator\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getUserData\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"totalInterestSD\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalCollateralInSD\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"healthFactor\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lockedEth\",\"type\":\"uint256\"}],\"internalType\":\"structUserData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_utilizer\",\"type\":\"address\"}],\"name\":\"getUtilizerLatestBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"liquidationCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxApproveSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxETHWorthOfSDPerValidator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"poolUtilization\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repay\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repayOnBehalf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"requestIdsByDelegatorAddress\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"cTokenAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdrawWithSDAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newEthPerKey\",\"type\":\"uint256\"}],\"name\":\"updateConservativeEthPerKey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_finalizationBatchLimit\",\"type\":\"uint256\"}],\"name\":\"updateFinalizationBatchLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxETHWorthOfSDPerValidator\",\"type\":\"uint256\"}],\"name\":\"updateMaxETHWorthOfSDPerValidator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"name\":\"updateMaxNonRedeemedDelegatorRequestCount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minBlockDelayToFinalizeRequest\",\"type\":\"uint256\"}],\"name\":\"updateMinBlockDelayToFinalizeRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_protocolFee\",\"type\":\"uint256\"}],\"name\":\"updateProtocolFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_utilizationRatePerBlock\",\"type\":\"uint256\"}],\"name\":\"updateUtilizationRatePerBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"utilizationRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"utilize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonTerminalKeyCount\",\"type\":\"uint256\"}],\"name\":\"utilizeWhileAddingKeys\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"utilizerData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"principal\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"utilizeIndex\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdrawProtocolFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // SDUtilityPoolABI is the input ABI used to generate the binding from. @@ -242,6 +260,37 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) DelegatorCTokenBalance(arg0 co return _SDUtilityPool.Contract.DelegatorCTokenBalance(&_SDUtilityPool.CallOpts, arg0) } +// DelegatorWithdrawRequestedCTokenCount is a free data retrieval call binding the contract method 0x4f8f7a37. +// +// Solidity: function delegatorWithdrawRequestedCTokenCount(address ) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) DelegatorWithdrawRequestedCTokenCount(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "delegatorWithdrawRequestedCTokenCount", arg0) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// DelegatorWithdrawRequestedCTokenCount is a free data retrieval call binding the contract method 0x4f8f7a37. +// +// Solidity: function delegatorWithdrawRequestedCTokenCount(address ) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) DelegatorWithdrawRequestedCTokenCount(arg0 common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.DelegatorWithdrawRequestedCTokenCount(&_SDUtilityPool.CallOpts, arg0) +} + +// DelegatorWithdrawRequestedCTokenCount is a free data retrieval call binding the contract method 0x4f8f7a37. +// +// Solidity: function delegatorWithdrawRequestedCTokenCount(address ) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) DelegatorWithdrawRequestedCTokenCount(arg0 common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.DelegatorWithdrawRequestedCTokenCount(&_SDUtilityPool.CallOpts, arg0) +} + // DelegatorWithdrawRequests is a free data retrieval call binding the contract method 0xe41b55d9. // // Solidity: function delegatorWithdrawRequests(uint256 ) view returns(address owner, uint256 amountOfCToken, uint256 sdExpected, uint256 sdFinalized, uint256 requestBlock) @@ -333,12 +382,12 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) ExchangeRateStored() (*big.Int return _SDUtilityPool.Contract.ExchangeRateStored(&_SDUtilityPool.CallOpts) } -// GetDelegationRate is a free data retrieval call binding the contract method 0x0c7e5c23. +// GetDelegationRatePerBlock is a free data retrieval call binding the contract method 0x6d00679c. // -// Solidity: function getDelegationRate() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) GetDelegationRate(opts *bind.CallOpts) (*big.Int, error) { +// Solidity: function getDelegationRatePerBlock() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) GetDelegationRatePerBlock(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "getDelegationRate") + err := _SDUtilityPool.contract.Call(opts, &out, "getDelegationRatePerBlock") if err != nil { return *new(*big.Int), err @@ -350,18 +399,18 @@ func (_SDUtilityPool *SDUtilityPoolCaller) GetDelegationRate(opts *bind.CallOpts } -// GetDelegationRate is a free data retrieval call binding the contract method 0x0c7e5c23. +// GetDelegationRatePerBlock is a free data retrieval call binding the contract method 0x6d00679c. // -// Solidity: function getDelegationRate() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) GetDelegationRate() (*big.Int, error) { - return _SDUtilityPool.Contract.GetDelegationRate(&_SDUtilityPool.CallOpts) +// Solidity: function getDelegationRatePerBlock() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) GetDelegationRatePerBlock() (*big.Int, error) { + return _SDUtilityPool.Contract.GetDelegationRatePerBlock(&_SDUtilityPool.CallOpts) } -// GetDelegationRate is a free data retrieval call binding the contract method 0x0c7e5c23. +// GetDelegationRatePerBlock is a free data retrieval call binding the contract method 0x6d00679c. // -// Solidity: function getDelegationRate() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) GetDelegationRate() (*big.Int, error) { - return _SDUtilityPool.Contract.GetDelegationRate(&_SDUtilityPool.CallOpts) +// Solidity: function getDelegationRatePerBlock() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetDelegationRatePerBlock() (*big.Int, error) { + return _SDUtilityPool.Contract.GetDelegationRatePerBlock(&_SDUtilityPool.CallOpts) } // GetDelegatorLatestSDBalance is a free data retrieval call binding the contract method 0x22291528. @@ -426,6 +475,68 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) GetLatestExchangeRate() (*big. return _SDUtilityPool.Contract.GetLatestExchangeRate(&_SDUtilityPool.CallOpts) } +// GetLiquidationThreshold is a free data retrieval call binding the contract method 0x4ae9b8bc. +// +// Solidity: function getLiquidationThreshold() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) GetLiquidationThreshold(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "getLiquidationThreshold") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetLiquidationThreshold is a free data retrieval call binding the contract method 0x4ae9b8bc. +// +// Solidity: function getLiquidationThreshold() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) GetLiquidationThreshold() (*big.Int, error) { + return _SDUtilityPool.Contract.GetLiquidationThreshold(&_SDUtilityPool.CallOpts) +} + +// GetLiquidationThreshold is a free data retrieval call binding the contract method 0x4ae9b8bc. +// +// Solidity: function getLiquidationThreshold() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetLiquidationThreshold() (*big.Int, error) { + return _SDUtilityPool.Contract.GetLiquidationThreshold(&_SDUtilityPool.CallOpts) +} + +// GetOperatorLiquidation is a free data retrieval call binding the contract method 0x12372ffe. +// +// Solidity: function getOperatorLiquidation(address ) view returns((uint256,uint256,uint256,bool,bool,address)) +func (_SDUtilityPool *SDUtilityPoolCaller) GetOperatorLiquidation(opts *bind.CallOpts, arg0 common.Address) (OperatorLiquidation, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "getOperatorLiquidation", arg0) + + if err != nil { + return *new(OperatorLiquidation), err + } + + out0 := *abi.ConvertType(out[0], new(OperatorLiquidation)).(*OperatorLiquidation) + + return out0, err + +} + +// GetOperatorLiquidation is a free data retrieval call binding the contract method 0x12372ffe. +// +// Solidity: function getOperatorLiquidation(address ) view returns((uint256,uint256,uint256,bool,bool,address)) +func (_SDUtilityPool *SDUtilityPoolSession) GetOperatorLiquidation(arg0 common.Address) (OperatorLiquidation, error) { + return _SDUtilityPool.Contract.GetOperatorLiquidation(&_SDUtilityPool.CallOpts, arg0) +} + +// GetOperatorLiquidation is a free data retrieval call binding the contract method 0x12372ffe. +// +// Solidity: function getOperatorLiquidation(address ) view returns((uint256,uint256,uint256,bool,bool,address)) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetOperatorLiquidation(arg0 common.Address) (OperatorLiquidation, error) { + return _SDUtilityPool.Contract.GetOperatorLiquidation(&_SDUtilityPool.CallOpts, arg0) +} + // GetPoolAvailableSDBalance is a free data retrieval call binding the contract method 0xda695857. // // Solidity: function getPoolAvailableSDBalance() view returns(uint256) @@ -488,6 +599,37 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) GetRequestIdsByDelegator(_owne return _SDUtilityPool.Contract.GetRequestIdsByDelegator(&_SDUtilityPool.CallOpts, _owner) } +// GetUserData is a free data retrieval call binding the contract method 0xffc9896b. +// +// Solidity: function getUserData(address account) view returns((uint256,uint256,uint256,uint256)) +func (_SDUtilityPool *SDUtilityPoolCaller) GetUserData(opts *bind.CallOpts, account common.Address) (UserData, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "getUserData", account) + + if err != nil { + return *new(UserData), err + } + + out0 := *abi.ConvertType(out[0], new(UserData)).(*UserData) + + return out0, err + +} + +// GetUserData is a free data retrieval call binding the contract method 0xffc9896b. +// +// Solidity: function getUserData(address account) view returns((uint256,uint256,uint256,uint256)) +func (_SDUtilityPool *SDUtilityPoolSession) GetUserData(account common.Address) (UserData, error) { + return _SDUtilityPool.Contract.GetUserData(&_SDUtilityPool.CallOpts, account) +} + +// GetUserData is a free data retrieval call binding the contract method 0xffc9896b. +// +// Solidity: function getUserData(address account) view returns((uint256,uint256,uint256,uint256)) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetUserData(account common.Address) (UserData, error) { + return _SDUtilityPool.Contract.GetUserData(&_SDUtilityPool.CallOpts, account) +} + // GetUtilizerLatestBalance is a free data retrieval call binding the contract method 0x36978412. // // Solidity: function getUtilizerLatestBalance(address _utilizer) view returns(uint256) @@ -519,6 +661,37 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) GetUtilizerLatestBalance(_util return _SDUtilityPool.Contract.GetUtilizerLatestBalance(&_SDUtilityPool.CallOpts, _utilizer) } +// MaxETHWorthOfSDPerValidator is a free data retrieval call binding the contract method 0x2807c313. +// +// Solidity: function maxETHWorthOfSDPerValidator() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) MaxETHWorthOfSDPerValidator(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "maxETHWorthOfSDPerValidator") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MaxETHWorthOfSDPerValidator is a free data retrieval call binding the contract method 0x2807c313. +// +// Solidity: function maxETHWorthOfSDPerValidator() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) MaxETHWorthOfSDPerValidator() (*big.Int, error) { + return _SDUtilityPool.Contract.MaxETHWorthOfSDPerValidator(&_SDUtilityPool.CallOpts) +} + +// MaxETHWorthOfSDPerValidator is a free data retrieval call binding the contract method 0x2807c313. +// +// Solidity: function maxETHWorthOfSDPerValidator() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) MaxETHWorthOfSDPerValidator() (*big.Int, error) { + return _SDUtilityPool.Contract.MaxETHWorthOfSDPerValidator(&_SDUtilityPool.CallOpts) +} + // PoolUtilization is a free data retrieval call binding the contract method 0x9a3263ee. // // Solidity: function poolUtilization() view returns(uint256) @@ -581,6 +754,37 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) RequestIdsByDelegatorAddress(a return _SDUtilityPool.Contract.RequestIdsByDelegatorAddress(&_SDUtilityPool.CallOpts, arg0, arg1) } +// UtilizationRatePerBlock is a free data retrieval call binding the contract method 0x962c7070. +// +// Solidity: function utilizationRatePerBlock() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) UtilizationRatePerBlock(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "utilizationRatePerBlock") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// UtilizationRatePerBlock is a free data retrieval call binding the contract method 0x962c7070. +// +// Solidity: function utilizationRatePerBlock() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) UtilizationRatePerBlock() (*big.Int, error) { + return _SDUtilityPool.Contract.UtilizationRatePerBlock(&_SDUtilityPool.CallOpts) +} + +// UtilizationRatePerBlock is a free data retrieval call binding the contract method 0x962c7070. +// +// Solidity: function utilizationRatePerBlock() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizationRatePerBlock() (*big.Int, error) { + return _SDUtilityPool.Contract.UtilizationRatePerBlock(&_SDUtilityPool.CallOpts) +} + // UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. // // Solidity: function utilizerBalanceStored(address account) view returns(uint256) @@ -699,6 +903,27 @@ func (_SDUtilityPool *SDUtilityPoolTransactorSession) Claim(requestId *big.Int) return _SDUtilityPool.Contract.Claim(&_SDUtilityPool.TransactOpts, requestId) } +// CompleteLiquidation is a paid mutator transaction binding the contract method 0xd844cb6c. +// +// Solidity: function completeLiquidation(address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) CompleteLiquidation(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "completeLiquidation", account) +} + +// CompleteLiquidation is a paid mutator transaction binding the contract method 0xd844cb6c. +// +// Solidity: function completeLiquidation(address account) returns() +func (_SDUtilityPool *SDUtilityPoolSession) CompleteLiquidation(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.CompleteLiquidation(&_SDUtilityPool.TransactOpts, account) +} + +// CompleteLiquidation is a paid mutator transaction binding the contract method 0xd844cb6c. +// +// Solidity: function completeLiquidation(address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) CompleteLiquidation(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.CompleteLiquidation(&_SDUtilityPool.TransactOpts, account) +} + // Delegate is a paid mutator transaction binding the contract method 0x9fa6dd35. // // Solidity: function delegate(uint256 sdAmount) returns() @@ -762,27 +987,6 @@ func (_SDUtilityPool *SDUtilityPoolTransactorSession) FinalizeDelegatorWithdrawa return _SDUtilityPool.Contract.FinalizeDelegatorWithdrawalRequest(&_SDUtilityPool.TransactOpts) } -// HandleUtilizerSDSlashing is a paid mutator transaction binding the contract method 0xfa72bf63. -// -// Solidity: function handleUtilizerSDSlashing(address _utilizer, uint256 _slashSDAmount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) HandleUtilizerSDSlashing(opts *bind.TransactOpts, _utilizer common.Address, _slashSDAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "handleUtilizerSDSlashing", _utilizer, _slashSDAmount) -} - -// HandleUtilizerSDSlashing is a paid mutator transaction binding the contract method 0xfa72bf63. -// -// Solidity: function handleUtilizerSDSlashing(address _utilizer, uint256 _slashSDAmount) returns() -func (_SDUtilityPool *SDUtilityPoolSession) HandleUtilizerSDSlashing(_utilizer common.Address, _slashSDAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.HandleUtilizerSDSlashing(&_SDUtilityPool.TransactOpts, _utilizer, _slashSDAmount) -} - -// HandleUtilizerSDSlashing is a paid mutator transaction binding the contract method 0xfa72bf63. -// -// Solidity: function handleUtilizerSDSlashing(address _utilizer, uint256 _slashSDAmount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) HandleUtilizerSDSlashing(_utilizer common.Address, _slashSDAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.HandleUtilizerSDSlashing(&_SDUtilityPool.TransactOpts, _utilizer, _slashSDAmount) -} - // LiquidationCall is a paid mutator transaction binding the contract method 0xd2ac4a3d. // // Solidity: function liquidationCall(address account) returns() @@ -827,42 +1031,42 @@ func (_SDUtilityPool *SDUtilityPoolTransactorSession) MaxApproveSD() (*types.Tra // Repay is a paid mutator transaction binding the contract method 0x371fd8e6. // -// Solidity: function repay(uint256 repayAmount) returns() +// Solidity: function repay(uint256 repayAmount) returns(uint256, uint256) func (_SDUtilityPool *SDUtilityPoolTransactor) Repay(opts *bind.TransactOpts, repayAmount *big.Int) (*types.Transaction, error) { return _SDUtilityPool.contract.Transact(opts, "repay", repayAmount) } // Repay is a paid mutator transaction binding the contract method 0x371fd8e6. // -// Solidity: function repay(uint256 repayAmount) returns() +// Solidity: function repay(uint256 repayAmount) returns(uint256, uint256) func (_SDUtilityPool *SDUtilityPoolSession) Repay(repayAmount *big.Int) (*types.Transaction, error) { return _SDUtilityPool.Contract.Repay(&_SDUtilityPool.TransactOpts, repayAmount) } // Repay is a paid mutator transaction binding the contract method 0x371fd8e6. // -// Solidity: function repay(uint256 repayAmount) returns() +// Solidity: function repay(uint256 repayAmount) returns(uint256, uint256) func (_SDUtilityPool *SDUtilityPoolTransactorSession) Repay(repayAmount *big.Int) (*types.Transaction, error) { return _SDUtilityPool.Contract.Repay(&_SDUtilityPool.TransactOpts, repayAmount) } // RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. // -// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns() +// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns(uint256, uint256) func (_SDUtilityPool *SDUtilityPoolTransactor) RepayOnBehalf(opts *bind.TransactOpts, utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { return _SDUtilityPool.contract.Transact(opts, "repayOnBehalf", utilizer, repayAmount) } // RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. // -// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns() +// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns(uint256, uint256) func (_SDUtilityPool *SDUtilityPoolSession) RepayOnBehalf(utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { return _SDUtilityPool.Contract.RepayOnBehalf(&_SDUtilityPool.TransactOpts, utilizer, repayAmount) } // RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. // -// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns() +// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns(uint256, uint256) func (_SDUtilityPool *SDUtilityPoolTransactorSession) RepayOnBehalf(utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { return _SDUtilityPool.Contract.RepayOnBehalf(&_SDUtilityPool.TransactOpts, utilizer, repayAmount) } @@ -909,6 +1113,174 @@ func (_SDUtilityPool *SDUtilityPoolTransactorSession) RequestWithdrawWithSDAmoun return _SDUtilityPool.Contract.RequestWithdrawWithSDAmount(&_SDUtilityPool.TransactOpts, sdAmount) } +// UpdateConservativeEthPerKey is a paid mutator transaction binding the contract method 0x1c557f05. +// +// Solidity: function updateConservativeEthPerKey(uint256 _newEthPerKey) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateConservativeEthPerKey(opts *bind.TransactOpts, _newEthPerKey *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateConservativeEthPerKey", _newEthPerKey) +} + +// UpdateConservativeEthPerKey is a paid mutator transaction binding the contract method 0x1c557f05. +// +// Solidity: function updateConservativeEthPerKey(uint256 _newEthPerKey) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateConservativeEthPerKey(_newEthPerKey *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateConservativeEthPerKey(&_SDUtilityPool.TransactOpts, _newEthPerKey) +} + +// UpdateConservativeEthPerKey is a paid mutator transaction binding the contract method 0x1c557f05. +// +// Solidity: function updateConservativeEthPerKey(uint256 _newEthPerKey) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateConservativeEthPerKey(_newEthPerKey *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateConservativeEthPerKey(&_SDUtilityPool.TransactOpts, _newEthPerKey) +} + +// UpdateFinalizationBatchLimit is a paid mutator transaction binding the contract method 0x267fca73. +// +// Solidity: function updateFinalizationBatchLimit(uint256 _finalizationBatchLimit) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateFinalizationBatchLimit(opts *bind.TransactOpts, _finalizationBatchLimit *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateFinalizationBatchLimit", _finalizationBatchLimit) +} + +// UpdateFinalizationBatchLimit is a paid mutator transaction binding the contract method 0x267fca73. +// +// Solidity: function updateFinalizationBatchLimit(uint256 _finalizationBatchLimit) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateFinalizationBatchLimit(_finalizationBatchLimit *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateFinalizationBatchLimit(&_SDUtilityPool.TransactOpts, _finalizationBatchLimit) +} + +// UpdateFinalizationBatchLimit is a paid mutator transaction binding the contract method 0x267fca73. +// +// Solidity: function updateFinalizationBatchLimit(uint256 _finalizationBatchLimit) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateFinalizationBatchLimit(_finalizationBatchLimit *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateFinalizationBatchLimit(&_SDUtilityPool.TransactOpts, _finalizationBatchLimit) +} + +// UpdateMaxETHWorthOfSDPerValidator is a paid mutator transaction binding the contract method 0x5393618e. +// +// Solidity: function updateMaxETHWorthOfSDPerValidator(uint256 _maxETHWorthOfSDPerValidator) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateMaxETHWorthOfSDPerValidator(opts *bind.TransactOpts, _maxETHWorthOfSDPerValidator *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateMaxETHWorthOfSDPerValidator", _maxETHWorthOfSDPerValidator) +} + +// UpdateMaxETHWorthOfSDPerValidator is a paid mutator transaction binding the contract method 0x5393618e. +// +// Solidity: function updateMaxETHWorthOfSDPerValidator(uint256 _maxETHWorthOfSDPerValidator) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateMaxETHWorthOfSDPerValidator(_maxETHWorthOfSDPerValidator *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateMaxETHWorthOfSDPerValidator(&_SDUtilityPool.TransactOpts, _maxETHWorthOfSDPerValidator) +} + +// UpdateMaxETHWorthOfSDPerValidator is a paid mutator transaction binding the contract method 0x5393618e. +// +// Solidity: function updateMaxETHWorthOfSDPerValidator(uint256 _maxETHWorthOfSDPerValidator) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateMaxETHWorthOfSDPerValidator(_maxETHWorthOfSDPerValidator *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateMaxETHWorthOfSDPerValidator(&_SDUtilityPool.TransactOpts, _maxETHWorthOfSDPerValidator) +} + +// UpdateMaxNonRedeemedDelegatorRequestCount is a paid mutator transaction binding the contract method 0xee63e5f9. +// +// Solidity: function updateMaxNonRedeemedDelegatorRequestCount(uint256 _count) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateMaxNonRedeemedDelegatorRequestCount(opts *bind.TransactOpts, _count *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateMaxNonRedeemedDelegatorRequestCount", _count) +} + +// UpdateMaxNonRedeemedDelegatorRequestCount is a paid mutator transaction binding the contract method 0xee63e5f9. +// +// Solidity: function updateMaxNonRedeemedDelegatorRequestCount(uint256 _count) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateMaxNonRedeemedDelegatorRequestCount(_count *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateMaxNonRedeemedDelegatorRequestCount(&_SDUtilityPool.TransactOpts, _count) +} + +// UpdateMaxNonRedeemedDelegatorRequestCount is a paid mutator transaction binding the contract method 0xee63e5f9. +// +// Solidity: function updateMaxNonRedeemedDelegatorRequestCount(uint256 _count) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateMaxNonRedeemedDelegatorRequestCount(_count *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateMaxNonRedeemedDelegatorRequestCount(&_SDUtilityPool.TransactOpts, _count) +} + +// UpdateMinBlockDelayToFinalizeRequest is a paid mutator transaction binding the contract method 0x4a2965af. +// +// Solidity: function updateMinBlockDelayToFinalizeRequest(uint256 _minBlockDelayToFinalizeRequest) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateMinBlockDelayToFinalizeRequest(opts *bind.TransactOpts, _minBlockDelayToFinalizeRequest *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateMinBlockDelayToFinalizeRequest", _minBlockDelayToFinalizeRequest) +} + +// UpdateMinBlockDelayToFinalizeRequest is a paid mutator transaction binding the contract method 0x4a2965af. +// +// Solidity: function updateMinBlockDelayToFinalizeRequest(uint256 _minBlockDelayToFinalizeRequest) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateMinBlockDelayToFinalizeRequest(_minBlockDelayToFinalizeRequest *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateMinBlockDelayToFinalizeRequest(&_SDUtilityPool.TransactOpts, _minBlockDelayToFinalizeRequest) +} + +// UpdateMinBlockDelayToFinalizeRequest is a paid mutator transaction binding the contract method 0x4a2965af. +// +// Solidity: function updateMinBlockDelayToFinalizeRequest(uint256 _minBlockDelayToFinalizeRequest) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateMinBlockDelayToFinalizeRequest(_minBlockDelayToFinalizeRequest *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateMinBlockDelayToFinalizeRequest(&_SDUtilityPool.TransactOpts, _minBlockDelayToFinalizeRequest) +} + +// UpdateProtocolFee is a paid mutator transaction binding the contract method 0x4256dd78. +// +// Solidity: function updateProtocolFee(uint256 _protocolFee) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateProtocolFee(opts *bind.TransactOpts, _protocolFee *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateProtocolFee", _protocolFee) +} + +// UpdateProtocolFee is a paid mutator transaction binding the contract method 0x4256dd78. +// +// Solidity: function updateProtocolFee(uint256 _protocolFee) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateProtocolFee(_protocolFee *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateProtocolFee(&_SDUtilityPool.TransactOpts, _protocolFee) +} + +// UpdateProtocolFee is a paid mutator transaction binding the contract method 0x4256dd78. +// +// Solidity: function updateProtocolFee(uint256 _protocolFee) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateProtocolFee(_protocolFee *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateProtocolFee(&_SDUtilityPool.TransactOpts, _protocolFee) +} + +// UpdateStaderConfig is a paid mutator transaction binding the contract method 0x9ee804cb. +// +// Solidity: function updateStaderConfig(address _staderConfig) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateStaderConfig(opts *bind.TransactOpts, _staderConfig common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateStaderConfig", _staderConfig) +} + +// UpdateStaderConfig is a paid mutator transaction binding the contract method 0x9ee804cb. +// +// Solidity: function updateStaderConfig(address _staderConfig) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateStaderConfig(_staderConfig common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateStaderConfig(&_SDUtilityPool.TransactOpts, _staderConfig) +} + +// UpdateStaderConfig is a paid mutator transaction binding the contract method 0x9ee804cb. +// +// Solidity: function updateStaderConfig(address _staderConfig) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateStaderConfig(_staderConfig common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateStaderConfig(&_SDUtilityPool.TransactOpts, _staderConfig) +} + +// UpdateUtilizationRatePerBlock is a paid mutator transaction binding the contract method 0xcb2d89dd. +// +// Solidity: function updateUtilizationRatePerBlock(uint256 _utilizationRatePerBlock) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateUtilizationRatePerBlock(opts *bind.TransactOpts, _utilizationRatePerBlock *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateUtilizationRatePerBlock", _utilizationRatePerBlock) +} + +// UpdateUtilizationRatePerBlock is a paid mutator transaction binding the contract method 0xcb2d89dd. +// +// Solidity: function updateUtilizationRatePerBlock(uint256 _utilizationRatePerBlock) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateUtilizationRatePerBlock(_utilizationRatePerBlock *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateUtilizationRatePerBlock(&_SDUtilityPool.TransactOpts, _utilizationRatePerBlock) +} + +// UpdateUtilizationRatePerBlock is a paid mutator transaction binding the contract method 0xcb2d89dd. +// +// Solidity: function updateUtilizationRatePerBlock(uint256 _utilizationRatePerBlock) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateUtilizationRatePerBlock(_utilizationRatePerBlock *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateUtilizationRatePerBlock(&_SDUtilityPool.TransactOpts, _utilizationRatePerBlock) +} + // Utilize is a paid mutator transaction binding the contract method 0xec29c551. // // Solidity: function utilize(uint256 utilizeAmount) returns() @@ -972,6 +1344,27 @@ func (_SDUtilityPool *SDUtilityPoolTransactorSession) UtilizerBalanceCurrent(acc return _SDUtilityPool.Contract.UtilizerBalanceCurrent(&_SDUtilityPool.TransactOpts, account) } +// WithdrawProtocolFee is a paid mutator transaction binding the contract method 0x424cd833. +// +// Solidity: function withdrawProtocolFee(uint256 _amount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) WithdrawProtocolFee(opts *bind.TransactOpts, _amount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "withdrawProtocolFee", _amount) +} + +// WithdrawProtocolFee is a paid mutator transaction binding the contract method 0x424cd833. +// +// Solidity: function withdrawProtocolFee(uint256 _amount) returns() +func (_SDUtilityPool *SDUtilityPoolSession) WithdrawProtocolFee(_amount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.WithdrawProtocolFee(&_SDUtilityPool.TransactOpts, _amount) +} + +// WithdrawProtocolFee is a paid mutator transaction binding the contract method 0x424cd833. +// +// Solidity: function withdrawProtocolFee(uint256 _amount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) WithdrawProtocolFee(_amount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.WithdrawProtocolFee(&_SDUtilityPool.TransactOpts, _amount) +} + // SDUtilityPoolAccruedFeesIterator is returned from FilterAccruedFees and is used to iterate over the raw logs and unpacked data for AccruedFees events raised by the SDUtilityPool contract. type SDUtilityPoolAccruedFeesIterator struct { Event *SDUtilityPoolAccruedFees // Event containing the contract specifics and raw log @@ -1108,9 +1501,9 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) ParseAccruedFees(log types.Log) (*S return event, nil } -// SDUtilityPoolDelegatedIterator is returned from FilterDelegated and is used to iterate over the raw logs and unpacked data for Delegated events raised by the SDUtilityPool contract. -type SDUtilityPoolDelegatedIterator struct { - Event *SDUtilityPoolDelegated // Event containing the contract specifics and raw log +// SDUtilityPoolCompleteLiquidationIterator is returned from FilterCompleteLiquidation and is used to iterate over the raw logs and unpacked data for CompleteLiquidation events raised by the SDUtilityPool contract. +type SDUtilityPoolCompleteLiquidationIterator struct { + Event *SDUtilityPoolCompleteLiquidation // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1124,7 +1517,7 @@ type SDUtilityPoolDelegatedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolDelegatedIterator) Next() bool { +func (it *SDUtilityPoolCompleteLiquidationIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1133,7 +1526,7 @@ func (it *SDUtilityPoolDelegatedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolDelegated) + it.Event = new(SDUtilityPoolCompleteLiquidation) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1148,7 +1541,7 @@ func (it *SDUtilityPoolDelegatedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolDelegated) + it.Event = new(SDUtilityPoolCompleteLiquidation) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1164,53 +1557,51 @@ func (it *SDUtilityPoolDelegatedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolDelegatedIterator) Error() error { +func (it *SDUtilityPoolCompleteLiquidationIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolDelegatedIterator) Close() error { +func (it *SDUtilityPoolCompleteLiquidationIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolDelegated represents a Delegated event raised by the SDUtilityPool contract. -type SDUtilityPoolDelegated struct { - Delegator common.Address - SdAmount *big.Int - SdXToMint *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolCompleteLiquidation represents a CompleteLiquidation event raised by the SDUtilityPool contract. +type SDUtilityPoolCompleteLiquidation struct { + Index *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterDelegated is a free log retrieval operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// FilterCompleteLiquidation is a free log retrieval operation binding the contract event 0x2f0c36e8e230af6ceee7ecc30319e10800731fef4913c80afcf23f84b148df5d. // -// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterDelegated(opts *bind.FilterOpts, delegator []common.Address) (*SDUtilityPoolDelegatedIterator, error) { +// Solidity: event CompleteLiquidation(uint256 indexed index) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterCompleteLiquidation(opts *bind.FilterOpts, index []*big.Int) (*SDUtilityPoolCompleteLiquidationIterator, error) { - var delegatorRule []interface{} - for _, delegatorItem := range delegator { - delegatorRule = append(delegatorRule, delegatorItem) + var indexRule []interface{} + for _, indexItem := range index { + indexRule = append(indexRule, indexItem) } - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Delegated", delegatorRule) + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "CompleteLiquidation", indexRule) if err != nil { return nil, err } - return &SDUtilityPoolDelegatedIterator{contract: _SDUtilityPool.contract, event: "Delegated", logs: logs, sub: sub}, nil + return &SDUtilityPoolCompleteLiquidationIterator{contract: _SDUtilityPool.contract, event: "CompleteLiquidation", logs: logs, sub: sub}, nil } -// WatchDelegated is a free log subscription operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// WatchCompleteLiquidation is a free log subscription operation binding the contract event 0x2f0c36e8e230af6ceee7ecc30319e10800731fef4913c80afcf23f84b148df5d. // -// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchDelegated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolDelegated, delegator []common.Address) (event.Subscription, error) { +// Solidity: event CompleteLiquidation(uint256 indexed index) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchCompleteLiquidation(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolCompleteLiquidation, index []*big.Int) (event.Subscription, error) { - var delegatorRule []interface{} - for _, delegatorItem := range delegator { - delegatorRule = append(delegatorRule, delegatorItem) + var indexRule []interface{} + for _, indexItem := range index { + indexRule = append(indexRule, indexItem) } - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Delegated", delegatorRule) + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "CompleteLiquidation", indexRule) if err != nil { return nil, err } @@ -1220,8 +1611,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchDelegated(opts *bind.WatchOpts select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolDelegated) - if err := _SDUtilityPool.contract.UnpackLog(event, "Delegated", log); err != nil { + event := new(SDUtilityPoolCompleteLiquidation) + if err := _SDUtilityPool.contract.UnpackLog(event, "CompleteLiquidation", log); err != nil { return err } event.Raw = log @@ -1242,21 +1633,167 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchDelegated(opts *bind.WatchOpts }), nil } -// ParseDelegated is a log parse operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// ParseCompleteLiquidation is a log parse operation binding the contract event 0x2f0c36e8e230af6ceee7ecc30319e10800731fef4913c80afcf23f84b148df5d. // -// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseDelegated(log types.Log) (*SDUtilityPoolDelegated, error) { - event := new(SDUtilityPoolDelegated) - if err := _SDUtilityPool.contract.UnpackLog(event, "Delegated", log); err != nil { +// Solidity: event CompleteLiquidation(uint256 indexed index) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseCompleteLiquidation(log types.Log) (*SDUtilityPoolCompleteLiquidation, error) { + event := new(SDUtilityPoolCompleteLiquidation) + if err := _SDUtilityPool.contract.UnpackLog(event, "CompleteLiquidation", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolFinalizedWithdrawRequestIterator is returned from FilterFinalizedWithdrawRequest and is used to iterate over the raw logs and unpacked data for FinalizedWithdrawRequest events raised by the SDUtilityPool contract. -type SDUtilityPoolFinalizedWithdrawRequestIterator struct { - Event *SDUtilityPoolFinalizedWithdrawRequest // Event containing the contract specifics and raw log +// SDUtilityPoolDelegatedIterator is returned from FilterDelegated and is used to iterate over the raw logs and unpacked data for Delegated events raised by the SDUtilityPool contract. +type SDUtilityPoolDelegatedIterator struct { + Event *SDUtilityPoolDelegated // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolDelegatedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolDelegated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolDelegated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolDelegatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolDelegatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolDelegated represents a Delegated event raised by the SDUtilityPool contract. +type SDUtilityPoolDelegated struct { + Delegator common.Address + SdAmount *big.Int + SdXToMint *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterDelegated is a free log retrieval operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// +// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterDelegated(opts *bind.FilterOpts, delegator []common.Address) (*SDUtilityPoolDelegatedIterator, error) { + + var delegatorRule []interface{} + for _, delegatorItem := range delegator { + delegatorRule = append(delegatorRule, delegatorItem) + } + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Delegated", delegatorRule) + if err != nil { + return nil, err + } + return &SDUtilityPoolDelegatedIterator{contract: _SDUtilityPool.contract, event: "Delegated", logs: logs, sub: sub}, nil +} + +// WatchDelegated is a free log subscription operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// +// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchDelegated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolDelegated, delegator []common.Address) (event.Subscription, error) { + + var delegatorRule []interface{} + for _, delegatorItem := range delegator { + delegatorRule = append(delegatorRule, delegatorItem) + } + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Delegated", delegatorRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolDelegated) + if err := _SDUtilityPool.contract.UnpackLog(event, "Delegated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseDelegated is a log parse operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// +// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseDelegated(log types.Log) (*SDUtilityPoolDelegated, error) { + event := new(SDUtilityPoolDelegated) + if err := _SDUtilityPool.contract.UnpackLog(event, "Delegated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolFinalizedWithdrawRequestIterator is returned from FilterFinalizedWithdrawRequest and is used to iterate over the raw logs and unpacked data for FinalizedWithdrawRequest events raised by the SDUtilityPool contract. +type SDUtilityPoolFinalizedWithdrawRequestIterator struct { + Event *SDUtilityPoolFinalizedWithdrawRequest // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1388,6 +1925,164 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) ParseFinalizedWithdrawRequest(log t return event, nil } +// SDUtilityPoolLiquidationCallIterator is returned from FilterLiquidationCall and is used to iterate over the raw logs and unpacked data for LiquidationCall events raised by the SDUtilityPool contract. +type SDUtilityPoolLiquidationCallIterator struct { + Event *SDUtilityPoolLiquidationCall // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolLiquidationCallIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolLiquidationCall) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolLiquidationCall) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolLiquidationCallIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolLiquidationCallIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolLiquidationCall represents a LiquidationCall event raised by the SDUtilityPool contract. +type SDUtilityPoolLiquidationCall struct { + Account common.Address + TotalLiquidationAmountInEth *big.Int + LiquidationBonusInEth *big.Int + LiquidationFeeInEth *big.Int + Liquidator common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterLiquidationCall is a free log retrieval operation binding the contract event 0xcc9de8be9ac1f02b70a8ca2612f451a769d6d160ad91de17dcc38e54c567a532. +// +// Solidity: event LiquidationCall(address indexed account, uint256 totalLiquidationAmountInEth, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth, address indexed liquidator) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterLiquidationCall(opts *bind.FilterOpts, account []common.Address, liquidator []common.Address) (*SDUtilityPoolLiquidationCallIterator, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + var liquidatorRule []interface{} + for _, liquidatorItem := range liquidator { + liquidatorRule = append(liquidatorRule, liquidatorItem) + } + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "LiquidationCall", accountRule, liquidatorRule) + if err != nil { + return nil, err + } + return &SDUtilityPoolLiquidationCallIterator{contract: _SDUtilityPool.contract, event: "LiquidationCall", logs: logs, sub: sub}, nil +} + +// WatchLiquidationCall is a free log subscription operation binding the contract event 0xcc9de8be9ac1f02b70a8ca2612f451a769d6d160ad91de17dcc38e54c567a532. +// +// Solidity: event LiquidationCall(address indexed account, uint256 totalLiquidationAmountInEth, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth, address indexed liquidator) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchLiquidationCall(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolLiquidationCall, account []common.Address, liquidator []common.Address) (event.Subscription, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + var liquidatorRule []interface{} + for _, liquidatorItem := range liquidator { + liquidatorRule = append(liquidatorRule, liquidatorItem) + } + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "LiquidationCall", accountRule, liquidatorRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolLiquidationCall) + if err := _SDUtilityPool.contract.UnpackLog(event, "LiquidationCall", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseLiquidationCall is a log parse operation binding the contract event 0xcc9de8be9ac1f02b70a8ca2612f451a769d6d160ad91de17dcc38e54c567a532. +// +// Solidity: event LiquidationCall(address indexed account, uint256 totalLiquidationAmountInEth, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth, address indexed liquidator) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseLiquidationCall(log types.Log) (*SDUtilityPoolLiquidationCall, error) { + event := new(SDUtilityPoolLiquidationCall) + if err := _SDUtilityPool.contract.UnpackLog(event, "LiquidationCall", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + // SDUtilityPoolProtocolFeeFactorUpdatedIterator is returned from FilterProtocolFeeFactorUpdated and is used to iterate over the raw logs and unpacked data for ProtocolFeeFactorUpdated events raised by the SDUtilityPool contract. type SDUtilityPoolProtocolFeeFactorUpdatedIterator struct { Event *SDUtilityPoolProtocolFeeFactorUpdated // Event containing the contract specifics and raw log @@ -1813,9 +2508,281 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRepaid(log types.Log) (*SDUtil return event, nil } -// SDUtilityPoolRequestRedeemedIterator is returned from FilterRequestRedeemed and is used to iterate over the raw logs and unpacked data for RequestRedeemed events raised by the SDUtilityPool contract. -type SDUtilityPoolRequestRedeemedIterator struct { - Event *SDUtilityPoolRequestRedeemed // Event containing the contract specifics and raw log +// SDUtilityPoolRequestRedeemedIterator is returned from FilterRequestRedeemed and is used to iterate over the raw logs and unpacked data for RequestRedeemed events raised by the SDUtilityPool contract. +type SDUtilityPoolRequestRedeemedIterator struct { + Event *SDUtilityPoolRequestRedeemed // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolRequestRedeemed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolRequestRedeemed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolRequestRedeemedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolRequestRedeemedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolRequestRedeemed represents a RequestRedeemed event raised by the SDUtilityPool contract. +type SDUtilityPoolRequestRedeemed struct { + Caller common.Address + SdToTransfer *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRequestRedeemed is a free log retrieval operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. +// +// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRequestRedeemed(opts *bind.FilterOpts) (*SDUtilityPoolRequestRedeemedIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RequestRedeemed") + if err != nil { + return nil, err + } + return &SDUtilityPoolRequestRedeemedIterator{contract: _SDUtilityPool.contract, event: "RequestRedeemed", logs: logs, sub: sub}, nil +} + +// WatchRequestRedeemed is a free log subscription operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. +// +// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRequestRedeemed(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRequestRedeemed) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RequestRedeemed") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolRequestRedeemed) + if err := _SDUtilityPool.contract.UnpackLog(event, "RequestRedeemed", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseRequestRedeemed is a log parse operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. +// +// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRequestRedeemed(log types.Log) (*SDUtilityPoolRequestRedeemed, error) { + event := new(SDUtilityPoolRequestRedeemed) + if err := _SDUtilityPool.contract.UnpackLog(event, "RequestRedeemed", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolRiskConfigUpdatedIterator is returned from FilterRiskConfigUpdated and is used to iterate over the raw logs and unpacked data for RiskConfigUpdated events raised by the SDUtilityPool contract. +type SDUtilityPoolRiskConfigUpdatedIterator struct { + Event *SDUtilityPoolRiskConfigUpdated // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolRiskConfigUpdatedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolRiskConfigUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolRiskConfigUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolRiskConfigUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolRiskConfigUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolRiskConfigUpdated represents a RiskConfigUpdated event raised by the SDUtilityPool contract. +type SDUtilityPoolRiskConfigUpdated struct { + LiquidationThreshold *big.Int + LiquidationBonusPercent *big.Int + LiquidationFeePercent *big.Int + Ltv *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRiskConfigUpdated is a free log retrieval operation binding the contract event 0x62dd46f943681bd727e339f4baaa19fb66ea209fbe7d9b4a75aa74c33acc18f3. +// +// Solidity: event RiskConfigUpdated(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRiskConfigUpdated(opts *bind.FilterOpts) (*SDUtilityPoolRiskConfigUpdatedIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RiskConfigUpdated") + if err != nil { + return nil, err + } + return &SDUtilityPoolRiskConfigUpdatedIterator{contract: _SDUtilityPool.contract, event: "RiskConfigUpdated", logs: logs, sub: sub}, nil +} + +// WatchRiskConfigUpdated is a free log subscription operation binding the contract event 0x62dd46f943681bd727e339f4baaa19fb66ea209fbe7d9b4a75aa74c33acc18f3. +// +// Solidity: event RiskConfigUpdated(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRiskConfigUpdated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRiskConfigUpdated) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RiskConfigUpdated") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolRiskConfigUpdated) + if err := _SDUtilityPool.contract.UnpackLog(event, "RiskConfigUpdated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseRiskConfigUpdated is a log parse operation binding the contract event 0x62dd46f943681bd727e339f4baaa19fb66ea209fbe7d9b4a75aa74c33acc18f3. +// +// Solidity: event RiskConfigUpdated(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRiskConfigUpdated(log types.Log) (*SDUtilityPoolRiskConfigUpdated, error) { + event := new(SDUtilityPoolRiskConfigUpdated) + if err := _SDUtilityPool.contract.UnpackLog(event, "RiskConfigUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolSDUtilizedIterator is returned from FilterSDUtilized and is used to iterate over the raw logs and unpacked data for SDUtilized events raised by the SDUtilityPool contract. +type SDUtilityPoolSDUtilizedIterator struct { + Event *SDUtilityPoolSDUtilized // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1829,7 +2796,7 @@ type SDUtilityPoolRequestRedeemedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { +func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1838,7 +2805,7 @@ func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRequestRedeemed) + it.Event = new(SDUtilityPoolSDUtilized) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1853,7 +2820,7 @@ func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRequestRedeemed) + it.Event = new(SDUtilityPoolSDUtilized) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1869,42 +2836,42 @@ func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolRequestRedeemedIterator) Error() error { +func (it *SDUtilityPoolSDUtilizedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolRequestRedeemedIterator) Close() error { +func (it *SDUtilityPoolSDUtilizedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolRequestRedeemed represents a RequestRedeemed event raised by the SDUtilityPool contract. -type SDUtilityPoolRequestRedeemed struct { - Caller common.Address - SdToTransfer *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolSDUtilized represents a SDUtilized event raised by the SDUtilityPool contract. +type SDUtilityPoolSDUtilized struct { + Utilizer common.Address + UtilizeAmount *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterRequestRedeemed is a free log retrieval operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. +// FilterSDUtilized is a free log retrieval operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. // -// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRequestRedeemed(opts *bind.FilterOpts) (*SDUtilityPoolRequestRedeemedIterator, error) { +// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterSDUtilized(opts *bind.FilterOpts) (*SDUtilityPoolSDUtilizedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RequestRedeemed") + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "SDUtilized") if err != nil { return nil, err } - return &SDUtilityPoolRequestRedeemedIterator{contract: _SDUtilityPool.contract, event: "RequestRedeemed", logs: logs, sub: sub}, nil + return &SDUtilityPoolSDUtilizedIterator{contract: _SDUtilityPool.contract, event: "SDUtilized", logs: logs, sub: sub}, nil } -// WatchRequestRedeemed is a free log subscription operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. +// WatchSDUtilized is a free log subscription operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. // -// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRequestRedeemed(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRequestRedeemed) (event.Subscription, error) { +// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchSDUtilized(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolSDUtilized) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RequestRedeemed") + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "SDUtilized") if err != nil { return nil, err } @@ -1914,8 +2881,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRequestRedeemed(opts *bind.Wat select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolRequestRedeemed) - if err := _SDUtilityPool.contract.UnpackLog(event, "RequestRedeemed", log); err != nil { + event := new(SDUtilityPoolSDUtilized) + if err := _SDUtilityPool.contract.UnpackLog(event, "SDUtilized", log); err != nil { return err } event.Raw = log @@ -1936,21 +2903,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRequestRedeemed(opts *bind.Wat }), nil } -// ParseRequestRedeemed is a log parse operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. +// ParseSDUtilized is a log parse operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. // -// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRequestRedeemed(log types.Log) (*SDUtilityPoolRequestRedeemed, error) { - event := new(SDUtilityPoolRequestRedeemed) - if err := _SDUtilityPool.contract.UnpackLog(event, "RequestRedeemed", log); err != nil { +// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseSDUtilized(log types.Log) (*SDUtilityPoolSDUtilized, error) { + event := new(SDUtilityPoolSDUtilized) + if err := _SDUtilityPool.contract.UnpackLog(event, "SDUtilized", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolSDUtilizedIterator is returned from FilterSDUtilized and is used to iterate over the raw logs and unpacked data for SDUtilized events raised by the SDUtilityPool contract. -type SDUtilityPoolSDUtilizedIterator struct { - Event *SDUtilityPoolSDUtilized // Event containing the contract specifics and raw log +// SDUtilityPoolUpdatedConservativeEthPerKeyIterator is returned from FilterUpdatedConservativeEthPerKey and is used to iterate over the raw logs and unpacked data for UpdatedConservativeEthPerKey events raised by the SDUtilityPool contract. +type SDUtilityPoolUpdatedConservativeEthPerKeyIterator struct { + Event *SDUtilityPoolUpdatedConservativeEthPerKey // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1964,7 +2931,7 @@ type SDUtilityPoolSDUtilizedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { +func (it *SDUtilityPoolUpdatedConservativeEthPerKeyIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1973,7 +2940,7 @@ func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolSDUtilized) + it.Event = new(SDUtilityPoolUpdatedConservativeEthPerKey) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1988,7 +2955,7 @@ func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolSDUtilized) + it.Event = new(SDUtilityPoolUpdatedConservativeEthPerKey) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2004,42 +2971,41 @@ func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolSDUtilizedIterator) Error() error { +func (it *SDUtilityPoolUpdatedConservativeEthPerKeyIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolSDUtilizedIterator) Close() error { +func (it *SDUtilityPoolUpdatedConservativeEthPerKeyIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolSDUtilized represents a SDUtilized event raised by the SDUtilityPool contract. -type SDUtilityPoolSDUtilized struct { - Utilizer common.Address - UtilizeAmount *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolUpdatedConservativeEthPerKey represents a UpdatedConservativeEthPerKey event raised by the SDUtilityPool contract. +type SDUtilityPoolUpdatedConservativeEthPerKey struct { + ConservativeEthPerKey *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterSDUtilized is a free log retrieval operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. +// FilterUpdatedConservativeEthPerKey is a free log retrieval operation binding the contract event 0x475227c841ac4234d6b624ffe157a80f62c0b4d66161f98684c2fc2ad79bdf52. // -// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterSDUtilized(opts *bind.FilterOpts) (*SDUtilityPoolSDUtilizedIterator, error) { +// Solidity: event UpdatedConservativeEthPerKey(uint256 conservativeEthPerKey) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterUpdatedConservativeEthPerKey(opts *bind.FilterOpts) (*SDUtilityPoolUpdatedConservativeEthPerKeyIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "SDUtilized") + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "UpdatedConservativeEthPerKey") if err != nil { return nil, err } - return &SDUtilityPoolSDUtilizedIterator{contract: _SDUtilityPool.contract, event: "SDUtilized", logs: logs, sub: sub}, nil + return &SDUtilityPoolUpdatedConservativeEthPerKeyIterator{contract: _SDUtilityPool.contract, event: "UpdatedConservativeEthPerKey", logs: logs, sub: sub}, nil } -// WatchSDUtilized is a free log subscription operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. +// WatchUpdatedConservativeEthPerKey is a free log subscription operation binding the contract event 0x475227c841ac4234d6b624ffe157a80f62c0b4d66161f98684c2fc2ad79bdf52. // -// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchSDUtilized(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolSDUtilized) (event.Subscription, error) { +// Solidity: event UpdatedConservativeEthPerKey(uint256 conservativeEthPerKey) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchUpdatedConservativeEthPerKey(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolUpdatedConservativeEthPerKey) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "SDUtilized") + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "UpdatedConservativeEthPerKey") if err != nil { return nil, err } @@ -2049,8 +3015,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchSDUtilized(opts *bind.WatchOpt select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolSDUtilized) - if err := _SDUtilityPool.contract.UnpackLog(event, "SDUtilized", log); err != nil { + event := new(SDUtilityPoolUpdatedConservativeEthPerKey) + if err := _SDUtilityPool.contract.UnpackLog(event, "UpdatedConservativeEthPerKey", log); err != nil { return err } event.Raw = log @@ -2071,12 +3037,12 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchSDUtilized(opts *bind.WatchOpt }), nil } -// ParseSDUtilized is a log parse operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. +// ParseUpdatedConservativeEthPerKey is a log parse operation binding the contract event 0x475227c841ac4234d6b624ffe157a80f62c0b4d66161f98684c2fc2ad79bdf52. // -// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseSDUtilized(log types.Log) (*SDUtilityPoolSDUtilized, error) { - event := new(SDUtilityPoolSDUtilized) - if err := _SDUtilityPool.contract.UnpackLog(event, "SDUtilized", log); err != nil { +// Solidity: event UpdatedConservativeEthPerKey(uint256 conservativeEthPerKey) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseUpdatedConservativeEthPerKey(log types.Log) (*SDUtilityPoolUpdatedConservativeEthPerKey, error) { + event := new(SDUtilityPoolUpdatedConservativeEthPerKey) + if err := _SDUtilityPool.contract.UnpackLog(event, "UpdatedConservativeEthPerKey", log); err != nil { return nil, err } event.Raw = log @@ -2763,140 +3729,6 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) ParseUpdatedStaderConfig(log types. return event, nil } -// SDUtilityPoolUpdatedUndelegationPeriodInBlocksIterator is returned from FilterUpdatedUndelegationPeriodInBlocks and is used to iterate over the raw logs and unpacked data for UpdatedUndelegationPeriodInBlocks events raised by the SDUtilityPool contract. -type SDUtilityPoolUpdatedUndelegationPeriodInBlocksIterator struct { - Event *SDUtilityPoolUpdatedUndelegationPeriodInBlocks // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolUpdatedUndelegationPeriodInBlocksIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SDUtilityPoolUpdatedUndelegationPeriodInBlocks) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SDUtilityPoolUpdatedUndelegationPeriodInBlocks) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolUpdatedUndelegationPeriodInBlocksIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SDUtilityPoolUpdatedUndelegationPeriodInBlocksIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SDUtilityPoolUpdatedUndelegationPeriodInBlocks represents a UpdatedUndelegationPeriodInBlocks event raised by the SDUtilityPool contract. -type SDUtilityPoolUpdatedUndelegationPeriodInBlocks struct { - UndelegationPeriodInBlocks *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterUpdatedUndelegationPeriodInBlocks is a free log retrieval operation binding the contract event 0x727294fbc7a5976b29da226c439fc4cf0ec4f6a81a2d36e157af8667819aa7ac. -// -// Solidity: event UpdatedUndelegationPeriodInBlocks(uint256 undelegationPeriodInBlocks) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterUpdatedUndelegationPeriodInBlocks(opts *bind.FilterOpts) (*SDUtilityPoolUpdatedUndelegationPeriodInBlocksIterator, error) { - - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "UpdatedUndelegationPeriodInBlocks") - if err != nil { - return nil, err - } - return &SDUtilityPoolUpdatedUndelegationPeriodInBlocksIterator{contract: _SDUtilityPool.contract, event: "UpdatedUndelegationPeriodInBlocks", logs: logs, sub: sub}, nil -} - -// WatchUpdatedUndelegationPeriodInBlocks is a free log subscription operation binding the contract event 0x727294fbc7a5976b29da226c439fc4cf0ec4f6a81a2d36e157af8667819aa7ac. -// -// Solidity: event UpdatedUndelegationPeriodInBlocks(uint256 undelegationPeriodInBlocks) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchUpdatedUndelegationPeriodInBlocks(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolUpdatedUndelegationPeriodInBlocks) (event.Subscription, error) { - - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "UpdatedUndelegationPeriodInBlocks") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolUpdatedUndelegationPeriodInBlocks) - if err := _SDUtilityPool.contract.UnpackLog(event, "UpdatedUndelegationPeriodInBlocks", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseUpdatedUndelegationPeriodInBlocks is a log parse operation binding the contract event 0x727294fbc7a5976b29da226c439fc4cf0ec4f6a81a2d36e157af8667819aa7ac. -// -// Solidity: event UpdatedUndelegationPeriodInBlocks(uint256 undelegationPeriodInBlocks) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseUpdatedUndelegationPeriodInBlocks(log types.Log) (*SDUtilityPoolUpdatedUndelegationPeriodInBlocks, error) { - event := new(SDUtilityPoolUpdatedUndelegationPeriodInBlocks) - if err := _SDUtilityPool.contract.UnpackLog(event, "UpdatedUndelegationPeriodInBlocks", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - // SDUtilityPoolUtilizationRatePerBlockUpdatedIterator is returned from FilterUtilizationRatePerBlockUpdated and is used to iterate over the raw logs and unpacked data for UtilizationRatePerBlockUpdated events raised by the SDUtilityPool contract. type SDUtilityPoolUtilizationRatePerBlockUpdatedIterator struct { Event *SDUtilityPoolUtilizationRatePerBlockUpdated // Event containing the contract specifics and raw log @@ -3031,9 +3863,9 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) ParseUtilizationRatePerBlockUpdated return event, nil } -// SDUtilityPoolUtilizerSDSlashingHandledIterator is returned from FilterUtilizerSDSlashingHandled and is used to iterate over the raw logs and unpacked data for UtilizerSDSlashingHandled events raised by the SDUtilityPool contract. -type SDUtilityPoolUtilizerSDSlashingHandledIterator struct { - Event *SDUtilityPoolUtilizerSDSlashingHandled // Event containing the contract specifics and raw log +// SDUtilityPoolWithdrawRequestReceivedIterator is returned from FilterWithdrawRequestReceived and is used to iterate over the raw logs and unpacked data for WithdrawRequestReceived events raised by the SDUtilityPool contract. +type SDUtilityPoolWithdrawRequestReceivedIterator struct { + Event *SDUtilityPoolWithdrawRequestReceived // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -3047,7 +3879,7 @@ type SDUtilityPoolUtilizerSDSlashingHandledIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolUtilizerSDSlashingHandledIterator) Next() bool { +func (it *SDUtilityPoolWithdrawRequestReceivedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -3056,7 +3888,7 @@ func (it *SDUtilityPoolUtilizerSDSlashingHandledIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolUtilizerSDSlashingHandled) + it.Event = new(SDUtilityPoolWithdrawRequestReceived) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -3071,7 +3903,7 @@ func (it *SDUtilityPoolUtilizerSDSlashingHandledIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolUtilizerSDSlashingHandled) + it.Event = new(SDUtilityPoolWithdrawRequestReceived) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -3087,42 +3919,43 @@ func (it *SDUtilityPoolUtilizerSDSlashingHandledIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolUtilizerSDSlashingHandledIterator) Error() error { +func (it *SDUtilityPoolWithdrawRequestReceivedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolUtilizerSDSlashingHandledIterator) Close() error { +func (it *SDUtilityPoolWithdrawRequestReceivedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolUtilizerSDSlashingHandled represents a UtilizerSDSlashingHandled event raised by the SDUtilityPool contract. -type SDUtilityPoolUtilizerSDSlashingHandled struct { - Utilizer common.Address - SlashSDAmount *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolWithdrawRequestReceived represents a WithdrawRequestReceived event raised by the SDUtilityPool contract. +type SDUtilityPoolWithdrawRequestReceived struct { + Caller common.Address + NextRequestId *big.Int + SdAmountToWithdraw *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterUtilizerSDSlashingHandled is a free log retrieval operation binding the contract event 0xf583a13dc98ab9935d418df5efc1b6e0b3b4f642ccc3a8601aec4646e965dc0b. +// FilterWithdrawRequestReceived is a free log retrieval operation binding the contract event 0x0edfc24f4f80277416f78f699d4733f7bb58fd6fb8838e2b1033162cee5fd7aa. // -// Solidity: event UtilizerSDSlashingHandled(address utilizer, uint256 slashSDAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterUtilizerSDSlashingHandled(opts *bind.FilterOpts) (*SDUtilityPoolUtilizerSDSlashingHandledIterator, error) { +// Solidity: event WithdrawRequestReceived(address caller, uint256 nextRequestId, uint256 sdAmountToWithdraw) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterWithdrawRequestReceived(opts *bind.FilterOpts) (*SDUtilityPoolWithdrawRequestReceivedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "UtilizerSDSlashingHandled") + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "WithdrawRequestReceived") if err != nil { return nil, err } - return &SDUtilityPoolUtilizerSDSlashingHandledIterator{contract: _SDUtilityPool.contract, event: "UtilizerSDSlashingHandled", logs: logs, sub: sub}, nil + return &SDUtilityPoolWithdrawRequestReceivedIterator{contract: _SDUtilityPool.contract, event: "WithdrawRequestReceived", logs: logs, sub: sub}, nil } -// WatchUtilizerSDSlashingHandled is a free log subscription operation binding the contract event 0xf583a13dc98ab9935d418df5efc1b6e0b3b4f642ccc3a8601aec4646e965dc0b. +// WatchWithdrawRequestReceived is a free log subscription operation binding the contract event 0x0edfc24f4f80277416f78f699d4733f7bb58fd6fb8838e2b1033162cee5fd7aa. // -// Solidity: event UtilizerSDSlashingHandled(address utilizer, uint256 slashSDAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchUtilizerSDSlashingHandled(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolUtilizerSDSlashingHandled) (event.Subscription, error) { +// Solidity: event WithdrawRequestReceived(address caller, uint256 nextRequestId, uint256 sdAmountToWithdraw) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchWithdrawRequestReceived(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolWithdrawRequestReceived) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "UtilizerSDSlashingHandled") + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "WithdrawRequestReceived") if err != nil { return nil, err } @@ -3132,8 +3965,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchUtilizerSDSlashingHandled(opts select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolUtilizerSDSlashingHandled) - if err := _SDUtilityPool.contract.UnpackLog(event, "UtilizerSDSlashingHandled", log); err != nil { + event := new(SDUtilityPoolWithdrawRequestReceived) + if err := _SDUtilityPool.contract.UnpackLog(event, "WithdrawRequestReceived", log); err != nil { return err } event.Raw = log @@ -3154,21 +3987,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchUtilizerSDSlashingHandled(opts }), nil } -// ParseUtilizerSDSlashingHandled is a log parse operation binding the contract event 0xf583a13dc98ab9935d418df5efc1b6e0b3b4f642ccc3a8601aec4646e965dc0b. +// ParseWithdrawRequestReceived is a log parse operation binding the contract event 0x0edfc24f4f80277416f78f699d4733f7bb58fd6fb8838e2b1033162cee5fd7aa. // -// Solidity: event UtilizerSDSlashingHandled(address utilizer, uint256 slashSDAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseUtilizerSDSlashingHandled(log types.Log) (*SDUtilityPoolUtilizerSDSlashingHandled, error) { - event := new(SDUtilityPoolUtilizerSDSlashingHandled) - if err := _SDUtilityPool.contract.UnpackLog(event, "UtilizerSDSlashingHandled", log); err != nil { +// Solidity: event WithdrawRequestReceived(address caller, uint256 nextRequestId, uint256 sdAmountToWithdraw) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseWithdrawRequestReceived(log types.Log) (*SDUtilityPoolWithdrawRequestReceived, error) { + event := new(SDUtilityPoolWithdrawRequestReceived) + if err := _SDUtilityPool.contract.UnpackLog(event, "WithdrawRequestReceived", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolWithdrawRequestReceivedIterator is returned from FilterWithdrawRequestReceived and is used to iterate over the raw logs and unpacked data for WithdrawRequestReceived events raised by the SDUtilityPool contract. -type SDUtilityPoolWithdrawRequestReceivedIterator struct { - Event *SDUtilityPoolWithdrawRequestReceived // Event containing the contract specifics and raw log +// SDUtilityPoolWithdrawnProtocolFeeIterator is returned from FilterWithdrawnProtocolFee and is used to iterate over the raw logs and unpacked data for WithdrawnProtocolFee events raised by the SDUtilityPool contract. +type SDUtilityPoolWithdrawnProtocolFeeIterator struct { + Event *SDUtilityPoolWithdrawnProtocolFee // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -3182,7 +4015,7 @@ type SDUtilityPoolWithdrawRequestReceivedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolWithdrawRequestReceivedIterator) Next() bool { +func (it *SDUtilityPoolWithdrawnProtocolFeeIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -3191,7 +4024,7 @@ func (it *SDUtilityPoolWithdrawRequestReceivedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolWithdrawRequestReceived) + it.Event = new(SDUtilityPoolWithdrawnProtocolFee) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -3206,7 +4039,7 @@ func (it *SDUtilityPoolWithdrawRequestReceivedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolWithdrawRequestReceived) + it.Event = new(SDUtilityPoolWithdrawnProtocolFee) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -3222,43 +4055,41 @@ func (it *SDUtilityPoolWithdrawRequestReceivedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolWithdrawRequestReceivedIterator) Error() error { +func (it *SDUtilityPoolWithdrawnProtocolFeeIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolWithdrawRequestReceivedIterator) Close() error { +func (it *SDUtilityPoolWithdrawnProtocolFeeIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolWithdrawRequestReceived represents a WithdrawRequestReceived event raised by the SDUtilityPool contract. -type SDUtilityPoolWithdrawRequestReceived struct { - Caller common.Address - NextRequestId *big.Int - SdAmountToWithdraw *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolWithdrawnProtocolFee represents a WithdrawnProtocolFee event raised by the SDUtilityPool contract. +type SDUtilityPoolWithdrawnProtocolFee struct { + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterWithdrawRequestReceived is a free log retrieval operation binding the contract event 0x0edfc24f4f80277416f78f699d4733f7bb58fd6fb8838e2b1033162cee5fd7aa. +// FilterWithdrawnProtocolFee is a free log retrieval operation binding the contract event 0xa32a67c2a472d948ee4cdcce3fdf2df7a9a99b762c69858f0651b1b22067efdf. // -// Solidity: event WithdrawRequestReceived(address caller, uint256 nextRequestId, uint256 sdAmountToWithdraw) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterWithdrawRequestReceived(opts *bind.FilterOpts) (*SDUtilityPoolWithdrawRequestReceivedIterator, error) { +// Solidity: event WithdrawnProtocolFee(uint256 amount) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterWithdrawnProtocolFee(opts *bind.FilterOpts) (*SDUtilityPoolWithdrawnProtocolFeeIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "WithdrawRequestReceived") + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "WithdrawnProtocolFee") if err != nil { return nil, err } - return &SDUtilityPoolWithdrawRequestReceivedIterator{contract: _SDUtilityPool.contract, event: "WithdrawRequestReceived", logs: logs, sub: sub}, nil + return &SDUtilityPoolWithdrawnProtocolFeeIterator{contract: _SDUtilityPool.contract, event: "WithdrawnProtocolFee", logs: logs, sub: sub}, nil } -// WatchWithdrawRequestReceived is a free log subscription operation binding the contract event 0x0edfc24f4f80277416f78f699d4733f7bb58fd6fb8838e2b1033162cee5fd7aa. +// WatchWithdrawnProtocolFee is a free log subscription operation binding the contract event 0xa32a67c2a472d948ee4cdcce3fdf2df7a9a99b762c69858f0651b1b22067efdf. // -// Solidity: event WithdrawRequestReceived(address caller, uint256 nextRequestId, uint256 sdAmountToWithdraw) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchWithdrawRequestReceived(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolWithdrawRequestReceived) (event.Subscription, error) { +// Solidity: event WithdrawnProtocolFee(uint256 amount) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchWithdrawnProtocolFee(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolWithdrawnProtocolFee) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "WithdrawRequestReceived") + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "WithdrawnProtocolFee") if err != nil { return nil, err } @@ -3268,8 +4099,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchWithdrawRequestReceived(opts * select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolWithdrawRequestReceived) - if err := _SDUtilityPool.contract.UnpackLog(event, "WithdrawRequestReceived", log); err != nil { + event := new(SDUtilityPoolWithdrawnProtocolFee) + if err := _SDUtilityPool.contract.UnpackLog(event, "WithdrawnProtocolFee", log); err != nil { return err } event.Raw = log @@ -3290,12 +4121,12 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchWithdrawRequestReceived(opts * }), nil } -// ParseWithdrawRequestReceived is a log parse operation binding the contract event 0x0edfc24f4f80277416f78f699d4733f7bb58fd6fb8838e2b1033162cee5fd7aa. +// ParseWithdrawnProtocolFee is a log parse operation binding the contract event 0xa32a67c2a472d948ee4cdcce3fdf2df7a9a99b762c69858f0651b1b22067efdf. // -// Solidity: event WithdrawRequestReceived(address caller, uint256 nextRequestId, uint256 sdAmountToWithdraw) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseWithdrawRequestReceived(log types.Log) (*SDUtilityPoolWithdrawRequestReceived, error) { - event := new(SDUtilityPoolWithdrawRequestReceived) - if err := _SDUtilityPool.contract.UnpackLog(event, "WithdrawRequestReceived", log); err != nil { +// Solidity: event WithdrawnProtocolFee(uint256 amount) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseWithdrawnProtocolFee(log types.Log) (*SDUtilityPoolWithdrawnProtocolFee, error) { + event := new(SDUtilityPoolWithdrawnProtocolFee) + if err := _SDUtilityPool.contract.UnpackLog(event, "WithdrawnProtocolFee", log); err != nil { return nil, err } event.Raw = log diff --git a/stader-lib/sdutility/sd-utility.go b/stader-lib/sdutility/sd-utility.go index c512da629..2c4081fa9 100644 --- a/stader-lib/sdutility/sd-utility.go +++ b/stader-lib/sdutility/sd-utility.go @@ -35,6 +35,14 @@ func Repay(sp *stader.SDUtilityPoolContractManager, utilityAmount *big.Int, opts } func GetUtilizationRate(sp *stader.SDUtilityPoolContractManager, opts *bind.CallOpts) (*big.Int, error) { - // TODO: fetch from contract - return big.NewInt(50), nil + utilizationRatePerBlockInWei, err := sp.SDUtilityPool.UtilizationRatePerBlock(opts) + if err != nil { + return nil, err + } + + utilizationRatePerYear := new(big.Int).Mul(utilizationRatePerBlockInWei, big.NewInt(2628000)) // 2628000 block per year + + utilizationRateInPercent := new(big.Int).Div(utilizationRatePerYear, big.NewInt(1e16)) // Value in wei and show in % + + return utilizationRateInPercent, nil } From 8be5e06dab2b59ae49df483cc55f4ce27b453b75 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Mon, 11 Dec 2023 17:32:05 +0700 Subject: [PATCH 062/159] In rate in float --- shared/types/api/node.go | 20 ++++++++++---------- stader-lib/sdutility/sd-utility.go | 6 ++++-- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/shared/types/api/node.go b/shared/types/api/node.go index efddd7308..746698df3 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -443,16 +443,16 @@ type GetSdStatusResponse struct { } type SdStatusResponse struct { - SdUtilizerLatestBalance *big.Int `json:"sdUtilizerLatestBalance"` - SdUtilizedBalance *big.Int `json:"sdUtilizedBalance"` - SdCollateralCurrentAmount *big.Int `json:"sdCollateralCurrentAmount"` - SdCollateralRequireAmount *big.Int `json:"sdCollateralRequireAmount"` - SdMaxUtilizableAmount *big.Int `json:"sdMaxUtilizableAmount"` - UtilizationRate *big.Int `json:"utilizationRate"` - SdBalance *big.Int `json:"sdBalance"` - PoolAvailableSDBalance *big.Int `json:"poolAvailableSDBalance"` - SdRewardEligible *big.Int `json:"sdRewardEligible"` - NotEnoughSdCollateral bool `json:"notEnoughSdCollateral"` + SdUtilizerLatestBalance *big.Int `json:"sdUtilizerLatestBalance"` + SdUtilizedBalance *big.Int `json:"sdUtilizedBalance"` + SdCollateralCurrentAmount *big.Int `json:"sdCollateralCurrentAmount"` + SdCollateralRequireAmount *big.Int `json:"sdCollateralRequireAmount"` + SdMaxUtilizableAmount *big.Int `json:"sdMaxUtilizableAmount"` + UtilizationRate *big.Float `json:"utilizationRate"` + SdBalance *big.Int `json:"sdBalance"` + PoolAvailableSDBalance *big.Int `json:"poolAvailableSDBalance"` + SdRewardEligible *big.Int `json:"sdRewardEligible"` + NotEnoughSdCollateral bool `json:"notEnoughSdCollateral"` } type NodeRepayExcessSDResponse struct { diff --git a/stader-lib/sdutility/sd-utility.go b/stader-lib/sdutility/sd-utility.go index 2c4081fa9..0078cc938 100644 --- a/stader-lib/sdutility/sd-utility.go +++ b/stader-lib/sdutility/sd-utility.go @@ -34,7 +34,7 @@ func Repay(sp *stader.SDUtilityPoolContractManager, utilityAmount *big.Int, opts return sp.SDUtilityPool.Repay(opts, utilityAmount) } -func GetUtilizationRate(sp *stader.SDUtilityPoolContractManager, opts *bind.CallOpts) (*big.Int, error) { +func GetUtilizationRate(sp *stader.SDUtilityPoolContractManager, opts *bind.CallOpts) (*big.Float, error) { utilizationRatePerBlockInWei, err := sp.SDUtilityPool.UtilizationRatePerBlock(opts) if err != nil { return nil, err @@ -42,7 +42,9 @@ func GetUtilizationRate(sp *stader.SDUtilityPoolContractManager, opts *bind.Call utilizationRatePerYear := new(big.Int).Mul(utilizationRatePerBlockInWei, big.NewInt(2628000)) // 2628000 block per year - utilizationRateInPercent := new(big.Int).Div(utilizationRatePerYear, big.NewInt(1e16)) // Value in wei and show in % + utilizationRatePerYearF := new(big.Float).SetInt(utilizationRatePerYear) + + utilizationRateInPercent := new(big.Float).Quo(utilizationRatePerYearF, big.NewFloat(1e16)) return utilizationRateInPercent, nil } From c36decba51fb4996f28a9e26cc733a9f9cdf812e Mon Sep 17 00:00:00 2001 From: batphonghan Date: Mon, 11 Dec 2023 17:43:37 +0700 Subject: [PATCH 063/159] Revert back comment --- stader-cli/validator/deposit.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index bf86057a7..410c5bbb9 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -63,13 +63,13 @@ func nodeDeposit(c *cli.Context) error { return err } - // userBalance := status.AccountBalances.ETH - // amountToSend := new(big.Int).Mul(eth.EthToWei(eth.BaseAmountInEth), big.NewInt(int64(numValidators))) + userBalance := status.AccountBalances.ETH + amountToSend := new(big.Int).Mul(eth.EthToWei(eth.BaseAmountInEth), big.NewInt(int64(numValidators))) - // if userBalance.Cmp(amountToSend) < 0 { - // fmt.Printf("You don't have sufficient ETH in your Operator Address to add validators. Please deposit ETH into your Operator Address and try again to add validators to your node.") - // return nil - // } + if userBalance.Cmp(amountToSend) < 0 { + fmt.Printf("You don't have sufficient ETH in your Operator Address to add validators. Please deposit ETH into your Operator Address and try again to add validators to your node.") + return nil + } // Prompt for confirmation if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( From 77cfca79606657b83b89e955d9f29a56297e411c Mon Sep 17 00:00:00 2001 From: batphonghan Date: Mon, 11 Dec 2023 18:47:01 +0700 Subject: [PATCH 064/159] Updated ABI --- abis/SDUtilityPool.abi.json | 692 ++++++++++++++++++++++++++++++++++-- 1 file changed, 670 insertions(+), 22 deletions(-) diff --git a/abis/SDUtilityPool.abi.json b/abis/SDUtilityPool.abi.json index 3b746ba5a..5cd338445 100644 --- a/abis/SDUtilityPool.abi.json +++ b/abis/SDUtilityPool.abi.json @@ -1,4 +1,9 @@ [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, { "inputs": [], "name": "AccrualBlockNumberNotLatest", @@ -19,6 +24,16 @@ "name": "CallerNotAuthorizedToRedeem", "type": "error" }, + { + "inputs": [], + "name": "CallerNotManager", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotStaderContract", + "type": "error" + }, { "inputs": [], "name": "CannotFindRequestId", @@ -85,6 +100,11 @@ "name": "SDUtilizeLimitReached", "type": "error" }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, { "anonymous": false, "inputs": [ @@ -161,6 +181,19 @@ "name": "FinalizedWithdrawRequest", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -198,6 +231,19 @@ "name": "LiquidationCall", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -305,6 +351,81 @@ "name": "RiskConfigUpdated", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -324,6 +445,19 @@ "name": "SDUtilized", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -453,6 +587,71 @@ "name": "WithdrawnProtocolFee", "type": "event" }, + { + "inputs": [], + "name": "DECIMAL", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_PROTOCOL_FEE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_UTILIZATION_RATE_PER_BLOCK", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "accrualBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "accrueFee", @@ -460,6 +659,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "accumulatedProtocolFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "cTokenTotalSupply", @@ -477,7 +689,7 @@ "inputs": [ { "internalType": "uint256", - "name": "requestId", + "name": "_requestId", "type": "uint256" } ], @@ -499,6 +711,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "conservativeEthPerKey", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -615,6 +840,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "finalizationBatchLimit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "finalizeDelegatorWithdrawalRequest", @@ -684,7 +922,7 @@ "inputs": [ { "internalType": "address", - "name": "", + "name": "account", "type": "address" } ], @@ -731,6 +969,25 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "getOperatorTotalEth", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "getPoolAvailableSDBalance", @@ -748,7 +1005,7 @@ "inputs": [ { "internalType": "address", - "name": "_owner", + "name": "_delegator", "type": "address" } ], @@ -763,6 +1020,25 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -825,32 +1101,208 @@ }, { "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, { "internalType": "address", "name": "account", "type": "address" } ], - "name": "liquidationCall", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "maxApproveSD", + "name": "grantRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { - "inputs": [], - "name": "maxETHWorthOfSDPerValidator", + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", "outputs": [ { - "internalType": "uint256", + "internalType": "bool", "name": "", - "type": "uint256" + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_admin", + "type": "address" + }, + { + "internalType": "address", + "name": "_staderConfig", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "liquidationCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "liquidations", + "outputs": [ + { + "internalType": "uint256", + "name": "totalAmountInEth", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBonusInEth", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalFeeInEth", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isRepaid", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isClaimed", + "type": "bool" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxApproveSD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "maxETHWorthOfSDPerValidator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxNonRedeemedDelegatorRequestCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minBlockDelayToFinalizeRequest", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextRequestId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextRequestIdToFinalize", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" } ], "stateMutability": "view", @@ -869,6 +1321,37 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "protocolFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -881,12 +1364,12 @@ "outputs": [ { "internalType": "uint256", - "name": "", + "name": "repaidAmount", "type": "uint256" }, { "internalType": "uint256", - "name": "", + "name": "feePaid", "type": "uint256" } ], @@ -910,12 +1393,12 @@ "outputs": [ { "internalType": "uint256", - "name": "", + "name": "repaidAmount", "type": "uint256" }, { "internalType": "uint256", - "name": "", + "name": "feePaid", "type": "uint256" } ], @@ -950,7 +1433,7 @@ "inputs": [ { "internalType": "uint256", - "name": "cTokenAmount", + "name": "_cTokenAmount", "type": "uint256" } ], @@ -958,7 +1441,7 @@ "outputs": [ { "internalType": "uint256", - "name": "", + "name": "_requestId", "type": "uint256" } ], @@ -969,11 +1452,83 @@ "inputs": [ { "internalType": "uint256", - "name": "sdAmount", + "name": "_sdAmount", "type": "uint256" } ], "name": "requestWithdrawWithSDAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "_requestId", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "riskConfig", + "outputs": [ + { + "internalType": "uint256", + "name": "liquidationThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationBonusPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationFeePercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "ltv", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "sdRequestedForWithdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "sdReservedForClaim", "outputs": [ { "internalType": "uint256", @@ -981,6 +1536,58 @@ "type": "uint256" } ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "staderConfig", + "outputs": [ + { + "internalType": "contract IStaderConfig", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalUtilizedSD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], "stateMutability": "nonpayable", "type": "function" }, @@ -1062,6 +1669,34 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "liquidationThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationBonusPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationFeePercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "ltv", + "type": "uint256" + } + ], + "name": "updateRiskConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -1114,6 +1749,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "utilizeIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { From 1a5067ce1a2d24ab018aaf48e07452f06bb405de Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Mon, 11 Dec 2023 17:46:28 +0530 Subject: [PATCH 065/159] update claim rewards flow --- shared/types/api/node.go | 1 + stader-cli/node/claim-rewards.go | 13 ++++++------- stader/api/node/claim-rewards.go | 10 ++++++++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/shared/types/api/node.go b/shared/types/api/node.go index a510b3510..900c80a94 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -401,6 +401,7 @@ type CanClaimRewards struct { Error string `json:"error"` NoRewards bool `json:"noRewards"` WithdrawableInEth *big.Int `json:"withdrawableInEth"` + ClaimsBalance *big.Int `json:"claimsBalance"` GasInfo stader.GasInfo `json:"gasInfo"` } diff --git a/stader-cli/node/claim-rewards.go b/stader-cli/node/claim-rewards.go index a158485ce..49da4fe93 100644 --- a/stader-cli/node/claim-rewards.go +++ b/stader-cli/node/claim-rewards.go @@ -45,15 +45,14 @@ func ClaimRewards(c *cli.Context) error { sdStatus := sdStatusResponse.SDStatus - // 1. How much SD fee need to repay - // 2. Based on the current Health Factor, you can claim upto ETH. + if canClaimRewardsResponse.ClaimsBalance.Cmp(canClaimRewardsResponse.WithdrawableInEth) != 0 { + if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { + totalFee := new(big.Int).Sub(sdStatus.SdUtilizerLatestBalance, sdStatus.SdUtilizedBalance) - if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { - totalFee := new(big.Int).Sub(sdStatus.SdUtilizerLatestBalance, sdStatus.SdUtilizedBalance) + fmt.Printf(fmt.Sprintf("You need to first pay %f and close the utilization position to get back your funds. Execute the following command to repay your utilized SD stader-cli repay-sd --amount \n", eth.WeiToEth(totalFee))) - cliutils.PrintWarning(fmt.Sprintf("You need to first pay %f and close the utilization position to get back your funds. Execute the following command to repay your utilized SD stader-cli repay-sd --amount \n", eth.WeiToEth(totalFee))) - - cliutils.PrintWarning(fmt.Sprintf("Based on the current Health Factor, you can claim upto %.6f ETH.", eth.WeiToEth(canClaimRewardsResponse.WithdrawableInEth))) + fmt.Printf(fmt.Sprintf("Based on the current Health Factor, you can claim upto %.6f ETH.", eth.WeiToEth(canClaimRewardsResponse.WithdrawableInEth))) + } } err = gas.AssignMaxFeeAndLimit(canClaimRewardsResponse.GasInfo, staderClient, c.Bool("yes")) diff --git a/stader/api/node/claim-rewards.go b/stader/api/node/claim-rewards.go index 05610f693..b91c371b7 100644 --- a/stader/api/node/claim-rewards.go +++ b/stader/api/node/claim-rewards.go @@ -41,9 +41,15 @@ func CanClaimRewards(c *cli.Context) (*api.CanClaimRewards, error) { return nil, err } - response.WithdrawableInEth = withdrawableInEth + totalWithdrawableEth := operatorClaimVaultBalance + if operatorClaimVaultBalance.Cmp(withdrawableInEth) > 0 { + totalWithdrawableEth = withdrawableInEth + } + + response.WithdrawableInEth = totalWithdrawableEth + response.ClaimsBalance = operatorClaimVaultBalance - if operatorClaimVaultBalance.Cmp(big.NewInt(0)) == 0 { + if totalWithdrawableEth.Cmp(big.NewInt(0)) == 0 { response.NoRewards = true return &response, nil } From 64cf40d79ead340486fd4c5fa9701d27dff4cb42 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Mon, 11 Dec 2023 17:47:52 +0530 Subject: [PATCH 066/159] add comment --- stader-cli/node/claim-rewards.go | 1 + 1 file changed, 1 insertion(+) diff --git a/stader-cli/node/claim-rewards.go b/stader-cli/node/claim-rewards.go index 49da4fe93..09b78b47c 100644 --- a/stader-cli/node/claim-rewards.go +++ b/stader-cli/node/claim-rewards.go @@ -45,6 +45,7 @@ func ClaimRewards(c *cli.Context) error { sdStatus := sdStatusResponse.SDStatus + // if withdrawableInEth < claimsBalance, then there is an existing utilization position if canClaimRewardsResponse.ClaimsBalance.Cmp(canClaimRewardsResponse.WithdrawableInEth) != 0 { if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { totalFee := new(big.Int).Sub(sdStatus.SdUtilizerLatestBalance, sdStatus.SdUtilizedBalance) From 0b0207f332ae68768b1d3fa1ee660c310e81760a Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Mon, 11 Dec 2023 18:07:41 +0530 Subject: [PATCH 067/159] minr refactor --- stader-cli/node/withdraw-sd.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index dd4fc5c76..18bf8a492 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -51,13 +51,13 @@ func WithdrawSd(c *cli.Context) error { return err } if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(amountWei) > 0 { - confirm := cliutils.Confirm(fmt.Sprintf("You have an existing Utilization Position of %.6f SD. The excess SD collateral you are trying to withdraw will be used to repay the utilized SD.\n Do you wish to proceed? [y/n]", math.RoundDown(eth.WeiToEth(sdStatusResponse.SDStatus.SdUtilizerLatestBalance), 6))) + confirm := cliutils.Confirm(fmt.Sprintf("You have an existing Utilization Position of %.6f SD. The excess SD collateral you are trying to withdraw will be used to repay the utilized SD.\n Do you wish to proceed?", math.RoundDown(eth.WeiToEth(sdStatusResponse.SDStatus.SdUtilizerLatestBalance), 6))) if !confirm { fmt.Println("Cancelled.") return nil } } else { - confirm := cliutils.Confirm(fmt.Sprintf("You have an existing Utilization Position of %.6f SD. The excess SD collateral you are trying to withdraw will be used to repay the utilized SD and the remaining SD will be sent to your Reward Address.\n Do you wish to proceed? [y/n]", math.RoundDown(eth.WeiToEth(sdStatusResponse.SDStatus.SdUtilizerLatestBalance), 6))) + confirm := cliutils.Confirm(fmt.Sprintf("You have an existing Utilization Position of %.6f SD. The excess SD collateral you are trying to withdraw will be used to repay the utilized SD and the remaining SD will be sent to your Reward Address.\n Do you wish to proceed?", math.RoundDown(eth.WeiToEth(sdStatusResponse.SDStatus.SdUtilizerLatestBalance), 6))) if !confirm { fmt.Println("Cancelled.") return nil From a1487a5f4f07d64b72214228913dcb1be6a96844 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 12 Dec 2023 17:28:50 +0700 Subject: [PATCH 068/159] Update success messages --- stader-cli/node/claim-rewards.go | 8 +++++--- stader-cli/node/repay-sd.go | 4 ++++ stader-cli/node/utilize-sd.go | 4 ++++ stader-cli/node/withdraw-sd.go | 19 ++++++++++++++++++- stader-cli/validator/deposit.go | 10 ++++++---- 5 files changed, 37 insertions(+), 8 deletions(-) diff --git a/stader-cli/node/claim-rewards.go b/stader-cli/node/claim-rewards.go index 09b78b47c..89fcc7561 100644 --- a/stader-cli/node/claim-rewards.go +++ b/stader-cli/node/claim-rewards.go @@ -50,9 +50,11 @@ func ClaimRewards(c *cli.Context) error { if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { totalFee := new(big.Int).Sub(sdStatus.SdUtilizerLatestBalance, sdStatus.SdUtilizedBalance) - fmt.Printf(fmt.Sprintf("You need to first pay %f and close the utilization position to get back your funds. Execute the following command to repay your utilized SD stader-cli repay-sd --amount \n", eth.WeiToEth(totalFee))) + fmt.Printf("You need to first pay %f and close the utilization position to get back your funds. Execute the following command to repay your utilized SD stader-cli repay-sd --amount \n", eth.WeiToEth(totalFee)) - fmt.Printf(fmt.Sprintf("Based on the current Health Factor, you can claim upto %.6f ETH.", eth.WeiToEth(canClaimRewardsResponse.WithdrawableInEth))) + fmt.Printf("Based on the current Health Factor, you can claim upto %.6f ETH.\n", eth.WeiToEth(canClaimRewardsResponse.WithdrawableInEth)) + + fmt.Printf("Note: Please repay your utilized SD by using the following command to claim the remaining ETH: stader-cli sd repay --amount .\n") } } @@ -80,6 +82,6 @@ func ClaimRewards(c *cli.Context) error { } // Log & return - fmt.Printf("Withdrawn %.6f ETH Rewards to Operator Reward Address: %s\n\n", math.RoundDown(eth.WeiToEth(res.OperatorRewardsBalance), 6), res.OperatorRewardAddress) + fmt.Printf("Successful withdrawal of %.6f ETH to Operator Reward Address: %s\n\n", math.RoundDown(eth.WeiToEth(res.OperatorRewardsBalance), 6), res.OperatorRewardAddress) return nil } diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index dca338094..162957f7b 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -10,6 +10,7 @@ import ( "github.com/stader-labs/stader-node/shared/services/gas" "github.com/stader-labs/stader-node/shared/services/stader" cliutils "github.com/stader-labs/stader-node/shared/utils/cli" + "github.com/stader-labs/stader-node/shared/utils/math" "github.com/stader-labs/stader-node/stader-lib/utils/eth" ) @@ -111,5 +112,8 @@ func repaySD(c *cli.Context) error { return err } + remainUtilize := new(big.Int).Sub(sdStatus.SdUtilizerLatestBalance, amountWei) + fmt.Printf("Repayment of %.6f SD successful. Current Utilization Position: %.6f SD.\n", math.RoundDown(eth.WeiToEth(amountWei), 6), math.RoundDown(eth.WeiToEth(remainUtilize), 6)) + return nil } diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index ad03a6edd..74b89edb4 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -12,6 +12,7 @@ import ( "github.com/stader-labs/stader-node/shared/services/stader" "github.com/stader-labs/stader-node/shared/types/api" cliutils "github.com/stader-labs/stader-node/shared/utils/cli" + "github.com/stader-labs/stader-node/shared/utils/math" "github.com/stader-labs/stader-node/stader-lib/utils/eth" ) @@ -77,6 +78,9 @@ func utilizeSD(c *cli.Context) error { return err } + // Log & return + fmt.Printf("Successfully deposited %.6f SD by utilizing SD from the Utility Pool.\n", math.RoundDown(eth.WeiToEth(amountWei), 6)) + return nil } diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index 18bf8a492..fa4fe6bca 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -50,6 +50,7 @@ func WithdrawSd(c *cli.Context) error { if err != nil { return err } + if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(amountWei) > 0 { confirm := cliutils.Confirm(fmt.Sprintf("You have an existing Utilization Position of %.6f SD. The excess SD collateral you are trying to withdraw will be used to repay the utilized SD.\n Do you wish to proceed?", math.RoundDown(eth.WeiToEth(sdStatusResponse.SDStatus.SdUtilizerLatestBalance), 6))) if !confirm { @@ -88,8 +89,24 @@ func WithdrawSd(c *cli.Context) error { return err } + remainUtilize := new(big.Int).Sub(sdStatusResponse.SDStatus.SdUtilizerLatestBalance, amountWei) + + // remain collateral is (SdUtilizerLatestBalance + SdCollateralCurrentAmount) - amountWei + remainCollateral := new(big.Int).Add(sdStatusResponse.SDStatus.SdCollateralCurrentAmount, remainUtilize) + // Log & return - fmt.Printf("Successfully withdrawn %.6f SD Collateral. \n", math.RoundDown(eth.WeiToEth(amountWei), 6)) + + // withdraw request amount lesser than the Utilization Position + if remainUtilize.Cmp(big.NewInt(0)) > 0 { + fmt.Printf("Successfully withdrawn %.6f SD Collateral. \n", math.RoundDown(eth.WeiToEth(amountWei), 6)) + fmt.Printf("Current Utilization Position: %.6f SD \nCurrent SD collateral: %.6f SD\n", math.RoundDown(eth.WeiToEth(remainUtilize), 6), math.RoundDown(eth.WeiToEth(remainCollateral), 6)) + + return nil + } + + // withdraw request amount greater than the Utilization Position + fmt.Printf("Repayment of %.6f SD successful using the excess SD Collateral.\n", math.RoundDown(eth.WeiToEth(amountWei), 6)) + fmt.Printf("The remaining %.6f SD has been sent to your Operator Reward Address\n", math.RoundDown(eth.WeiToEth(new(big.Int).Abs(remainUtilize)), 6)) return nil } diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 410c5bbb9..61ce9a132 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -171,11 +171,13 @@ func nodeDeposit(c *cli.Context) error { } // Log & return - fmt.Printf("The node deposit of %d ETH was made successfully!\n", uint64(eth.BaseAmountInEth)*numValidators) - fmt.Printf("Total %d validators were created\n", numValidators) + if utilityAmount.Cmp(big.NewInt(0)) == 0 { + fmt.Printf("The node deposit of %d ETH was made successfully and total %d validators were created.\n", uint64(eth.BaseAmountInEth)*numValidators, numValidators) + } else { + fmt.Printf("The node deposit of %d ETH was made successfully and total %d validators were created by utilizing %.6f from the SD Utility Pool.\n", uint64(eth.BaseAmountInEth)*numValidators, numValidators, eth.WeiToEth(utilityAmount)) + } - fmt.Println("Your validators are now in Initialized status.") - fmt.Println("Once the ETH deposits have been matched by the remaining 28ETH, it will move to Deposited status.") + fmt.Println("Your validators are now in Initialized status. Once the ETH deposits have been matched by the remaining 28ETH, it will move to Deposited status.") fmt.Println("You can check the status of your validator with `stader-cli validator status`.") return nil From 2cde7a75c6afe3a6284ec17e9206d45971cd8b9a Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 12 Dec 2023 17:39:41 +0700 Subject: [PATCH 069/159] Rename alias --- stader-cli/node/commands.go | 66 ++++++++++++++++---------------- stader-cli/validator/commands.go | 2 +- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/stader-cli/node/commands.go b/stader-cli/node/commands.go index d7b5ae3c2..410063741 100644 --- a/stader-cli/node/commands.go +++ b/stader-cli/node/commands.go @@ -70,7 +70,7 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { }, { Name: "update-socialize-el", - Aliases: []string{"y"}, + Aliases: []string{"use"}, Usage: "Opt in or Opt out of socializing pool", UsageText: "stader-cli node update-socialize-el [options]", Flags: []cli.Flag{ @@ -125,7 +125,7 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { }, { Name: "deposit-sd", - Aliases: []string{"k"}, + Aliases: []string{"ds"}, Usage: "Deposit SD against the node", UsageText: "stader-cli node deposit-sd [options]", Flags: []cli.Flag{ @@ -198,7 +198,7 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { }, { Name: "send-el-rewards", - Aliases: []string{"wer"}, + Aliases: []string{"ser"}, Usage: "Send all Execution Layer rewards to the operator claim vault. This only includes non-socializing pool rewards", UsageText: "stader-cli node send-el-rewards", Flags: []cli.Flag{cli.BoolFlag{ @@ -212,7 +212,7 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { }, { Name: "claim-rewards", - Aliases: []string{"wer"}, + Aliases: []string{"cr"}, Usage: "Claim rewards from claim vault to the operator reward address", UsageText: "stader-cli node claim-rewards", Flags: []cli.Flag{cli.BoolFlag{ @@ -226,7 +226,7 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { }, { Name: "withdraw-sd-collateral", - Aliases: []string{"sef"}, + Aliases: []string{"wsc"}, Usage: "Withdraw Sd collateral", UsageText: "stader-cli node withdraw-sd-collateral --amount", Flags: []cli.Flag{ @@ -343,32 +343,6 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { return SetRewardAddress(c, operatorRewardAddress) }, }, - { - Name: "deposit-approve-sd", - Aliases: []string{"k"}, - Usage: "Approve SD against the node", - UsageText: "stader-cli node approve-sd [options]", - Flags: []cli.Flag{ - cli.StringFlag{ - Name: "amount, a", - Usage: "The amount of SD to approve", - }, - cli.BoolFlag{ - Name: "yes, y", - Usage: "Automatically confirm SD approve", - }, - }, - Action: func(c *cli.Context) error { - if _, err := cliutils.ValidatePositiveEthAmount("sd deposit amount", c.String("amount")); err != nil { - return err - } - - amount := c.String("amount") - - // Run - return nodeApproveDepositSd(c, amount) - }, - }, { Name: "utilize-sd", Aliases: []string{"us"}, @@ -406,10 +380,36 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { return repaySD(c) }, }, + { + Name: "approve-deposit-sd", + Aliases: []string{"ad"}, + Usage: "Approve SD for SD collateral contract", + UsageText: "stader-cli node approve-sd [options]", + Flags: []cli.Flag{ + cli.StringFlag{ + Name: "amount, a", + Usage: "The amount of SD to approve", + }, + cli.BoolFlag{ + Name: "yes, y", + Usage: "Automatically confirm SD approve", + }, + }, + Action: func(c *cli.Context) error { + if _, err := cliutils.ValidatePositiveEthAmount("sd deposit amount", c.String("amount")); err != nil { + return err + } + + amount := c.String("amount") + + // Run + return nodeApproveDepositSd(c, amount) + }, + }, { Name: "approve-utility-sd", - Aliases: []string{"aus"}, - Usage: "Approve SD for utility pool", + Aliases: []string{"au"}, + Usage: "Approve SD for SD utility pool contract", UsageText: "stader-cli node approve-utility-sd [options]", Flags: []cli.Flag{ cli.StringFlag{ diff --git a/stader-cli/validator/commands.go b/stader-cli/validator/commands.go index b2f5a336b..ce01224d8 100644 --- a/stader-cli/validator/commands.go +++ b/stader-cli/validator/commands.go @@ -95,7 +95,7 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { }, { Name: "send-cl-rewards", - Aliases: []string{"wcr"}, + Aliases: []string{"scr"}, Usage: "Send all Consensus Layer rewards to the operator claim vault", UsageText: "stader-cli validator send-cl-rewards --validator-pub-key", Flags: []cli.Flag{ From 3f1952f4565e720557c116226a71bd72c1fc66bc Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 12 Dec 2023 19:06:40 +0700 Subject: [PATCH 070/159] Refactor --- stader-cli/node/withdraw-sd.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index fa4fe6bca..b7ed7574c 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -100,13 +100,10 @@ func WithdrawSd(c *cli.Context) error { if remainUtilize.Cmp(big.NewInt(0)) > 0 { fmt.Printf("Successfully withdrawn %.6f SD Collateral. \n", math.RoundDown(eth.WeiToEth(amountWei), 6)) fmt.Printf("Current Utilization Position: %.6f SD \nCurrent SD collateral: %.6f SD\n", math.RoundDown(eth.WeiToEth(remainUtilize), 6), math.RoundDown(eth.WeiToEth(remainCollateral), 6)) - - return nil + } else { + // withdraw request amount greater than the Utilization Position + fmt.Printf("Repayment of %.6f SD successful using the excess SD Collateral.\n", math.RoundDown(eth.WeiToEth(amountWei), 6)) + fmt.Printf("The remaining %.6f SD has been sent to your Operator Reward Address\n", math.RoundDown(eth.WeiToEth(new(big.Int).Abs(remainUtilize)), 6)) } - - // withdraw request amount greater than the Utilization Position - fmt.Printf("Repayment of %.6f SD successful using the excess SD Collateral.\n", math.RoundDown(eth.WeiToEth(amountWei), 6)) - fmt.Printf("The remaining %.6f SD has been sent to your Operator Reward Address\n", math.RoundDown(eth.WeiToEth(new(big.Int).Abs(remainUtilize)), 6)) - return nil } From e3ebeb8e8e3b0ee0c8325cfeb1ddeffb2c230d81 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Wed, 13 Dec 2023 11:07:00 +0530 Subject: [PATCH 071/159] check if sd collateral require amount is 0 when there are no validators --- stader-cli/node/status.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index d92774971..c9eae4b93 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -221,15 +221,20 @@ func getNodeStatus(c *cli.Context) error { "The SD utility can provide max of %.6f SD.\n\n", math.RoundDown(eth.WeiToEth(sdStatus.PoolAvailableSDBalance), eth.Decimal)) + collateralPct := 0.0 + current := eth.WeiToEth(totalCollateral) require := eth.WeiToEth(sdStatus.SdCollateralRequireAmount) + if require > 0 { + collateralPct = current / require * 100 + } fmt.Printf( "The node %s%s%s current had %.6f%s Collateral.\n\n", log.ColorBlue, status.AccountAddress, log.ColorReset, - current/require*100, "%") + collateralPct, "%") fmt.Printf( "The node %s%s%s reward Eligible SD is %.6f.\n\n", From 0f0c00b25aefd0bc9552c307e8ccc6b643aa0e66 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Wed, 13 Dec 2023 15:02:47 +0700 Subject: [PATCH 072/159] Handle almost equal --- stader-cli/node/repay-sd.go | 6 ++++ stader-cli/node/status.go | 39 +++++++++++++--------- stader-cli/node/utilize-sd.go | 62 +++++++--------------------------- stader-lib/utils/sd/sd.go | 63 +++++++++++++++++++++++++++++++++++ 4 files changed, 104 insertions(+), 66 deletions(-) create mode 100644 stader-lib/utils/sd/sd.go diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index 162957f7b..500c42133 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -12,6 +12,7 @@ import ( cliutils "github.com/stader-labs/stader-node/shared/utils/cli" "github.com/stader-labs/stader-node/shared/utils/math" "github.com/stader-labs/stader-node/stader-lib/utils/eth" + "github.com/stader-labs/stader-node/stader-lib/utils/sd" ) func repaySD(c *cli.Context) error { @@ -58,6 +59,11 @@ func repaySD(c *cli.Context) error { return nil } + // If almost equal repay with all Utilize position to make sure the position is cleared + if sd.WeiAlmostEqual(amountWei, sdStatus.SdUtilizerLatestBalance) { + amountWei = sdStatus.SdUtilizerLatestBalance + } + // 1. Check if repay more than need if amountWei.Cmp(sdStatus.SdUtilizerLatestBalance) > 0 { fmt.Printf("Repayment amount greater than the Utilization position. Your current Utilization Position is %0.6f \n", eth.WeiToEth(sdStatus.SdUtilizerLatestBalance)) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index d92774971..daaa54efe 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -176,15 +176,14 @@ func getNodeStatus(c *cli.Context) error { log.ColorBlue, status.AccountAddress, log.ColorReset, - math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizerLatestBalance), eth.Decimal)) + math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizedBalance), eth.Decimal)) - totalFee := new(big.Int).Sub(sdStatus.SdUtilizerLatestBalance, sdStatus.SdUtilizedBalance) fmt.Printf( - "The node %s%s%s total fee %.6f SD.\n\n", + "The node %s%s%s had SD Utilization Position (including the fee) %.6f SD.\n\n", log.ColorBlue, status.AccountAddress, log.ColorReset, - math.RoundDown(eth.WeiToEth(totalFee), eth.Decimal)) + math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizerLatestBalance), eth.Decimal)) fmt.Printf( "The node %s%s%s require to had %.6f SD in collateral.\n\n", @@ -217,26 +216,34 @@ func getNodeStatus(c *cli.Context) error { log.ColorReset, (eth.WeiToEth(maxUtilizable))) - fmt.Printf( - "The SD utility can provide max of %.6f SD.\n\n", - math.RoundDown(eth.WeiToEth(sdStatus.PoolAvailableSDBalance), eth.Decimal)) - current := eth.WeiToEth(totalCollateral) require := eth.WeiToEth(sdStatus.SdCollateralRequireAmount) fmt.Printf( - "The node %s%s%s current had %.6f%s Collateral.\n\n", + "The node %s%s%s current had %.6f%s Collateral.\nPlease ensure that the SD collateral percentage is greater than %s. The SD collateral snapshots are taken daily at a random block, and if the SD collateral value falls below the %s limit, the node operator will not earn SD rewards for that day\n\n", log.ColorBlue, status.AccountAddress, log.ColorReset, - current/require*100, "%") + current/require*10, "%", "10%", "10%") fmt.Printf( - "The node %s%s%s reward Eligible SD is %.6f.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - eth.WeiToEth(sdStatus.SdRewardEligible)) - + "The SD utility require %.6f SD.\n\n", + math.RoundDown(require, eth.Decimal)) + fmt.Printf( + "The SD utility can provide max of %.6f SD.\n\n", + math.RoundDown(eth.WeiToEth(sdStatus.PoolAvailableSDBalance), eth.Decimal)) return nil } + +/* + +"800000000000000" + + +call sdStatus.SdUtilizerLatestBalance.String() + + +"799619761049383" + + +*/ diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index 74b89edb4..758a5c57c 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -4,9 +4,6 @@ import ( "errors" "fmt" "math/big" - "strconv" - - "github.com/urfave/cli" "github.com/stader-labs/stader-node/shared/services/gas" "github.com/stader-labs/stader-node/shared/services/stader" @@ -14,6 +11,8 @@ import ( cliutils "github.com/stader-labs/stader-node/shared/utils/cli" "github.com/stader-labs/stader-node/shared/utils/math" "github.com/stader-labs/stader-node/stader-lib/utils/eth" + "github.com/stader-labs/stader-node/stader-lib/utils/sd" + "github.com/urfave/cli" ) func utilizeSD(c *cli.Context) error { @@ -85,7 +84,8 @@ func utilizeSD(c *cli.Context) error { } func GetMinUtility(sdStatus *api.SdStatusResponse) *big.Int { - minUtility := new(big.Int).Sub(sdStatus.SdCollateralRequireAmount, sdStatus.SdCollateralCurrentAmount) + totalCollateral := new(big.Int).Sub(sdStatus.SdUtilizerLatestBalance, sdStatus.SdCollateralCurrentAmount) + minUtility := new(big.Int).Sub(sdStatus.SdCollateralRequireAmount, totalCollateral) if minUtility.Cmp(big.NewInt(0)) < 0 { minUtility = big.NewInt(0) @@ -128,10 +128,6 @@ func PromptChooseUtilityAmount(sdStatus *api.SdStatusResponse) (*big.Int, error) min := eth.WeiToEth(minUtility) max := eth.WeiToEth(maxUtility) - var _utilityAmount int - - var err error - msg := fmt.Sprintf(`Please enter the amount of SD you wish to utilize from the SD Utility Pool: SD Utility Pool balance: %f SD Minimum utilization amount: %f SD @@ -139,27 +135,12 @@ Maximum utilization amount: %f SD`, eth.WeiToEth(sdStatus.PoolAvailableSDBalance errMsg := fmt.Sprintf("Invalid input, please specify an amount within %f and %f SD range\n", min, max) - for { - s := cliutils.Prompt( - msg, - "^[1-9][0-9]*$", - errMsg) - - _utilityAmount, err = strconv.Atoi(s) - if err != nil { - fmt.Println(errMsg) - continue - } - - if _utilityAmount < int(min) || _utilityAmount > int(max) { - fmt.Println(errMsg) - continue - } - - break + utilityAmountFloat, err := sd.PromptChooseSDWithMaxMin(msg, errMsg, min, max) + if err != nil { + return nil, err } - utilityAmount := eth.EthToWei(float64(_utilityAmount)) + utilityAmount := eth.EthToWei(utilityAmountFloat) return utilityAmount, nil } @@ -173,37 +154,18 @@ func PromptChooseSelfBondAmount(sdStatus *api.SdStatusResponse) (*big.Int, error min := eth.WeiToEth(amountToCollateralRemain) max := eth.WeiToEth(sdRewardEligibleRemain) - var _utilityAmount int - - var err error - msg := fmt.Sprintf(`Please enter the amount of SD you wish to deposit as collateral. Minimum bond: %f SD Maximum bond: %f SD`, min, max) errMsg := fmt.Sprintf("Invalid input, please specify an amount within %f and %f SD range\n", min, max) - for { - s := cliutils.Prompt( - msg, - "^[1-9][0-9]*$", - errMsg) - - _utilityAmount, err = strconv.Atoi(s) - if err != nil { - fmt.Println(errMsg) - continue - } - - if _utilityAmount < int(min) || _utilityAmount > int(max) { - fmt.Println(errMsg) - continue - } - - break + utilityAmountFloat, err := sd.PromptChooseSDWithMaxMin(msg, errMsg, min, max) + if err != nil { + return nil, err } - utilityAmount := eth.EthToWei(float64(_utilityAmount)) + utilityAmount := eth.EthToWei(utilityAmountFloat) return utilityAmount, nil } diff --git a/stader-lib/utils/sd/sd.go b/stader-lib/utils/sd/sd.go new file mode 100644 index 000000000..6bfa49816 --- /dev/null +++ b/stader-lib/utils/sd/sd.go @@ -0,0 +1,63 @@ +package sd + +import ( + "fmt" + "math" + "math/big" + "strconv" + + cliutils "github.com/stader-labs/stader-node/shared/utils/cli" + "github.com/stader-labs/stader-node/stader-lib/utils/eth" +) + +const ( + SDFloatStringEqualityThreshold = 1e-5 // 0.00001 +) + +var SDWeiEqualityThreshold = eth.EthToWei(SDFloatStringEqualityThreshold) + +func AlmostEqual(lhs, rhs float64) bool { + return math.Abs(lhs-rhs) <= SDFloatStringEqualityThreshold +} + +func WeiAlmostEqual(lhs, rhs *big.Int) bool { + diversity := new(big.Int).Sub(lhs, rhs) + + return diversity.CmpAbs(SDWeiEqualityThreshold) <= 0 +} + +func PromptChooseSDWithMaxMin(msg, errMsg string, min, max float64) (float64, error) { + var utilityAmountFloat float64 + + var errParse error + + for { + s := cliutils.Prompt( + msg, + `^[0-9]\d*(\.\d+)?$`, + errMsg) + + utilityAmountFloat, errParse = strconv.ParseFloat(s, 64) + if errParse != nil { + fmt.Println(errMsg) + continue + } + + if AlmostEqual(utilityAmountFloat, min) { + utilityAmountFloat = min + } + + if AlmostEqual(utilityAmountFloat, max) { + utilityAmountFloat = max + } + + if utilityAmountFloat < min || utilityAmountFloat > max { + fmt.Println(errMsg) + continue + } + + break + } + + return utilityAmountFloat, errParse +} From a8eebf2746cc8de7e2cafe8673e829e85ad44cd9 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Wed, 13 Dec 2023 15:05:38 +0700 Subject: [PATCH 073/159] Refactor --- stader-cli/node/status.go | 13 ------------- stader-lib/utils/sd/sd.go | 6 +++--- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index daaa54efe..344cdc699 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -234,16 +234,3 @@ func getNodeStatus(c *cli.Context) error { math.RoundDown(eth.WeiToEth(sdStatus.PoolAvailableSDBalance), eth.Decimal)) return nil } - -/* - -"800000000000000" - - -call sdStatus.SdUtilizerLatestBalance.String() - - -"799619761049383" - - -*/ diff --git a/stader-lib/utils/sd/sd.go b/stader-lib/utils/sd/sd.go index 6bfa49816..3c329443d 100644 --- a/stader-lib/utils/sd/sd.go +++ b/stader-lib/utils/sd/sd.go @@ -16,7 +16,7 @@ const ( var SDWeiEqualityThreshold = eth.EthToWei(SDFloatStringEqualityThreshold) -func AlmostEqual(lhs, rhs float64) bool { +func almostEqual(lhs, rhs float64) bool { return math.Abs(lhs-rhs) <= SDFloatStringEqualityThreshold } @@ -43,11 +43,11 @@ func PromptChooseSDWithMaxMin(msg, errMsg string, min, max float64) (float64, er continue } - if AlmostEqual(utilityAmountFloat, min) { + if almostEqual(utilityAmountFloat, min) { utilityAmountFloat = min } - if AlmostEqual(utilityAmountFloat, max) { + if almostEqual(utilityAmountFloat, max) { utilityAmountFloat = max } From bec65c8d32048a09b873dfb935788a088968ff82 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Wed, 13 Dec 2023 15:21:44 +0700 Subject: [PATCH 074/159] Update totalCollateral amount --- stader-cli/node/utilize-sd.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index 758a5c57c..0cd614966 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -84,7 +84,8 @@ func utilizeSD(c *cli.Context) error { } func GetMinUtility(sdStatus *api.SdStatusResponse) *big.Int { - totalCollateral := new(big.Int).Sub(sdStatus.SdUtilizerLatestBalance, sdStatus.SdCollateralCurrentAmount) + totalCollateral := new(big.Int).Add(sdStatus.SdUtilizedBalance, sdStatus.SdCollateralCurrentAmount) + minUtility := new(big.Int).Sub(sdStatus.SdCollateralRequireAmount, totalCollateral) if minUtility.Cmp(big.NewInt(0)) < 0 { From d89534a99d5ea452134f6328f21261144fd229c2 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Wed, 13 Dec 2023 15:28:50 +0700 Subject: [PATCH 075/159] Update metrics --- shared/services/state/network-state.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/shared/services/state/network-state.go b/shared/services/state/network-state.go index 105dde8b6..2e3e23273 100644 --- a/shared/services/state/network-state.go +++ b/shared/services/state/network-state.go @@ -531,9 +531,12 @@ func CreateMetricsCache( metricsDetails.UnclaimedSocializingPoolElRewards = math.RoundDown(eth.WeiToEth(rewardClaimData.unclaimedEth), SixDecimalRound) metricsDetails.UnclaimedSocializingPoolSDRewards = math.RoundDown(eth.WeiToEth(rewardClaimData.unclaimedSd), SixDecimalRound) - metricsDetails.OperatorSDUtilized = math.RoundDown(eth.WeiToEth(sdUtilizedLatest), SixDecimalRound) - interest := new(big.Int).Sub(sdUtilizedLatest, sdUtilized) - metricsDetails.OperatorSDInterest = math.RoundDown(eth.WeiToEth(interest), SixDecimalRound) + // amount NO utilized, not include fee + metricsDetails.OperatorSDUtilized = math.RoundDown(eth.WeiToEth(sdUtilized), SixDecimalRound) + + fee := new(big.Int).Sub(sdUtilizedLatest, sdUtilized) + metricsDetails.OperatorSDInterest = math.RoundDown(eth.WeiToEth(fee), SixDecimalRound) + metricsDetails.SdUtilityPoolBalance = math.RoundDown(eth.WeiToEth(utilityPoolBalance), SixDecimalRound) state.StaderNetworkDetails = metricsDetails From 8c9a1e2a5104aaf08f74d445746b841000d3e97f Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Wed, 13 Dec 2023 14:36:27 +0530 Subject: [PATCH 076/159] fix getAvailablePoolBalance --- stader-lib/contracts/sd-utility.go | 3404 +++++++++++++++++++++------- stader-lib/sdutility/sd-utility.go | 35 + update-abis.sh | 1 + 3 files changed, 2672 insertions(+), 768 deletions(-) diff --git a/stader-lib/contracts/sd-utility.go b/stader-lib/contracts/sd-utility.go index 67fb5db3d..825e21849 100644 --- a/stader-lib/contracts/sd-utility.go +++ b/stader-lib/contracts/sd-utility.go @@ -49,7 +49,7 @@ type UserData struct { // SDUtilityPoolMetaData contains all meta data concerning the SDUtilityPool contract. var SDUtilityPoolMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"AccrualBlockNumberNotLatest\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyClaimed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyLiquidated\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotAuthorizedToRedeem\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotFindRequestId\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientPoolBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAmountOfWithdraw\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInput\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidWithdrawAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxLimitOnWithdrawRequestCountReached\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotClaimable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotLiquidatable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotLiquidator\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"RequestIdNotFinalized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDUtilizeLimitReached\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAccumulated\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalProtocolFee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalUtilizedSD\",\"type\":\"uint256\"}],\"name\":\"AccruedFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"CompleteLiquidation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXToMint\",\"type\":\"uint256\"}],\"name\":\"Delegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestIdToFinalize\",\"type\":\"uint256\"}],\"name\":\"FinalizedWithdrawRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalLiquidationAmountInEth\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationBonusInEth\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationFeeInEth\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"name\":\"LiquidationCall\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"protocolFeeFactor\",\"type\":\"uint256\"}],\"name\":\"ProtocolFeeFactorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXAmount\",\"type\":\"uint256\"}],\"name\":\"Redeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"Repaid\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdToTransfer\",\"type\":\"uint256\"}],\"name\":\"RequestRedeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationThreshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationBonusPercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationFeePercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ltv\",\"type\":\"uint256\"}],\"name\":\"RiskConfigUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"SDUtilized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"conservativeEthPerKey\",\"type\":\"uint256\"}],\"name\":\"UpdatedConservativeEthPerKey\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"finalizationBatchLimit\",\"type\":\"uint256\"}],\"name\":\"UpdatedFinalizationBatchLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxETHWorthOfSDPerValidator\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxETHWorthOfSDPerValidator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxNonRedeemedDelegatorRequestCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minBlockDelayToFinalizeRequest\",\"type\":\"uint256\"}],\"name\":\"UpdatedMinBlockDelayToFinalizeRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizationRatePerBlock\",\"type\":\"uint256\"}],\"name\":\"UtilizationRatePerBlockUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmountToWithdraw\",\"type\":\"uint256\"}],\"name\":\"WithdrawRequestReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"WithdrawnProtocolFee\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"accrueFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cTokenTotalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"completeLiquidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"delegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"delegatorCTokenBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"delegatorWithdrawRequestedCTokenCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"delegatorWithdrawRequests\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountOfCToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdExpected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdFinalized\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finalizeDelegatorWithdrawalRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDelegationRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_delegator\",\"type\":\"address\"}],\"name\":\"getDelegatorLatestSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLatestExchangeRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLiquidationThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"getOperatorLiquidation\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"totalAmountInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalBonusInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalFeeInEth\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isRepaid\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"isClaimed\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"internalType\":\"structOperatorLiquidation\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPoolAvailableSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"getRequestIdsByDelegator\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getUserData\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"totalInterestSD\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalCollateralInSD\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"healthFactor\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lockedEth\",\"type\":\"uint256\"}],\"internalType\":\"structUserData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_utilizer\",\"type\":\"address\"}],\"name\":\"getUtilizerLatestBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"liquidationCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxApproveSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxETHWorthOfSDPerValidator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"poolUtilization\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repay\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repayOnBehalf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"requestIdsByDelegatorAddress\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"cTokenAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdrawWithSDAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newEthPerKey\",\"type\":\"uint256\"}],\"name\":\"updateConservativeEthPerKey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_finalizationBatchLimit\",\"type\":\"uint256\"}],\"name\":\"updateFinalizationBatchLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxETHWorthOfSDPerValidator\",\"type\":\"uint256\"}],\"name\":\"updateMaxETHWorthOfSDPerValidator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"name\":\"updateMaxNonRedeemedDelegatorRequestCount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minBlockDelayToFinalizeRequest\",\"type\":\"uint256\"}],\"name\":\"updateMinBlockDelayToFinalizeRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_protocolFee\",\"type\":\"uint256\"}],\"name\":\"updateProtocolFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_utilizationRatePerBlock\",\"type\":\"uint256\"}],\"name\":\"updateUtilizationRatePerBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"utilizationRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"utilize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonTerminalKeyCount\",\"type\":\"uint256\"}],\"name\":\"utilizeWhileAddingKeys\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"utilizerData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"principal\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"utilizeIndex\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdrawProtocolFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AccrualBlockNumberNotLatest\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyClaimed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyLiquidated\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotAuthorizedToRedeem\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotManager\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotStaderContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotFindRequestId\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientPoolBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAmountOfWithdraw\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInput\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidWithdrawAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxLimitOnWithdrawRequestCountReached\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotClaimable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotLiquidatable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotLiquidator\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"RequestIdNotFinalized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDUtilizeLimitReached\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAccumulated\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalProtocolFee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalUtilizedSD\",\"type\":\"uint256\"}],\"name\":\"AccruedFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"CompleteLiquidation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXToMint\",\"type\":\"uint256\"}],\"name\":\"Delegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestIdToFinalize\",\"type\":\"uint256\"}],\"name\":\"FinalizedWithdrawRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalLiquidationAmountInEth\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationBonusInEth\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationFeeInEth\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"name\":\"LiquidationCall\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"protocolFeeFactor\",\"type\":\"uint256\"}],\"name\":\"ProtocolFeeFactorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXAmount\",\"type\":\"uint256\"}],\"name\":\"Redeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"Repaid\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdToTransfer\",\"type\":\"uint256\"}],\"name\":\"RequestRedeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationThreshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationBonusPercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationFeePercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ltv\",\"type\":\"uint256\"}],\"name\":\"RiskConfigUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"SDUtilized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"conservativeEthPerKey\",\"type\":\"uint256\"}],\"name\":\"UpdatedConservativeEthPerKey\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"finalizationBatchLimit\",\"type\":\"uint256\"}],\"name\":\"UpdatedFinalizationBatchLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxETHWorthOfSDPerValidator\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxETHWorthOfSDPerValidator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxNonRedeemedDelegatorRequestCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minBlockDelayToFinalizeRequest\",\"type\":\"uint256\"}],\"name\":\"UpdatedMinBlockDelayToFinalizeRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizationRatePerBlock\",\"type\":\"uint256\"}],\"name\":\"UtilizationRatePerBlockUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmountToWithdraw\",\"type\":\"uint256\"}],\"name\":\"WithdrawRequestReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"WithdrawnProtocolFee\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DECIMAL\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_PROTOCOL_FEE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_UTILIZATION_RATE_PER_BLOCK\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accrualBlockNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accrueFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accumulatedProtocolFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cTokenTotalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_requestId\",\"type\":\"uint256\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"completeLiquidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"conservativeEthPerKey\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"delegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"delegatorCTokenBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"delegatorWithdrawRequestedCTokenCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"delegatorWithdrawRequests\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountOfCToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdExpected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdFinalized\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finalizationBatchLimit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finalizeDelegatorWithdrawalRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDelegationRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_delegator\",\"type\":\"address\"}],\"name\":\"getDelegatorLatestSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLatestExchangeRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLiquidationThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getOperatorLiquidation\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"totalAmountInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalBonusInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalFeeInEth\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isRepaid\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"isClaimed\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"internalType\":\"structOperatorLiquidation\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"getOperatorTotalEth\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPoolAvailableSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_delegator\",\"type\":\"address\"}],\"name\":\"getRequestIdsByDelegator\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getUserData\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"totalInterestSD\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalCollateralInSD\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"healthFactor\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lockedEth\",\"type\":\"uint256\"}],\"internalType\":\"structUserData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_utilizer\",\"type\":\"address\"}],\"name\":\"getUtilizerLatestBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"liquidationCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"liquidations\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"totalAmountInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalBonusInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalFeeInEth\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isRepaid\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"isClaimed\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxApproveSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxETHWorthOfSDPerValidator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxNonRedeemedDelegatorRequestCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minBlockDelayToFinalizeRequest\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextRequestId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextRequestIdToFinalize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"poolUtilization\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"protocolFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repay\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"repaidAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feePaid\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repayOnBehalf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"repaidAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feePaid\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"requestIdsByDelegatorAddress\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_cTokenAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_requestId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_sdAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdrawWithSDAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_requestId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"riskConfig\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"liquidationThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"liquidationBonusPercent\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"liquidationFeePercent\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"ltv\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sdRequestedForWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sdReservedForClaim\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"staderConfig\",\"outputs\":[{\"internalType\":\"contractIStaderConfig\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalUtilizedSD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newEthPerKey\",\"type\":\"uint256\"}],\"name\":\"updateConservativeEthPerKey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_finalizationBatchLimit\",\"type\":\"uint256\"}],\"name\":\"updateFinalizationBatchLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxETHWorthOfSDPerValidator\",\"type\":\"uint256\"}],\"name\":\"updateMaxETHWorthOfSDPerValidator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"name\":\"updateMaxNonRedeemedDelegatorRequestCount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minBlockDelayToFinalizeRequest\",\"type\":\"uint256\"}],\"name\":\"updateMinBlockDelayToFinalizeRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_protocolFee\",\"type\":\"uint256\"}],\"name\":\"updateProtocolFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"liquidationThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"liquidationBonusPercent\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"liquidationFeePercent\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"ltv\",\"type\":\"uint256\"}],\"name\":\"updateRiskConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_utilizationRatePerBlock\",\"type\":\"uint256\"}],\"name\":\"updateUtilizationRatePerBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"utilizationRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"utilize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"utilizeIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonTerminalKeyCount\",\"type\":\"uint256\"}],\"name\":\"utilizeWhileAddingKeys\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"utilizerData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"principal\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"utilizeIndex\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdrawProtocolFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // SDUtilityPoolABI is the input ABI used to generate the binding from. @@ -198,6 +198,192 @@ func (_SDUtilityPool *SDUtilityPoolTransactorRaw) Transact(opts *bind.TransactOp return _SDUtilityPool.Contract.contract.Transact(opts, method, params...) } +// DECIMAL is a free data retrieval call binding the contract method 0x6ab55fd9. +// +// Solidity: function DECIMAL() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) DECIMAL(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "DECIMAL") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// DECIMAL is a free data retrieval call binding the contract method 0x6ab55fd9. +// +// Solidity: function DECIMAL() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) DECIMAL() (*big.Int, error) { + return _SDUtilityPool.Contract.DECIMAL(&_SDUtilityPool.CallOpts) +} + +// DECIMAL is a free data retrieval call binding the contract method 0x6ab55fd9. +// +// Solidity: function DECIMAL() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) DECIMAL() (*big.Int, error) { + return _SDUtilityPool.Contract.DECIMAL(&_SDUtilityPool.CallOpts) +} + +// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. +// +// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) +func (_SDUtilityPool *SDUtilityPoolCaller) DEFAULTADMINROLE(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "DEFAULT_ADMIN_ROLE") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. +// +// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) +func (_SDUtilityPool *SDUtilityPoolSession) DEFAULTADMINROLE() ([32]byte, error) { + return _SDUtilityPool.Contract.DEFAULTADMINROLE(&_SDUtilityPool.CallOpts) +} + +// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. +// +// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) +func (_SDUtilityPool *SDUtilityPoolCallerSession) DEFAULTADMINROLE() ([32]byte, error) { + return _SDUtilityPool.Contract.DEFAULTADMINROLE(&_SDUtilityPool.CallOpts) +} + +// MAXPROTOCOLFEE is a free data retrieval call binding the contract method 0xb8ca3b83. +// +// Solidity: function MAX_PROTOCOL_FEE() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) MAXPROTOCOLFEE(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "MAX_PROTOCOL_FEE") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MAXPROTOCOLFEE is a free data retrieval call binding the contract method 0xb8ca3b83. +// +// Solidity: function MAX_PROTOCOL_FEE() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) MAXPROTOCOLFEE() (*big.Int, error) { + return _SDUtilityPool.Contract.MAXPROTOCOLFEE(&_SDUtilityPool.CallOpts) +} + +// MAXPROTOCOLFEE is a free data retrieval call binding the contract method 0xb8ca3b83. +// +// Solidity: function MAX_PROTOCOL_FEE() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) MAXPROTOCOLFEE() (*big.Int, error) { + return _SDUtilityPool.Contract.MAXPROTOCOLFEE(&_SDUtilityPool.CallOpts) +} + +// MAXUTILIZATIONRATEPERBLOCK is a free data retrieval call binding the contract method 0x4e7878ee. +// +// Solidity: function MAX_UTILIZATION_RATE_PER_BLOCK() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) MAXUTILIZATIONRATEPERBLOCK(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "MAX_UTILIZATION_RATE_PER_BLOCK") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MAXUTILIZATIONRATEPERBLOCK is a free data retrieval call binding the contract method 0x4e7878ee. +// +// Solidity: function MAX_UTILIZATION_RATE_PER_BLOCK() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) MAXUTILIZATIONRATEPERBLOCK() (*big.Int, error) { + return _SDUtilityPool.Contract.MAXUTILIZATIONRATEPERBLOCK(&_SDUtilityPool.CallOpts) +} + +// MAXUTILIZATIONRATEPERBLOCK is a free data retrieval call binding the contract method 0x4e7878ee. +// +// Solidity: function MAX_UTILIZATION_RATE_PER_BLOCK() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) MAXUTILIZATIONRATEPERBLOCK() (*big.Int, error) { + return _SDUtilityPool.Contract.MAXUTILIZATIONRATEPERBLOCK(&_SDUtilityPool.CallOpts) +} + +// AccrualBlockNumber is a free data retrieval call binding the contract method 0x6c540baf. +// +// Solidity: function accrualBlockNumber() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) AccrualBlockNumber(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "accrualBlockNumber") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// AccrualBlockNumber is a free data retrieval call binding the contract method 0x6c540baf. +// +// Solidity: function accrualBlockNumber() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) AccrualBlockNumber() (*big.Int, error) { + return _SDUtilityPool.Contract.AccrualBlockNumber(&_SDUtilityPool.CallOpts) +} + +// AccrualBlockNumber is a free data retrieval call binding the contract method 0x6c540baf. +// +// Solidity: function accrualBlockNumber() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) AccrualBlockNumber() (*big.Int, error) { + return _SDUtilityPool.Contract.AccrualBlockNumber(&_SDUtilityPool.CallOpts) +} + +// AccumulatedProtocolFee is a free data retrieval call binding the contract method 0xa544a62c. +// +// Solidity: function accumulatedProtocolFee() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) AccumulatedProtocolFee(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "accumulatedProtocolFee") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// AccumulatedProtocolFee is a free data retrieval call binding the contract method 0xa544a62c. +// +// Solidity: function accumulatedProtocolFee() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) AccumulatedProtocolFee() (*big.Int, error) { + return _SDUtilityPool.Contract.AccumulatedProtocolFee(&_SDUtilityPool.CallOpts) +} + +// AccumulatedProtocolFee is a free data retrieval call binding the contract method 0xa544a62c. +// +// Solidity: function accumulatedProtocolFee() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) AccumulatedProtocolFee() (*big.Int, error) { + return _SDUtilityPool.Contract.AccumulatedProtocolFee(&_SDUtilityPool.CallOpts) +} + // CTokenTotalSupply is a free data retrieval call binding the contract method 0x37a4adf7. // // Solidity: function cTokenTotalSupply() view returns(uint256) @@ -229,6 +415,37 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) CTokenTotalSupply() (*big.Int, return _SDUtilityPool.Contract.CTokenTotalSupply(&_SDUtilityPool.CallOpts) } +// ConservativeEthPerKey is a free data retrieval call binding the contract method 0x232d70c3. +// +// Solidity: function conservativeEthPerKey() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) ConservativeEthPerKey(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "conservativeEthPerKey") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// ConservativeEthPerKey is a free data retrieval call binding the contract method 0x232d70c3. +// +// Solidity: function conservativeEthPerKey() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) ConservativeEthPerKey() (*big.Int, error) { + return _SDUtilityPool.Contract.ConservativeEthPerKey(&_SDUtilityPool.CallOpts) +} + +// ConservativeEthPerKey is a free data retrieval call binding the contract method 0x232d70c3. +// +// Solidity: function conservativeEthPerKey() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) ConservativeEthPerKey() (*big.Int, error) { + return _SDUtilityPool.Contract.ConservativeEthPerKey(&_SDUtilityPool.CallOpts) +} + // DelegatorCTokenBalance is a free data retrieval call binding the contract method 0xabf9db02. // // Solidity: function delegatorCTokenBalance(address ) view returns(uint256) @@ -382,6 +599,37 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) ExchangeRateStored() (*big.Int return _SDUtilityPool.Contract.ExchangeRateStored(&_SDUtilityPool.CallOpts) } +// FinalizationBatchLimit is a free data retrieval call binding the contract method 0x6f2bd0b2. +// +// Solidity: function finalizationBatchLimit() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) FinalizationBatchLimit(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "finalizationBatchLimit") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// FinalizationBatchLimit is a free data retrieval call binding the contract method 0x6f2bd0b2. +// +// Solidity: function finalizationBatchLimit() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) FinalizationBatchLimit() (*big.Int, error) { + return _SDUtilityPool.Contract.FinalizationBatchLimit(&_SDUtilityPool.CallOpts) +} + +// FinalizationBatchLimit is a free data retrieval call binding the contract method 0x6f2bd0b2. +// +// Solidity: function finalizationBatchLimit() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) FinalizationBatchLimit() (*big.Int, error) { + return _SDUtilityPool.Contract.FinalizationBatchLimit(&_SDUtilityPool.CallOpts) +} + // GetDelegationRatePerBlock is a free data retrieval call binding the contract method 0x6d00679c. // // Solidity: function getDelegationRatePerBlock() view returns(uint256) @@ -508,10 +756,10 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) GetLiquidationThreshold() (*bi // GetOperatorLiquidation is a free data retrieval call binding the contract method 0x12372ffe. // -// Solidity: function getOperatorLiquidation(address ) view returns((uint256,uint256,uint256,bool,bool,address)) -func (_SDUtilityPool *SDUtilityPoolCaller) GetOperatorLiquidation(opts *bind.CallOpts, arg0 common.Address) (OperatorLiquidation, error) { +// Solidity: function getOperatorLiquidation(address account) view returns((uint256,uint256,uint256,bool,bool,address)) +func (_SDUtilityPool *SDUtilityPoolCaller) GetOperatorLiquidation(opts *bind.CallOpts, account common.Address) (OperatorLiquidation, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "getOperatorLiquidation", arg0) + err := _SDUtilityPool.contract.Call(opts, &out, "getOperatorLiquidation", account) if err != nil { return *new(OperatorLiquidation), err @@ -525,16 +773,47 @@ func (_SDUtilityPool *SDUtilityPoolCaller) GetOperatorLiquidation(opts *bind.Cal // GetOperatorLiquidation is a free data retrieval call binding the contract method 0x12372ffe. // -// Solidity: function getOperatorLiquidation(address ) view returns((uint256,uint256,uint256,bool,bool,address)) -func (_SDUtilityPool *SDUtilityPoolSession) GetOperatorLiquidation(arg0 common.Address) (OperatorLiquidation, error) { - return _SDUtilityPool.Contract.GetOperatorLiquidation(&_SDUtilityPool.CallOpts, arg0) +// Solidity: function getOperatorLiquidation(address account) view returns((uint256,uint256,uint256,bool,bool,address)) +func (_SDUtilityPool *SDUtilityPoolSession) GetOperatorLiquidation(account common.Address) (OperatorLiquidation, error) { + return _SDUtilityPool.Contract.GetOperatorLiquidation(&_SDUtilityPool.CallOpts, account) } // GetOperatorLiquidation is a free data retrieval call binding the contract method 0x12372ffe. // -// Solidity: function getOperatorLiquidation(address ) view returns((uint256,uint256,uint256,bool,bool,address)) -func (_SDUtilityPool *SDUtilityPoolCallerSession) GetOperatorLiquidation(arg0 common.Address) (OperatorLiquidation, error) { - return _SDUtilityPool.Contract.GetOperatorLiquidation(&_SDUtilityPool.CallOpts, arg0) +// Solidity: function getOperatorLiquidation(address account) view returns((uint256,uint256,uint256,bool,bool,address)) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetOperatorLiquidation(account common.Address) (OperatorLiquidation, error) { + return _SDUtilityPool.Contract.GetOperatorLiquidation(&_SDUtilityPool.CallOpts, account) +} + +// GetOperatorTotalEth is a free data retrieval call binding the contract method 0x2170c14c. +// +// Solidity: function getOperatorTotalEth(address operator) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) GetOperatorTotalEth(opts *bind.CallOpts, operator common.Address) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "getOperatorTotalEth", operator) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetOperatorTotalEth is a free data retrieval call binding the contract method 0x2170c14c. +// +// Solidity: function getOperatorTotalEth(address operator) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) GetOperatorTotalEth(operator common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.GetOperatorTotalEth(&_SDUtilityPool.CallOpts, operator) +} + +// GetOperatorTotalEth is a free data retrieval call binding the contract method 0x2170c14c. +// +// Solidity: function getOperatorTotalEth(address operator) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetOperatorTotalEth(operator common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.GetOperatorTotalEth(&_SDUtilityPool.CallOpts, operator) } // GetPoolAvailableSDBalance is a free data retrieval call binding the contract method 0xda695857. @@ -570,10 +849,10 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) GetPoolAvailableSDBalance() (* // GetRequestIdsByDelegator is a free data retrieval call binding the contract method 0x99775f40. // -// Solidity: function getRequestIdsByDelegator(address _owner) view returns(uint256[]) -func (_SDUtilityPool *SDUtilityPoolCaller) GetRequestIdsByDelegator(opts *bind.CallOpts, _owner common.Address) ([]*big.Int, error) { +// Solidity: function getRequestIdsByDelegator(address _delegator) view returns(uint256[]) +func (_SDUtilityPool *SDUtilityPoolCaller) GetRequestIdsByDelegator(opts *bind.CallOpts, _delegator common.Address) ([]*big.Int, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "getRequestIdsByDelegator", _owner) + err := _SDUtilityPool.contract.Call(opts, &out, "getRequestIdsByDelegator", _delegator) if err != nil { return *new([]*big.Int), err @@ -587,16 +866,47 @@ func (_SDUtilityPool *SDUtilityPoolCaller) GetRequestIdsByDelegator(opts *bind.C // GetRequestIdsByDelegator is a free data retrieval call binding the contract method 0x99775f40. // -// Solidity: function getRequestIdsByDelegator(address _owner) view returns(uint256[]) -func (_SDUtilityPool *SDUtilityPoolSession) GetRequestIdsByDelegator(_owner common.Address) ([]*big.Int, error) { - return _SDUtilityPool.Contract.GetRequestIdsByDelegator(&_SDUtilityPool.CallOpts, _owner) +// Solidity: function getRequestIdsByDelegator(address _delegator) view returns(uint256[]) +func (_SDUtilityPool *SDUtilityPoolSession) GetRequestIdsByDelegator(_delegator common.Address) ([]*big.Int, error) { + return _SDUtilityPool.Contract.GetRequestIdsByDelegator(&_SDUtilityPool.CallOpts, _delegator) } // GetRequestIdsByDelegator is a free data retrieval call binding the contract method 0x99775f40. // -// Solidity: function getRequestIdsByDelegator(address _owner) view returns(uint256[]) -func (_SDUtilityPool *SDUtilityPoolCallerSession) GetRequestIdsByDelegator(_owner common.Address) ([]*big.Int, error) { - return _SDUtilityPool.Contract.GetRequestIdsByDelegator(&_SDUtilityPool.CallOpts, _owner) +// Solidity: function getRequestIdsByDelegator(address _delegator) view returns(uint256[]) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetRequestIdsByDelegator(_delegator common.Address) ([]*big.Int, error) { + return _SDUtilityPool.Contract.GetRequestIdsByDelegator(&_SDUtilityPool.CallOpts, _delegator) +} + +// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. +// +// Solidity: function getRoleAdmin(bytes32 role) view returns(bytes32) +func (_SDUtilityPool *SDUtilityPoolCaller) GetRoleAdmin(opts *bind.CallOpts, role [32]byte) ([32]byte, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "getRoleAdmin", role) + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. +// +// Solidity: function getRoleAdmin(bytes32 role) view returns(bytes32) +func (_SDUtilityPool *SDUtilityPoolSession) GetRoleAdmin(role [32]byte) ([32]byte, error) { + return _SDUtilityPool.Contract.GetRoleAdmin(&_SDUtilityPool.CallOpts, role) +} + +// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. +// +// Solidity: function getRoleAdmin(bytes32 role) view returns(bytes32) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetRoleAdmin(role [32]byte) ([32]byte, error) { + return _SDUtilityPool.Contract.GetRoleAdmin(&_SDUtilityPool.CallOpts, role) } // GetUserData is a free data retrieval call binding the contract method 0xffc9896b. @@ -661,6 +971,102 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) GetUtilizerLatestBalance(_util return _SDUtilityPool.Contract.GetUtilizerLatestBalance(&_SDUtilityPool.CallOpts, _utilizer) } +// HasRole is a free data retrieval call binding the contract method 0x91d14854. +// +// Solidity: function hasRole(bytes32 role, address account) view returns(bool) +func (_SDUtilityPool *SDUtilityPoolCaller) HasRole(opts *bind.CallOpts, role [32]byte, account common.Address) (bool, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "hasRole", role, account) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// HasRole is a free data retrieval call binding the contract method 0x91d14854. +// +// Solidity: function hasRole(bytes32 role, address account) view returns(bool) +func (_SDUtilityPool *SDUtilityPoolSession) HasRole(role [32]byte, account common.Address) (bool, error) { + return _SDUtilityPool.Contract.HasRole(&_SDUtilityPool.CallOpts, role, account) +} + +// HasRole is a free data retrieval call binding the contract method 0x91d14854. +// +// Solidity: function hasRole(bytes32 role, address account) view returns(bool) +func (_SDUtilityPool *SDUtilityPoolCallerSession) HasRole(role [32]byte, account common.Address) (bool, error) { + return _SDUtilityPool.Contract.HasRole(&_SDUtilityPool.CallOpts, role, account) +} + +// Liquidations is a free data retrieval call binding the contract method 0xa66c84f4. +// +// Solidity: function liquidations(uint256 ) view returns(uint256 totalAmountInEth, uint256 totalBonusInEth, uint256 totalFeeInEth, bool isRepaid, bool isClaimed, address liquidator) +func (_SDUtilityPool *SDUtilityPoolCaller) Liquidations(opts *bind.CallOpts, arg0 *big.Int) (struct { + TotalAmountInEth *big.Int + TotalBonusInEth *big.Int + TotalFeeInEth *big.Int + IsRepaid bool + IsClaimed bool + Liquidator common.Address +}, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "liquidations", arg0) + + outstruct := new(struct { + TotalAmountInEth *big.Int + TotalBonusInEth *big.Int + TotalFeeInEth *big.Int + IsRepaid bool + IsClaimed bool + Liquidator common.Address + }) + if err != nil { + return *outstruct, err + } + + outstruct.TotalAmountInEth = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.TotalBonusInEth = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.TotalFeeInEth = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + outstruct.IsRepaid = *abi.ConvertType(out[3], new(bool)).(*bool) + outstruct.IsClaimed = *abi.ConvertType(out[4], new(bool)).(*bool) + outstruct.Liquidator = *abi.ConvertType(out[5], new(common.Address)).(*common.Address) + + return *outstruct, err + +} + +// Liquidations is a free data retrieval call binding the contract method 0xa66c84f4. +// +// Solidity: function liquidations(uint256 ) view returns(uint256 totalAmountInEth, uint256 totalBonusInEth, uint256 totalFeeInEth, bool isRepaid, bool isClaimed, address liquidator) +func (_SDUtilityPool *SDUtilityPoolSession) Liquidations(arg0 *big.Int) (struct { + TotalAmountInEth *big.Int + TotalBonusInEth *big.Int + TotalFeeInEth *big.Int + IsRepaid bool + IsClaimed bool + Liquidator common.Address +}, error) { + return _SDUtilityPool.Contract.Liquidations(&_SDUtilityPool.CallOpts, arg0) +} + +// Liquidations is a free data retrieval call binding the contract method 0xa66c84f4. +// +// Solidity: function liquidations(uint256 ) view returns(uint256 totalAmountInEth, uint256 totalBonusInEth, uint256 totalFeeInEth, bool isRepaid, bool isClaimed, address liquidator) +func (_SDUtilityPool *SDUtilityPoolCallerSession) Liquidations(arg0 *big.Int) (struct { + TotalAmountInEth *big.Int + TotalBonusInEth *big.Int + TotalFeeInEth *big.Int + IsRepaid bool + IsClaimed bool + Liquidator common.Address +}, error) { + return _SDUtilityPool.Contract.Liquidations(&_SDUtilityPool.CallOpts, arg0) +} + // MaxETHWorthOfSDPerValidator is a free data retrieval call binding the contract method 0x2807c313. // // Solidity: function maxETHWorthOfSDPerValidator() view returns(uint256) @@ -692,12 +1098,12 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) MaxETHWorthOfSDPerValidator() return _SDUtilityPool.Contract.MaxETHWorthOfSDPerValidator(&_SDUtilityPool.CallOpts) } -// PoolUtilization is a free data retrieval call binding the contract method 0x9a3263ee. +// MaxNonRedeemedDelegatorRequestCount is a free data retrieval call binding the contract method 0xc083f3e6. // -// Solidity: function poolUtilization() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) PoolUtilization(opts *bind.CallOpts) (*big.Int, error) { +// Solidity: function maxNonRedeemedDelegatorRequestCount() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) MaxNonRedeemedDelegatorRequestCount(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "poolUtilization") + err := _SDUtilityPool.contract.Call(opts, &out, "maxNonRedeemedDelegatorRequestCount") if err != nil { return *new(*big.Int), err @@ -709,26 +1115,26 @@ func (_SDUtilityPool *SDUtilityPoolCaller) PoolUtilization(opts *bind.CallOpts) } -// PoolUtilization is a free data retrieval call binding the contract method 0x9a3263ee. +// MaxNonRedeemedDelegatorRequestCount is a free data retrieval call binding the contract method 0xc083f3e6. // -// Solidity: function poolUtilization() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) PoolUtilization() (*big.Int, error) { - return _SDUtilityPool.Contract.PoolUtilization(&_SDUtilityPool.CallOpts) +// Solidity: function maxNonRedeemedDelegatorRequestCount() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) MaxNonRedeemedDelegatorRequestCount() (*big.Int, error) { + return _SDUtilityPool.Contract.MaxNonRedeemedDelegatorRequestCount(&_SDUtilityPool.CallOpts) } -// PoolUtilization is a free data retrieval call binding the contract method 0x9a3263ee. +// MaxNonRedeemedDelegatorRequestCount is a free data retrieval call binding the contract method 0xc083f3e6. // -// Solidity: function poolUtilization() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) PoolUtilization() (*big.Int, error) { - return _SDUtilityPool.Contract.PoolUtilization(&_SDUtilityPool.CallOpts) +// Solidity: function maxNonRedeemedDelegatorRequestCount() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) MaxNonRedeemedDelegatorRequestCount() (*big.Int, error) { + return _SDUtilityPool.Contract.MaxNonRedeemedDelegatorRequestCount(&_SDUtilityPool.CallOpts) } -// RequestIdsByDelegatorAddress is a free data retrieval call binding the contract method 0x7844e3af. +// MinBlockDelayToFinalizeRequest is a free data retrieval call binding the contract method 0xbc1428f6. // -// Solidity: function requestIdsByDelegatorAddress(address , uint256 ) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) RequestIdsByDelegatorAddress(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (*big.Int, error) { +// Solidity: function minBlockDelayToFinalizeRequest() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) MinBlockDelayToFinalizeRequest(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "requestIdsByDelegatorAddress", arg0, arg1) + err := _SDUtilityPool.contract.Call(opts, &out, "minBlockDelayToFinalizeRequest") if err != nil { return *new(*big.Int), err @@ -740,26 +1146,26 @@ func (_SDUtilityPool *SDUtilityPoolCaller) RequestIdsByDelegatorAddress(opts *bi } -// RequestIdsByDelegatorAddress is a free data retrieval call binding the contract method 0x7844e3af. +// MinBlockDelayToFinalizeRequest is a free data retrieval call binding the contract method 0xbc1428f6. // -// Solidity: function requestIdsByDelegatorAddress(address , uint256 ) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) RequestIdsByDelegatorAddress(arg0 common.Address, arg1 *big.Int) (*big.Int, error) { - return _SDUtilityPool.Contract.RequestIdsByDelegatorAddress(&_SDUtilityPool.CallOpts, arg0, arg1) +// Solidity: function minBlockDelayToFinalizeRequest() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) MinBlockDelayToFinalizeRequest() (*big.Int, error) { + return _SDUtilityPool.Contract.MinBlockDelayToFinalizeRequest(&_SDUtilityPool.CallOpts) } -// RequestIdsByDelegatorAddress is a free data retrieval call binding the contract method 0x7844e3af. +// MinBlockDelayToFinalizeRequest is a free data retrieval call binding the contract method 0xbc1428f6. // -// Solidity: function requestIdsByDelegatorAddress(address , uint256 ) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) RequestIdsByDelegatorAddress(arg0 common.Address, arg1 *big.Int) (*big.Int, error) { - return _SDUtilityPool.Contract.RequestIdsByDelegatorAddress(&_SDUtilityPool.CallOpts, arg0, arg1) +// Solidity: function minBlockDelayToFinalizeRequest() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) MinBlockDelayToFinalizeRequest() (*big.Int, error) { + return _SDUtilityPool.Contract.MinBlockDelayToFinalizeRequest(&_SDUtilityPool.CallOpts) } -// UtilizationRatePerBlock is a free data retrieval call binding the contract method 0x962c7070. +// NextRequestId is a free data retrieval call binding the contract method 0x6a84a985. // -// Solidity: function utilizationRatePerBlock() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) UtilizationRatePerBlock(opts *bind.CallOpts) (*big.Int, error) { +// Solidity: function nextRequestId() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) NextRequestId(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "utilizationRatePerBlock") + err := _SDUtilityPool.contract.Call(opts, &out, "nextRequestId") if err != nil { return *new(*big.Int), err @@ -771,26 +1177,26 @@ func (_SDUtilityPool *SDUtilityPoolCaller) UtilizationRatePerBlock(opts *bind.Ca } -// UtilizationRatePerBlock is a free data retrieval call binding the contract method 0x962c7070. +// NextRequestId is a free data retrieval call binding the contract method 0x6a84a985. // -// Solidity: function utilizationRatePerBlock() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) UtilizationRatePerBlock() (*big.Int, error) { - return _SDUtilityPool.Contract.UtilizationRatePerBlock(&_SDUtilityPool.CallOpts) +// Solidity: function nextRequestId() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) NextRequestId() (*big.Int, error) { + return _SDUtilityPool.Contract.NextRequestId(&_SDUtilityPool.CallOpts) } -// UtilizationRatePerBlock is a free data retrieval call binding the contract method 0x962c7070. +// NextRequestId is a free data retrieval call binding the contract method 0x6a84a985. // -// Solidity: function utilizationRatePerBlock() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizationRatePerBlock() (*big.Int, error) { - return _SDUtilityPool.Contract.UtilizationRatePerBlock(&_SDUtilityPool.CallOpts) +// Solidity: function nextRequestId() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) NextRequestId() (*big.Int, error) { + return _SDUtilityPool.Contract.NextRequestId(&_SDUtilityPool.CallOpts) } -// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. +// NextRequestIdToFinalize is a free data retrieval call binding the contract method 0xbbb84362. // -// Solidity: function utilizerBalanceStored(address account) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) UtilizerBalanceStored(opts *bind.CallOpts, account common.Address) (*big.Int, error) { +// Solidity: function nextRequestIdToFinalize() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) NextRequestIdToFinalize(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "utilizerBalanceStored", account) + err := _SDUtilityPool.contract.Call(opts, &out, "nextRequestIdToFinalize") if err != nil { return *new(*big.Int), err @@ -802,572 +1208,1998 @@ func (_SDUtilityPool *SDUtilityPoolCaller) UtilizerBalanceStored(opts *bind.Call } -// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. +// NextRequestIdToFinalize is a free data retrieval call binding the contract method 0xbbb84362. // -// Solidity: function utilizerBalanceStored(address account) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) UtilizerBalanceStored(account common.Address) (*big.Int, error) { - return _SDUtilityPool.Contract.UtilizerBalanceStored(&_SDUtilityPool.CallOpts, account) +// Solidity: function nextRequestIdToFinalize() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) NextRequestIdToFinalize() (*big.Int, error) { + return _SDUtilityPool.Contract.NextRequestIdToFinalize(&_SDUtilityPool.CallOpts) } -// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. +// NextRequestIdToFinalize is a free data retrieval call binding the contract method 0xbbb84362. // -// Solidity: function utilizerBalanceStored(address account) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizerBalanceStored(account common.Address) (*big.Int, error) { - return _SDUtilityPool.Contract.UtilizerBalanceStored(&_SDUtilityPool.CallOpts, account) +// Solidity: function nextRequestIdToFinalize() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) NextRequestIdToFinalize() (*big.Int, error) { + return _SDUtilityPool.Contract.NextRequestIdToFinalize(&_SDUtilityPool.CallOpts) } -// UtilizerData is a free data retrieval call binding the contract method 0x9e070088. +// Paused is a free data retrieval call binding the contract method 0x5c975abb. // -// Solidity: function utilizerData(address ) view returns(uint256 principal, uint256 utilizeIndex) -func (_SDUtilityPool *SDUtilityPoolCaller) UtilizerData(opts *bind.CallOpts, arg0 common.Address) (struct { - Principal *big.Int - UtilizeIndex *big.Int -}, error) { +// Solidity: function paused() view returns(bool) +func (_SDUtilityPool *SDUtilityPoolCaller) Paused(opts *bind.CallOpts) (bool, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "utilizerData", arg0) + err := _SDUtilityPool.contract.Call(opts, &out, "paused") - outstruct := new(struct { - Principal *big.Int - UtilizeIndex *big.Int - }) if err != nil { - return *outstruct, err + return *new(bool), err } - outstruct.Principal = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - outstruct.UtilizeIndex = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - return *outstruct, err + return out0, err } -// UtilizerData is a free data retrieval call binding the contract method 0x9e070088. +// Paused is a free data retrieval call binding the contract method 0x5c975abb. // -// Solidity: function utilizerData(address ) view returns(uint256 principal, uint256 utilizeIndex) -func (_SDUtilityPool *SDUtilityPoolSession) UtilizerData(arg0 common.Address) (struct { - Principal *big.Int - UtilizeIndex *big.Int -}, error) { - return _SDUtilityPool.Contract.UtilizerData(&_SDUtilityPool.CallOpts, arg0) +// Solidity: function paused() view returns(bool) +func (_SDUtilityPool *SDUtilityPoolSession) Paused() (bool, error) { + return _SDUtilityPool.Contract.Paused(&_SDUtilityPool.CallOpts) } -// UtilizerData is a free data retrieval call binding the contract method 0x9e070088. +// Paused is a free data retrieval call binding the contract method 0x5c975abb. // -// Solidity: function utilizerData(address ) view returns(uint256 principal, uint256 utilizeIndex) -func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizerData(arg0 common.Address) (struct { - Principal *big.Int - UtilizeIndex *big.Int -}, error) { - return _SDUtilityPool.Contract.UtilizerData(&_SDUtilityPool.CallOpts, arg0) +// Solidity: function paused() view returns(bool) +func (_SDUtilityPool *SDUtilityPoolCallerSession) Paused() (bool, error) { + return _SDUtilityPool.Contract.Paused(&_SDUtilityPool.CallOpts) } -// AccrueFee is a paid mutator transaction binding the contract method 0xb26cc394. +// PoolUtilization is a free data retrieval call binding the contract method 0x9a3263ee. // -// Solidity: function accrueFee() returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) AccrueFee(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "accrueFee") -} +// Solidity: function poolUtilization() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) PoolUtilization(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "poolUtilization") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err -// AccrueFee is a paid mutator transaction binding the contract method 0xb26cc394. -// -// Solidity: function accrueFee() returns() -func (_SDUtilityPool *SDUtilityPoolSession) AccrueFee() (*types.Transaction, error) { - return _SDUtilityPool.Contract.AccrueFee(&_SDUtilityPool.TransactOpts) } -// AccrueFee is a paid mutator transaction binding the contract method 0xb26cc394. +// PoolUtilization is a free data retrieval call binding the contract method 0x9a3263ee. // -// Solidity: function accrueFee() returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) AccrueFee() (*types.Transaction, error) { - return _SDUtilityPool.Contract.AccrueFee(&_SDUtilityPool.TransactOpts) +// Solidity: function poolUtilization() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) PoolUtilization() (*big.Int, error) { + return _SDUtilityPool.Contract.PoolUtilization(&_SDUtilityPool.CallOpts) } -// Claim is a paid mutator transaction binding the contract method 0x379607f5. +// PoolUtilization is a free data retrieval call binding the contract method 0x9a3263ee. // -// Solidity: function claim(uint256 requestId) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) Claim(opts *bind.TransactOpts, requestId *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "claim", requestId) +// Solidity: function poolUtilization() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) PoolUtilization() (*big.Int, error) { + return _SDUtilityPool.Contract.PoolUtilization(&_SDUtilityPool.CallOpts) } -// Claim is a paid mutator transaction binding the contract method 0x379607f5. +// ProtocolFee is a free data retrieval call binding the contract method 0xb0e21e8a. // -// Solidity: function claim(uint256 requestId) returns() -func (_SDUtilityPool *SDUtilityPoolSession) Claim(requestId *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Claim(&_SDUtilityPool.TransactOpts, requestId) +// Solidity: function protocolFee() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) ProtocolFee(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "protocolFee") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + } -// Claim is a paid mutator transaction binding the contract method 0x379607f5. +// ProtocolFee is a free data retrieval call binding the contract method 0xb0e21e8a. // -// Solidity: function claim(uint256 requestId) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) Claim(requestId *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Claim(&_SDUtilityPool.TransactOpts, requestId) +// Solidity: function protocolFee() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) ProtocolFee() (*big.Int, error) { + return _SDUtilityPool.Contract.ProtocolFee(&_SDUtilityPool.CallOpts) } -// CompleteLiquidation is a paid mutator transaction binding the contract method 0xd844cb6c. +// ProtocolFee is a free data retrieval call binding the contract method 0xb0e21e8a. // -// Solidity: function completeLiquidation(address account) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) CompleteLiquidation(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "completeLiquidation", account) +// Solidity: function protocolFee() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) ProtocolFee() (*big.Int, error) { + return _SDUtilityPool.Contract.ProtocolFee(&_SDUtilityPool.CallOpts) } -// CompleteLiquidation is a paid mutator transaction binding the contract method 0xd844cb6c. +// RequestIdsByDelegatorAddress is a free data retrieval call binding the contract method 0x7844e3af. // -// Solidity: function completeLiquidation(address account) returns() -func (_SDUtilityPool *SDUtilityPoolSession) CompleteLiquidation(account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.CompleteLiquidation(&_SDUtilityPool.TransactOpts, account) +// Solidity: function requestIdsByDelegatorAddress(address , uint256 ) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) RequestIdsByDelegatorAddress(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "requestIdsByDelegatorAddress", arg0, arg1) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + } -// CompleteLiquidation is a paid mutator transaction binding the contract method 0xd844cb6c. +// RequestIdsByDelegatorAddress is a free data retrieval call binding the contract method 0x7844e3af. // -// Solidity: function completeLiquidation(address account) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) CompleteLiquidation(account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.CompleteLiquidation(&_SDUtilityPool.TransactOpts, account) +// Solidity: function requestIdsByDelegatorAddress(address , uint256 ) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) RequestIdsByDelegatorAddress(arg0 common.Address, arg1 *big.Int) (*big.Int, error) { + return _SDUtilityPool.Contract.RequestIdsByDelegatorAddress(&_SDUtilityPool.CallOpts, arg0, arg1) } -// Delegate is a paid mutator transaction binding the contract method 0x9fa6dd35. +// RequestIdsByDelegatorAddress is a free data retrieval call binding the contract method 0x7844e3af. // -// Solidity: function delegate(uint256 sdAmount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) Delegate(opts *bind.TransactOpts, sdAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "delegate", sdAmount) +// Solidity: function requestIdsByDelegatorAddress(address , uint256 ) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) RequestIdsByDelegatorAddress(arg0 common.Address, arg1 *big.Int) (*big.Int, error) { + return _SDUtilityPool.Contract.RequestIdsByDelegatorAddress(&_SDUtilityPool.CallOpts, arg0, arg1) } -// Delegate is a paid mutator transaction binding the contract method 0x9fa6dd35. +// RiskConfig is a free data retrieval call binding the contract method 0x7c90a6ca. // -// Solidity: function delegate(uint256 sdAmount) returns() -func (_SDUtilityPool *SDUtilityPoolSession) Delegate(sdAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Delegate(&_SDUtilityPool.TransactOpts, sdAmount) +// Solidity: function riskConfig() view returns(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) +func (_SDUtilityPool *SDUtilityPoolCaller) RiskConfig(opts *bind.CallOpts) (struct { + LiquidationThreshold *big.Int + LiquidationBonusPercent *big.Int + LiquidationFeePercent *big.Int + Ltv *big.Int +}, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "riskConfig") + + outstruct := new(struct { + LiquidationThreshold *big.Int + LiquidationBonusPercent *big.Int + LiquidationFeePercent *big.Int + Ltv *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.LiquidationThreshold = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.LiquidationBonusPercent = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.LiquidationFeePercent = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + outstruct.Ltv = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) + + return *outstruct, err + } -// Delegate is a paid mutator transaction binding the contract method 0x9fa6dd35. +// RiskConfig is a free data retrieval call binding the contract method 0x7c90a6ca. // -// Solidity: function delegate(uint256 sdAmount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) Delegate(sdAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Delegate(&_SDUtilityPool.TransactOpts, sdAmount) +// Solidity: function riskConfig() view returns(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) +func (_SDUtilityPool *SDUtilityPoolSession) RiskConfig() (struct { + LiquidationThreshold *big.Int + LiquidationBonusPercent *big.Int + LiquidationFeePercent *big.Int + Ltv *big.Int +}, error) { + return _SDUtilityPool.Contract.RiskConfig(&_SDUtilityPool.CallOpts) } -// ExchangeRateCurrent is a paid mutator transaction binding the contract method 0xbd6d894d. +// RiskConfig is a free data retrieval call binding the contract method 0x7c90a6ca. // -// Solidity: function exchangeRateCurrent() returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactor) ExchangeRateCurrent(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "exchangeRateCurrent") +// Solidity: function riskConfig() view returns(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) +func (_SDUtilityPool *SDUtilityPoolCallerSession) RiskConfig() (struct { + LiquidationThreshold *big.Int + LiquidationBonusPercent *big.Int + LiquidationFeePercent *big.Int + Ltv *big.Int +}, error) { + return _SDUtilityPool.Contract.RiskConfig(&_SDUtilityPool.CallOpts) } -// ExchangeRateCurrent is a paid mutator transaction binding the contract method 0xbd6d894d. +// SdRequestedForWithdraw is a free data retrieval call binding the contract method 0x3b92e3cf. // -// Solidity: function exchangeRateCurrent() returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) ExchangeRateCurrent() (*types.Transaction, error) { - return _SDUtilityPool.Contract.ExchangeRateCurrent(&_SDUtilityPool.TransactOpts) +// Solidity: function sdRequestedForWithdraw() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) SdRequestedForWithdraw(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "sdRequestedForWithdraw") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + } -// ExchangeRateCurrent is a paid mutator transaction binding the contract method 0xbd6d894d. +// SdRequestedForWithdraw is a free data retrieval call binding the contract method 0x3b92e3cf. // -// Solidity: function exchangeRateCurrent() returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactorSession) ExchangeRateCurrent() (*types.Transaction, error) { - return _SDUtilityPool.Contract.ExchangeRateCurrent(&_SDUtilityPool.TransactOpts) +// Solidity: function sdRequestedForWithdraw() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) SdRequestedForWithdraw() (*big.Int, error) { + return _SDUtilityPool.Contract.SdRequestedForWithdraw(&_SDUtilityPool.CallOpts) } -// FinalizeDelegatorWithdrawalRequest is a paid mutator transaction binding the contract method 0x71898b4e. +// SdRequestedForWithdraw is a free data retrieval call binding the contract method 0x3b92e3cf. // -// Solidity: function finalizeDelegatorWithdrawalRequest() returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) FinalizeDelegatorWithdrawalRequest(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "finalizeDelegatorWithdrawalRequest") +// Solidity: function sdRequestedForWithdraw() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) SdRequestedForWithdraw() (*big.Int, error) { + return _SDUtilityPool.Contract.SdRequestedForWithdraw(&_SDUtilityPool.CallOpts) } -// FinalizeDelegatorWithdrawalRequest is a paid mutator transaction binding the contract method 0x71898b4e. +// SdReservedForClaim is a free data retrieval call binding the contract method 0x2b886941. // -// Solidity: function finalizeDelegatorWithdrawalRequest() returns() -func (_SDUtilityPool *SDUtilityPoolSession) FinalizeDelegatorWithdrawalRequest() (*types.Transaction, error) { - return _SDUtilityPool.Contract.FinalizeDelegatorWithdrawalRequest(&_SDUtilityPool.TransactOpts) +// Solidity: function sdReservedForClaim() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) SdReservedForClaim(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "sdReservedForClaim") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + } -// FinalizeDelegatorWithdrawalRequest is a paid mutator transaction binding the contract method 0x71898b4e. +// SdReservedForClaim is a free data retrieval call binding the contract method 0x2b886941. // -// Solidity: function finalizeDelegatorWithdrawalRequest() returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) FinalizeDelegatorWithdrawalRequest() (*types.Transaction, error) { - return _SDUtilityPool.Contract.FinalizeDelegatorWithdrawalRequest(&_SDUtilityPool.TransactOpts) +// Solidity: function sdReservedForClaim() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) SdReservedForClaim() (*big.Int, error) { + return _SDUtilityPool.Contract.SdReservedForClaim(&_SDUtilityPool.CallOpts) } -// LiquidationCall is a paid mutator transaction binding the contract method 0xd2ac4a3d. +// SdReservedForClaim is a free data retrieval call binding the contract method 0x2b886941. // -// Solidity: function liquidationCall(address account) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) LiquidationCall(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "liquidationCall", account) +// Solidity: function sdReservedForClaim() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) SdReservedForClaim() (*big.Int, error) { + return _SDUtilityPool.Contract.SdReservedForClaim(&_SDUtilityPool.CallOpts) } -// LiquidationCall is a paid mutator transaction binding the contract method 0xd2ac4a3d. +// StaderConfig is a free data retrieval call binding the contract method 0x490ffa35. // -// Solidity: function liquidationCall(address account) returns() -func (_SDUtilityPool *SDUtilityPoolSession) LiquidationCall(account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.LiquidationCall(&_SDUtilityPool.TransactOpts, account) +// Solidity: function staderConfig() view returns(address) +func (_SDUtilityPool *SDUtilityPoolCaller) StaderConfig(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "staderConfig") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + } -// LiquidationCall is a paid mutator transaction binding the contract method 0xd2ac4a3d. +// StaderConfig is a free data retrieval call binding the contract method 0x490ffa35. // -// Solidity: function liquidationCall(address account) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) LiquidationCall(account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.LiquidationCall(&_SDUtilityPool.TransactOpts, account) +// Solidity: function staderConfig() view returns(address) +func (_SDUtilityPool *SDUtilityPoolSession) StaderConfig() (common.Address, error) { + return _SDUtilityPool.Contract.StaderConfig(&_SDUtilityPool.CallOpts) } -// MaxApproveSD is a paid mutator transaction binding the contract method 0x3e04cd35. +// StaderConfig is a free data retrieval call binding the contract method 0x490ffa35. // -// Solidity: function maxApproveSD() returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) MaxApproveSD(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "maxApproveSD") +// Solidity: function staderConfig() view returns(address) +func (_SDUtilityPool *SDUtilityPoolCallerSession) StaderConfig() (common.Address, error) { + return _SDUtilityPool.Contract.StaderConfig(&_SDUtilityPool.CallOpts) } -// MaxApproveSD is a paid mutator transaction binding the contract method 0x3e04cd35. +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. // -// Solidity: function maxApproveSD() returns() -func (_SDUtilityPool *SDUtilityPoolSession) MaxApproveSD() (*types.Transaction, error) { - return _SDUtilityPool.Contract.MaxApproveSD(&_SDUtilityPool.TransactOpts) -} +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_SDUtilityPool *SDUtilityPoolCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "supportsInterface", interfaceId) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err -// MaxApproveSD is a paid mutator transaction binding the contract method 0x3e04cd35. -// -// Solidity: function maxApproveSD() returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) MaxApproveSD() (*types.Transaction, error) { - return _SDUtilityPool.Contract.MaxApproveSD(&_SDUtilityPool.TransactOpts) } -// Repay is a paid mutator transaction binding the contract method 0x371fd8e6. +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. // -// Solidity: function repay(uint256 repayAmount) returns(uint256, uint256) -func (_SDUtilityPool *SDUtilityPoolTransactor) Repay(opts *bind.TransactOpts, repayAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "repay", repayAmount) +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_SDUtilityPool *SDUtilityPoolSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _SDUtilityPool.Contract.SupportsInterface(&_SDUtilityPool.CallOpts, interfaceId) } -// Repay is a paid mutator transaction binding the contract method 0x371fd8e6. +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. // -// Solidity: function repay(uint256 repayAmount) returns(uint256, uint256) -func (_SDUtilityPool *SDUtilityPoolSession) Repay(repayAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Repay(&_SDUtilityPool.TransactOpts, repayAmount) +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_SDUtilityPool *SDUtilityPoolCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _SDUtilityPool.Contract.SupportsInterface(&_SDUtilityPool.CallOpts, interfaceId) } -// Repay is a paid mutator transaction binding the contract method 0x371fd8e6. +// TotalUtilizedSD is a free data retrieval call binding the contract method 0x8763a328. // -// Solidity: function repay(uint256 repayAmount) returns(uint256, uint256) -func (_SDUtilityPool *SDUtilityPoolTransactorSession) Repay(repayAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Repay(&_SDUtilityPool.TransactOpts, repayAmount) +// Solidity: function totalUtilizedSD() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) TotalUtilizedSD(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "totalUtilizedSD") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + } -// RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. +// TotalUtilizedSD is a free data retrieval call binding the contract method 0x8763a328. // -// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns(uint256, uint256) -func (_SDUtilityPool *SDUtilityPoolTransactor) RepayOnBehalf(opts *bind.TransactOpts, utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "repayOnBehalf", utilizer, repayAmount) +// Solidity: function totalUtilizedSD() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) TotalUtilizedSD() (*big.Int, error) { + return _SDUtilityPool.Contract.TotalUtilizedSD(&_SDUtilityPool.CallOpts) } -// RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. +// TotalUtilizedSD is a free data retrieval call binding the contract method 0x8763a328. // -// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns(uint256, uint256) -func (_SDUtilityPool *SDUtilityPoolSession) RepayOnBehalf(utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RepayOnBehalf(&_SDUtilityPool.TransactOpts, utilizer, repayAmount) +// Solidity: function totalUtilizedSD() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) TotalUtilizedSD() (*big.Int, error) { + return _SDUtilityPool.Contract.TotalUtilizedSD(&_SDUtilityPool.CallOpts) } -// RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. +// UtilizationRatePerBlock is a free data retrieval call binding the contract method 0x962c7070. // -// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns(uint256, uint256) -func (_SDUtilityPool *SDUtilityPoolTransactorSession) RepayOnBehalf(utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RepayOnBehalf(&_SDUtilityPool.TransactOpts, utilizer, repayAmount) +// Solidity: function utilizationRatePerBlock() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) UtilizationRatePerBlock(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "utilizationRatePerBlock") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + } -// RequestWithdraw is a paid mutator transaction binding the contract method 0x745400c9. +// UtilizationRatePerBlock is a free data retrieval call binding the contract method 0x962c7070. // -// Solidity: function requestWithdraw(uint256 cTokenAmount) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactor) RequestWithdraw(opts *bind.TransactOpts, cTokenAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "requestWithdraw", cTokenAmount) +// Solidity: function utilizationRatePerBlock() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) UtilizationRatePerBlock() (*big.Int, error) { + return _SDUtilityPool.Contract.UtilizationRatePerBlock(&_SDUtilityPool.CallOpts) } -// RequestWithdraw is a paid mutator transaction binding the contract method 0x745400c9. +// UtilizationRatePerBlock is a free data retrieval call binding the contract method 0x962c7070. // -// Solidity: function requestWithdraw(uint256 cTokenAmount) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) RequestWithdraw(cTokenAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RequestWithdraw(&_SDUtilityPool.TransactOpts, cTokenAmount) +// Solidity: function utilizationRatePerBlock() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizationRatePerBlock() (*big.Int, error) { + return _SDUtilityPool.Contract.UtilizationRatePerBlock(&_SDUtilityPool.CallOpts) } -// RequestWithdraw is a paid mutator transaction binding the contract method 0x745400c9. +// UtilizeIndex is a free data retrieval call binding the contract method 0x634c48c7. // -// Solidity: function requestWithdraw(uint256 cTokenAmount) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactorSession) RequestWithdraw(cTokenAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RequestWithdraw(&_SDUtilityPool.TransactOpts, cTokenAmount) +// Solidity: function utilizeIndex() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) UtilizeIndex(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "utilizeIndex") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + } -// RequestWithdrawWithSDAmount is a paid mutator transaction binding the contract method 0xc51cd1cc. +// UtilizeIndex is a free data retrieval call binding the contract method 0x634c48c7. // -// Solidity: function requestWithdrawWithSDAmount(uint256 sdAmount) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactor) RequestWithdrawWithSDAmount(opts *bind.TransactOpts, sdAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "requestWithdrawWithSDAmount", sdAmount) +// Solidity: function utilizeIndex() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) UtilizeIndex() (*big.Int, error) { + return _SDUtilityPool.Contract.UtilizeIndex(&_SDUtilityPool.CallOpts) } -// RequestWithdrawWithSDAmount is a paid mutator transaction binding the contract method 0xc51cd1cc. +// UtilizeIndex is a free data retrieval call binding the contract method 0x634c48c7. // -// Solidity: function requestWithdrawWithSDAmount(uint256 sdAmount) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) RequestWithdrawWithSDAmount(sdAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RequestWithdrawWithSDAmount(&_SDUtilityPool.TransactOpts, sdAmount) +// Solidity: function utilizeIndex() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizeIndex() (*big.Int, error) { + return _SDUtilityPool.Contract.UtilizeIndex(&_SDUtilityPool.CallOpts) } -// RequestWithdrawWithSDAmount is a paid mutator transaction binding the contract method 0xc51cd1cc. +// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. // -// Solidity: function requestWithdrawWithSDAmount(uint256 sdAmount) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactorSession) RequestWithdrawWithSDAmount(sdAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RequestWithdrawWithSDAmount(&_SDUtilityPool.TransactOpts, sdAmount) +// Solidity: function utilizerBalanceStored(address account) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) UtilizerBalanceStored(opts *bind.CallOpts, account common.Address) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "utilizerBalanceStored", account) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + } -// UpdateConservativeEthPerKey is a paid mutator transaction binding the contract method 0x1c557f05. +// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. // -// Solidity: function updateConservativeEthPerKey(uint256 _newEthPerKey) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateConservativeEthPerKey(opts *bind.TransactOpts, _newEthPerKey *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "updateConservativeEthPerKey", _newEthPerKey) +// Solidity: function utilizerBalanceStored(address account) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) UtilizerBalanceStored(account common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.UtilizerBalanceStored(&_SDUtilityPool.CallOpts, account) } -// UpdateConservativeEthPerKey is a paid mutator transaction binding the contract method 0x1c557f05. +// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. // -// Solidity: function updateConservativeEthPerKey(uint256 _newEthPerKey) returns() -func (_SDUtilityPool *SDUtilityPoolSession) UpdateConservativeEthPerKey(_newEthPerKey *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateConservativeEthPerKey(&_SDUtilityPool.TransactOpts, _newEthPerKey) +// Solidity: function utilizerBalanceStored(address account) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizerBalanceStored(account common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.UtilizerBalanceStored(&_SDUtilityPool.CallOpts, account) } -// UpdateConservativeEthPerKey is a paid mutator transaction binding the contract method 0x1c557f05. +// UtilizerData is a free data retrieval call binding the contract method 0x9e070088. // -// Solidity: function updateConservativeEthPerKey(uint256 _newEthPerKey) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateConservativeEthPerKey(_newEthPerKey *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateConservativeEthPerKey(&_SDUtilityPool.TransactOpts, _newEthPerKey) +// Solidity: function utilizerData(address ) view returns(uint256 principal, uint256 utilizeIndex) +func (_SDUtilityPool *SDUtilityPoolCaller) UtilizerData(opts *bind.CallOpts, arg0 common.Address) (struct { + Principal *big.Int + UtilizeIndex *big.Int +}, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "utilizerData", arg0) + + outstruct := new(struct { + Principal *big.Int + UtilizeIndex *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.Principal = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.UtilizeIndex = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + + return *outstruct, err + } -// UpdateFinalizationBatchLimit is a paid mutator transaction binding the contract method 0x267fca73. +// UtilizerData is a free data retrieval call binding the contract method 0x9e070088. // -// Solidity: function updateFinalizationBatchLimit(uint256 _finalizationBatchLimit) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateFinalizationBatchLimit(opts *bind.TransactOpts, _finalizationBatchLimit *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "updateFinalizationBatchLimit", _finalizationBatchLimit) +// Solidity: function utilizerData(address ) view returns(uint256 principal, uint256 utilizeIndex) +func (_SDUtilityPool *SDUtilityPoolSession) UtilizerData(arg0 common.Address) (struct { + Principal *big.Int + UtilizeIndex *big.Int +}, error) { + return _SDUtilityPool.Contract.UtilizerData(&_SDUtilityPool.CallOpts, arg0) } -// UpdateFinalizationBatchLimit is a paid mutator transaction binding the contract method 0x267fca73. +// UtilizerData is a free data retrieval call binding the contract method 0x9e070088. // -// Solidity: function updateFinalizationBatchLimit(uint256 _finalizationBatchLimit) returns() -func (_SDUtilityPool *SDUtilityPoolSession) UpdateFinalizationBatchLimit(_finalizationBatchLimit *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateFinalizationBatchLimit(&_SDUtilityPool.TransactOpts, _finalizationBatchLimit) +// Solidity: function utilizerData(address ) view returns(uint256 principal, uint256 utilizeIndex) +func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizerData(arg0 common.Address) (struct { + Principal *big.Int + UtilizeIndex *big.Int +}, error) { + return _SDUtilityPool.Contract.UtilizerData(&_SDUtilityPool.CallOpts, arg0) } -// UpdateFinalizationBatchLimit is a paid mutator transaction binding the contract method 0x267fca73. +// AccrueFee is a paid mutator transaction binding the contract method 0xb26cc394. // -// Solidity: function updateFinalizationBatchLimit(uint256 _finalizationBatchLimit) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateFinalizationBatchLimit(_finalizationBatchLimit *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateFinalizationBatchLimit(&_SDUtilityPool.TransactOpts, _finalizationBatchLimit) +// Solidity: function accrueFee() returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) AccrueFee(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "accrueFee") } -// UpdateMaxETHWorthOfSDPerValidator is a paid mutator transaction binding the contract method 0x5393618e. +// AccrueFee is a paid mutator transaction binding the contract method 0xb26cc394. // -// Solidity: function updateMaxETHWorthOfSDPerValidator(uint256 _maxETHWorthOfSDPerValidator) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateMaxETHWorthOfSDPerValidator(opts *bind.TransactOpts, _maxETHWorthOfSDPerValidator *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "updateMaxETHWorthOfSDPerValidator", _maxETHWorthOfSDPerValidator) +// Solidity: function accrueFee() returns() +func (_SDUtilityPool *SDUtilityPoolSession) AccrueFee() (*types.Transaction, error) { + return _SDUtilityPool.Contract.AccrueFee(&_SDUtilityPool.TransactOpts) } -// UpdateMaxETHWorthOfSDPerValidator is a paid mutator transaction binding the contract method 0x5393618e. +// AccrueFee is a paid mutator transaction binding the contract method 0xb26cc394. // -// Solidity: function updateMaxETHWorthOfSDPerValidator(uint256 _maxETHWorthOfSDPerValidator) returns() -func (_SDUtilityPool *SDUtilityPoolSession) UpdateMaxETHWorthOfSDPerValidator(_maxETHWorthOfSDPerValidator *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateMaxETHWorthOfSDPerValidator(&_SDUtilityPool.TransactOpts, _maxETHWorthOfSDPerValidator) +// Solidity: function accrueFee() returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) AccrueFee() (*types.Transaction, error) { + return _SDUtilityPool.Contract.AccrueFee(&_SDUtilityPool.TransactOpts) } -// UpdateMaxETHWorthOfSDPerValidator is a paid mutator transaction binding the contract method 0x5393618e. +// Claim is a paid mutator transaction binding the contract method 0x379607f5. // -// Solidity: function updateMaxETHWorthOfSDPerValidator(uint256 _maxETHWorthOfSDPerValidator) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateMaxETHWorthOfSDPerValidator(_maxETHWorthOfSDPerValidator *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateMaxETHWorthOfSDPerValidator(&_SDUtilityPool.TransactOpts, _maxETHWorthOfSDPerValidator) +// Solidity: function claim(uint256 _requestId) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) Claim(opts *bind.TransactOpts, _requestId *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "claim", _requestId) } -// UpdateMaxNonRedeemedDelegatorRequestCount is a paid mutator transaction binding the contract method 0xee63e5f9. +// Claim is a paid mutator transaction binding the contract method 0x379607f5. // -// Solidity: function updateMaxNonRedeemedDelegatorRequestCount(uint256 _count) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateMaxNonRedeemedDelegatorRequestCount(opts *bind.TransactOpts, _count *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "updateMaxNonRedeemedDelegatorRequestCount", _count) +// Solidity: function claim(uint256 _requestId) returns() +func (_SDUtilityPool *SDUtilityPoolSession) Claim(_requestId *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Claim(&_SDUtilityPool.TransactOpts, _requestId) } -// UpdateMaxNonRedeemedDelegatorRequestCount is a paid mutator transaction binding the contract method 0xee63e5f9. +// Claim is a paid mutator transaction binding the contract method 0x379607f5. // -// Solidity: function updateMaxNonRedeemedDelegatorRequestCount(uint256 _count) returns() -func (_SDUtilityPool *SDUtilityPoolSession) UpdateMaxNonRedeemedDelegatorRequestCount(_count *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateMaxNonRedeemedDelegatorRequestCount(&_SDUtilityPool.TransactOpts, _count) +// Solidity: function claim(uint256 _requestId) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Claim(_requestId *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Claim(&_SDUtilityPool.TransactOpts, _requestId) } -// UpdateMaxNonRedeemedDelegatorRequestCount is a paid mutator transaction binding the contract method 0xee63e5f9. +// CompleteLiquidation is a paid mutator transaction binding the contract method 0xd844cb6c. // -// Solidity: function updateMaxNonRedeemedDelegatorRequestCount(uint256 _count) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateMaxNonRedeemedDelegatorRequestCount(_count *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateMaxNonRedeemedDelegatorRequestCount(&_SDUtilityPool.TransactOpts, _count) +// Solidity: function completeLiquidation(address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) CompleteLiquidation(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "completeLiquidation", account) } -// UpdateMinBlockDelayToFinalizeRequest is a paid mutator transaction binding the contract method 0x4a2965af. +// CompleteLiquidation is a paid mutator transaction binding the contract method 0xd844cb6c. // -// Solidity: function updateMinBlockDelayToFinalizeRequest(uint256 _minBlockDelayToFinalizeRequest) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateMinBlockDelayToFinalizeRequest(opts *bind.TransactOpts, _minBlockDelayToFinalizeRequest *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "updateMinBlockDelayToFinalizeRequest", _minBlockDelayToFinalizeRequest) +// Solidity: function completeLiquidation(address account) returns() +func (_SDUtilityPool *SDUtilityPoolSession) CompleteLiquidation(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.CompleteLiquidation(&_SDUtilityPool.TransactOpts, account) } -// UpdateMinBlockDelayToFinalizeRequest is a paid mutator transaction binding the contract method 0x4a2965af. +// CompleteLiquidation is a paid mutator transaction binding the contract method 0xd844cb6c. // -// Solidity: function updateMinBlockDelayToFinalizeRequest(uint256 _minBlockDelayToFinalizeRequest) returns() -func (_SDUtilityPool *SDUtilityPoolSession) UpdateMinBlockDelayToFinalizeRequest(_minBlockDelayToFinalizeRequest *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateMinBlockDelayToFinalizeRequest(&_SDUtilityPool.TransactOpts, _minBlockDelayToFinalizeRequest) +// Solidity: function completeLiquidation(address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) CompleteLiquidation(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.CompleteLiquidation(&_SDUtilityPool.TransactOpts, account) } -// UpdateMinBlockDelayToFinalizeRequest is a paid mutator transaction binding the contract method 0x4a2965af. +// Delegate is a paid mutator transaction binding the contract method 0x9fa6dd35. // -// Solidity: function updateMinBlockDelayToFinalizeRequest(uint256 _minBlockDelayToFinalizeRequest) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateMinBlockDelayToFinalizeRequest(_minBlockDelayToFinalizeRequest *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateMinBlockDelayToFinalizeRequest(&_SDUtilityPool.TransactOpts, _minBlockDelayToFinalizeRequest) +// Solidity: function delegate(uint256 sdAmount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) Delegate(opts *bind.TransactOpts, sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "delegate", sdAmount) } -// UpdateProtocolFee is a paid mutator transaction binding the contract method 0x4256dd78. +// Delegate is a paid mutator transaction binding the contract method 0x9fa6dd35. // -// Solidity: function updateProtocolFee(uint256 _protocolFee) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateProtocolFee(opts *bind.TransactOpts, _protocolFee *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "updateProtocolFee", _protocolFee) +// Solidity: function delegate(uint256 sdAmount) returns() +func (_SDUtilityPool *SDUtilityPoolSession) Delegate(sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Delegate(&_SDUtilityPool.TransactOpts, sdAmount) } -// UpdateProtocolFee is a paid mutator transaction binding the contract method 0x4256dd78. +// Delegate is a paid mutator transaction binding the contract method 0x9fa6dd35. // -// Solidity: function updateProtocolFee(uint256 _protocolFee) returns() -func (_SDUtilityPool *SDUtilityPoolSession) UpdateProtocolFee(_protocolFee *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateProtocolFee(&_SDUtilityPool.TransactOpts, _protocolFee) +// Solidity: function delegate(uint256 sdAmount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Delegate(sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Delegate(&_SDUtilityPool.TransactOpts, sdAmount) } -// UpdateProtocolFee is a paid mutator transaction binding the contract method 0x4256dd78. +// ExchangeRateCurrent is a paid mutator transaction binding the contract method 0xbd6d894d. // -// Solidity: function updateProtocolFee(uint256 _protocolFee) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateProtocolFee(_protocolFee *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateProtocolFee(&_SDUtilityPool.TransactOpts, _protocolFee) +// Solidity: function exchangeRateCurrent() returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactor) ExchangeRateCurrent(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "exchangeRateCurrent") } -// UpdateStaderConfig is a paid mutator transaction binding the contract method 0x9ee804cb. +// ExchangeRateCurrent is a paid mutator transaction binding the contract method 0xbd6d894d. +// +// Solidity: function exchangeRateCurrent() returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) ExchangeRateCurrent() (*types.Transaction, error) { + return _SDUtilityPool.Contract.ExchangeRateCurrent(&_SDUtilityPool.TransactOpts) +} + +// ExchangeRateCurrent is a paid mutator transaction binding the contract method 0xbd6d894d. +// +// Solidity: function exchangeRateCurrent() returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) ExchangeRateCurrent() (*types.Transaction, error) { + return _SDUtilityPool.Contract.ExchangeRateCurrent(&_SDUtilityPool.TransactOpts) +} + +// FinalizeDelegatorWithdrawalRequest is a paid mutator transaction binding the contract method 0x71898b4e. +// +// Solidity: function finalizeDelegatorWithdrawalRequest() returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) FinalizeDelegatorWithdrawalRequest(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "finalizeDelegatorWithdrawalRequest") +} + +// FinalizeDelegatorWithdrawalRequest is a paid mutator transaction binding the contract method 0x71898b4e. +// +// Solidity: function finalizeDelegatorWithdrawalRequest() returns() +func (_SDUtilityPool *SDUtilityPoolSession) FinalizeDelegatorWithdrawalRequest() (*types.Transaction, error) { + return _SDUtilityPool.Contract.FinalizeDelegatorWithdrawalRequest(&_SDUtilityPool.TransactOpts) +} + +// FinalizeDelegatorWithdrawalRequest is a paid mutator transaction binding the contract method 0x71898b4e. +// +// Solidity: function finalizeDelegatorWithdrawalRequest() returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) FinalizeDelegatorWithdrawalRequest() (*types.Transaction, error) { + return _SDUtilityPool.Contract.FinalizeDelegatorWithdrawalRequest(&_SDUtilityPool.TransactOpts) +} + +// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. +// +// Solidity: function grantRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) GrantRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "grantRole", role, account) +} + +// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. +// +// Solidity: function grantRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolSession) GrantRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.GrantRole(&_SDUtilityPool.TransactOpts, role, account) +} + +// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. +// +// Solidity: function grantRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) GrantRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.GrantRole(&_SDUtilityPool.TransactOpts, role, account) +} + +// Initialize is a paid mutator transaction binding the contract method 0x485cc955. +// +// Solidity: function initialize(address _admin, address _staderConfig) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) Initialize(opts *bind.TransactOpts, _admin common.Address, _staderConfig common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "initialize", _admin, _staderConfig) +} + +// Initialize is a paid mutator transaction binding the contract method 0x485cc955. +// +// Solidity: function initialize(address _admin, address _staderConfig) returns() +func (_SDUtilityPool *SDUtilityPoolSession) Initialize(_admin common.Address, _staderConfig common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Initialize(&_SDUtilityPool.TransactOpts, _admin, _staderConfig) +} + +// Initialize is a paid mutator transaction binding the contract method 0x485cc955. +// +// Solidity: function initialize(address _admin, address _staderConfig) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Initialize(_admin common.Address, _staderConfig common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Initialize(&_SDUtilityPool.TransactOpts, _admin, _staderConfig) +} + +// LiquidationCall is a paid mutator transaction binding the contract method 0xd2ac4a3d. +// +// Solidity: function liquidationCall(address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) LiquidationCall(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "liquidationCall", account) +} + +// LiquidationCall is a paid mutator transaction binding the contract method 0xd2ac4a3d. +// +// Solidity: function liquidationCall(address account) returns() +func (_SDUtilityPool *SDUtilityPoolSession) LiquidationCall(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.LiquidationCall(&_SDUtilityPool.TransactOpts, account) +} + +// LiquidationCall is a paid mutator transaction binding the contract method 0xd2ac4a3d. +// +// Solidity: function liquidationCall(address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) LiquidationCall(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.LiquidationCall(&_SDUtilityPool.TransactOpts, account) +} + +// MaxApproveSD is a paid mutator transaction binding the contract method 0x3e04cd35. +// +// Solidity: function maxApproveSD() returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) MaxApproveSD(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "maxApproveSD") +} + +// MaxApproveSD is a paid mutator transaction binding the contract method 0x3e04cd35. +// +// Solidity: function maxApproveSD() returns() +func (_SDUtilityPool *SDUtilityPoolSession) MaxApproveSD() (*types.Transaction, error) { + return _SDUtilityPool.Contract.MaxApproveSD(&_SDUtilityPool.TransactOpts) +} + +// MaxApproveSD is a paid mutator transaction binding the contract method 0x3e04cd35. +// +// Solidity: function maxApproveSD() returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) MaxApproveSD() (*types.Transaction, error) { + return _SDUtilityPool.Contract.MaxApproveSD(&_SDUtilityPool.TransactOpts) +} + +// Pause is a paid mutator transaction binding the contract method 0x8456cb59. +// +// Solidity: function pause() returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "pause") +} + +// Pause is a paid mutator transaction binding the contract method 0x8456cb59. +// +// Solidity: function pause() returns() +func (_SDUtilityPool *SDUtilityPoolSession) Pause() (*types.Transaction, error) { + return _SDUtilityPool.Contract.Pause(&_SDUtilityPool.TransactOpts) +} + +// Pause is a paid mutator transaction binding the contract method 0x8456cb59. +// +// Solidity: function pause() returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Pause() (*types.Transaction, error) { + return _SDUtilityPool.Contract.Pause(&_SDUtilityPool.TransactOpts) +} + +// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. +// +// Solidity: function renounceRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) RenounceRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "renounceRole", role, account) +} + +// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. +// +// Solidity: function renounceRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolSession) RenounceRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RenounceRole(&_SDUtilityPool.TransactOpts, role, account) +} + +// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. +// +// Solidity: function renounceRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) RenounceRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RenounceRole(&_SDUtilityPool.TransactOpts, role, account) +} + +// Repay is a paid mutator transaction binding the contract method 0x371fd8e6. +// +// Solidity: function repay(uint256 repayAmount) returns(uint256 repaidAmount, uint256 feePaid) +func (_SDUtilityPool *SDUtilityPoolTransactor) Repay(opts *bind.TransactOpts, repayAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "repay", repayAmount) +} + +// Repay is a paid mutator transaction binding the contract method 0x371fd8e6. +// +// Solidity: function repay(uint256 repayAmount) returns(uint256 repaidAmount, uint256 feePaid) +func (_SDUtilityPool *SDUtilityPoolSession) Repay(repayAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Repay(&_SDUtilityPool.TransactOpts, repayAmount) +} + +// Repay is a paid mutator transaction binding the contract method 0x371fd8e6. +// +// Solidity: function repay(uint256 repayAmount) returns(uint256 repaidAmount, uint256 feePaid) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Repay(repayAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Repay(&_SDUtilityPool.TransactOpts, repayAmount) +} + +// RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. +// +// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns(uint256 repaidAmount, uint256 feePaid) +func (_SDUtilityPool *SDUtilityPoolTransactor) RepayOnBehalf(opts *bind.TransactOpts, utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "repayOnBehalf", utilizer, repayAmount) +} + +// RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. +// +// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns(uint256 repaidAmount, uint256 feePaid) +func (_SDUtilityPool *SDUtilityPoolSession) RepayOnBehalf(utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RepayOnBehalf(&_SDUtilityPool.TransactOpts, utilizer, repayAmount) +} + +// RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. +// +// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns(uint256 repaidAmount, uint256 feePaid) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) RepayOnBehalf(utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RepayOnBehalf(&_SDUtilityPool.TransactOpts, utilizer, repayAmount) +} + +// RequestWithdraw is a paid mutator transaction binding the contract method 0x745400c9. +// +// Solidity: function requestWithdraw(uint256 _cTokenAmount) returns(uint256 _requestId) +func (_SDUtilityPool *SDUtilityPoolTransactor) RequestWithdraw(opts *bind.TransactOpts, _cTokenAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "requestWithdraw", _cTokenAmount) +} + +// RequestWithdraw is a paid mutator transaction binding the contract method 0x745400c9. +// +// Solidity: function requestWithdraw(uint256 _cTokenAmount) returns(uint256 _requestId) +func (_SDUtilityPool *SDUtilityPoolSession) RequestWithdraw(_cTokenAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RequestWithdraw(&_SDUtilityPool.TransactOpts, _cTokenAmount) +} + +// RequestWithdraw is a paid mutator transaction binding the contract method 0x745400c9. +// +// Solidity: function requestWithdraw(uint256 _cTokenAmount) returns(uint256 _requestId) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) RequestWithdraw(_cTokenAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RequestWithdraw(&_SDUtilityPool.TransactOpts, _cTokenAmount) +} + +// RequestWithdrawWithSDAmount is a paid mutator transaction binding the contract method 0xc51cd1cc. +// +// Solidity: function requestWithdrawWithSDAmount(uint256 _sdAmount) returns(uint256 _requestId) +func (_SDUtilityPool *SDUtilityPoolTransactor) RequestWithdrawWithSDAmount(opts *bind.TransactOpts, _sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "requestWithdrawWithSDAmount", _sdAmount) +} + +// RequestWithdrawWithSDAmount is a paid mutator transaction binding the contract method 0xc51cd1cc. +// +// Solidity: function requestWithdrawWithSDAmount(uint256 _sdAmount) returns(uint256 _requestId) +func (_SDUtilityPool *SDUtilityPoolSession) RequestWithdrawWithSDAmount(_sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RequestWithdrawWithSDAmount(&_SDUtilityPool.TransactOpts, _sdAmount) +} + +// RequestWithdrawWithSDAmount is a paid mutator transaction binding the contract method 0xc51cd1cc. +// +// Solidity: function requestWithdrawWithSDAmount(uint256 _sdAmount) returns(uint256 _requestId) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) RequestWithdrawWithSDAmount(_sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RequestWithdrawWithSDAmount(&_SDUtilityPool.TransactOpts, _sdAmount) +} + +// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. +// +// Solidity: function revokeRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) RevokeRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "revokeRole", role, account) +} + +// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. +// +// Solidity: function revokeRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolSession) RevokeRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RevokeRole(&_SDUtilityPool.TransactOpts, role, account) +} + +// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. +// +// Solidity: function revokeRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) RevokeRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RevokeRole(&_SDUtilityPool.TransactOpts, role, account) +} + +// Unpause is a paid mutator transaction binding the contract method 0x3f4ba83a. +// +// Solidity: function unpause() returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) Unpause(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "unpause") +} + +// Unpause is a paid mutator transaction binding the contract method 0x3f4ba83a. +// +// Solidity: function unpause() returns() +func (_SDUtilityPool *SDUtilityPoolSession) Unpause() (*types.Transaction, error) { + return _SDUtilityPool.Contract.Unpause(&_SDUtilityPool.TransactOpts) +} + +// Unpause is a paid mutator transaction binding the contract method 0x3f4ba83a. +// +// Solidity: function unpause() returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Unpause() (*types.Transaction, error) { + return _SDUtilityPool.Contract.Unpause(&_SDUtilityPool.TransactOpts) +} + +// UpdateConservativeEthPerKey is a paid mutator transaction binding the contract method 0x1c557f05. +// +// Solidity: function updateConservativeEthPerKey(uint256 _newEthPerKey) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateConservativeEthPerKey(opts *bind.TransactOpts, _newEthPerKey *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateConservativeEthPerKey", _newEthPerKey) +} + +// UpdateConservativeEthPerKey is a paid mutator transaction binding the contract method 0x1c557f05. +// +// Solidity: function updateConservativeEthPerKey(uint256 _newEthPerKey) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateConservativeEthPerKey(_newEthPerKey *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateConservativeEthPerKey(&_SDUtilityPool.TransactOpts, _newEthPerKey) +} + +// UpdateConservativeEthPerKey is a paid mutator transaction binding the contract method 0x1c557f05. +// +// Solidity: function updateConservativeEthPerKey(uint256 _newEthPerKey) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateConservativeEthPerKey(_newEthPerKey *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateConservativeEthPerKey(&_SDUtilityPool.TransactOpts, _newEthPerKey) +} + +// UpdateFinalizationBatchLimit is a paid mutator transaction binding the contract method 0x267fca73. +// +// Solidity: function updateFinalizationBatchLimit(uint256 _finalizationBatchLimit) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateFinalizationBatchLimit(opts *bind.TransactOpts, _finalizationBatchLimit *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateFinalizationBatchLimit", _finalizationBatchLimit) +} + +// UpdateFinalizationBatchLimit is a paid mutator transaction binding the contract method 0x267fca73. +// +// Solidity: function updateFinalizationBatchLimit(uint256 _finalizationBatchLimit) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateFinalizationBatchLimit(_finalizationBatchLimit *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateFinalizationBatchLimit(&_SDUtilityPool.TransactOpts, _finalizationBatchLimit) +} + +// UpdateFinalizationBatchLimit is a paid mutator transaction binding the contract method 0x267fca73. +// +// Solidity: function updateFinalizationBatchLimit(uint256 _finalizationBatchLimit) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateFinalizationBatchLimit(_finalizationBatchLimit *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateFinalizationBatchLimit(&_SDUtilityPool.TransactOpts, _finalizationBatchLimit) +} + +// UpdateMaxETHWorthOfSDPerValidator is a paid mutator transaction binding the contract method 0x5393618e. +// +// Solidity: function updateMaxETHWorthOfSDPerValidator(uint256 _maxETHWorthOfSDPerValidator) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateMaxETHWorthOfSDPerValidator(opts *bind.TransactOpts, _maxETHWorthOfSDPerValidator *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateMaxETHWorthOfSDPerValidator", _maxETHWorthOfSDPerValidator) +} + +// UpdateMaxETHWorthOfSDPerValidator is a paid mutator transaction binding the contract method 0x5393618e. +// +// Solidity: function updateMaxETHWorthOfSDPerValidator(uint256 _maxETHWorthOfSDPerValidator) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateMaxETHWorthOfSDPerValidator(_maxETHWorthOfSDPerValidator *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateMaxETHWorthOfSDPerValidator(&_SDUtilityPool.TransactOpts, _maxETHWorthOfSDPerValidator) +} + +// UpdateMaxETHWorthOfSDPerValidator is a paid mutator transaction binding the contract method 0x5393618e. +// +// Solidity: function updateMaxETHWorthOfSDPerValidator(uint256 _maxETHWorthOfSDPerValidator) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateMaxETHWorthOfSDPerValidator(_maxETHWorthOfSDPerValidator *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateMaxETHWorthOfSDPerValidator(&_SDUtilityPool.TransactOpts, _maxETHWorthOfSDPerValidator) +} + +// UpdateMaxNonRedeemedDelegatorRequestCount is a paid mutator transaction binding the contract method 0xee63e5f9. +// +// Solidity: function updateMaxNonRedeemedDelegatorRequestCount(uint256 _count) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateMaxNonRedeemedDelegatorRequestCount(opts *bind.TransactOpts, _count *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateMaxNonRedeemedDelegatorRequestCount", _count) +} + +// UpdateMaxNonRedeemedDelegatorRequestCount is a paid mutator transaction binding the contract method 0xee63e5f9. +// +// Solidity: function updateMaxNonRedeemedDelegatorRequestCount(uint256 _count) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateMaxNonRedeemedDelegatorRequestCount(_count *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateMaxNonRedeemedDelegatorRequestCount(&_SDUtilityPool.TransactOpts, _count) +} + +// UpdateMaxNonRedeemedDelegatorRequestCount is a paid mutator transaction binding the contract method 0xee63e5f9. +// +// Solidity: function updateMaxNonRedeemedDelegatorRequestCount(uint256 _count) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateMaxNonRedeemedDelegatorRequestCount(_count *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateMaxNonRedeemedDelegatorRequestCount(&_SDUtilityPool.TransactOpts, _count) +} + +// UpdateMinBlockDelayToFinalizeRequest is a paid mutator transaction binding the contract method 0x4a2965af. +// +// Solidity: function updateMinBlockDelayToFinalizeRequest(uint256 _minBlockDelayToFinalizeRequest) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateMinBlockDelayToFinalizeRequest(opts *bind.TransactOpts, _minBlockDelayToFinalizeRequest *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateMinBlockDelayToFinalizeRequest", _minBlockDelayToFinalizeRequest) +} + +// UpdateMinBlockDelayToFinalizeRequest is a paid mutator transaction binding the contract method 0x4a2965af. +// +// Solidity: function updateMinBlockDelayToFinalizeRequest(uint256 _minBlockDelayToFinalizeRequest) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateMinBlockDelayToFinalizeRequest(_minBlockDelayToFinalizeRequest *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateMinBlockDelayToFinalizeRequest(&_SDUtilityPool.TransactOpts, _minBlockDelayToFinalizeRequest) +} + +// UpdateMinBlockDelayToFinalizeRequest is a paid mutator transaction binding the contract method 0x4a2965af. +// +// Solidity: function updateMinBlockDelayToFinalizeRequest(uint256 _minBlockDelayToFinalizeRequest) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateMinBlockDelayToFinalizeRequest(_minBlockDelayToFinalizeRequest *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateMinBlockDelayToFinalizeRequest(&_SDUtilityPool.TransactOpts, _minBlockDelayToFinalizeRequest) +} + +// UpdateProtocolFee is a paid mutator transaction binding the contract method 0x4256dd78. +// +// Solidity: function updateProtocolFee(uint256 _protocolFee) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateProtocolFee(opts *bind.TransactOpts, _protocolFee *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateProtocolFee", _protocolFee) +} + +// UpdateProtocolFee is a paid mutator transaction binding the contract method 0x4256dd78. +// +// Solidity: function updateProtocolFee(uint256 _protocolFee) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateProtocolFee(_protocolFee *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateProtocolFee(&_SDUtilityPool.TransactOpts, _protocolFee) +} + +// UpdateProtocolFee is a paid mutator transaction binding the contract method 0x4256dd78. +// +// Solidity: function updateProtocolFee(uint256 _protocolFee) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateProtocolFee(_protocolFee *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateProtocolFee(&_SDUtilityPool.TransactOpts, _protocolFee) +} + +// UpdateRiskConfig is a paid mutator transaction binding the contract method 0x62569a51. +// +// Solidity: function updateRiskConfig(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateRiskConfig(opts *bind.TransactOpts, liquidationThreshold *big.Int, liquidationBonusPercent *big.Int, liquidationFeePercent *big.Int, ltv *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateRiskConfig", liquidationThreshold, liquidationBonusPercent, liquidationFeePercent, ltv) +} + +// UpdateRiskConfig is a paid mutator transaction binding the contract method 0x62569a51. +// +// Solidity: function updateRiskConfig(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateRiskConfig(liquidationThreshold *big.Int, liquidationBonusPercent *big.Int, liquidationFeePercent *big.Int, ltv *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateRiskConfig(&_SDUtilityPool.TransactOpts, liquidationThreshold, liquidationBonusPercent, liquidationFeePercent, ltv) +} + +// UpdateRiskConfig is a paid mutator transaction binding the contract method 0x62569a51. +// +// Solidity: function updateRiskConfig(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateRiskConfig(liquidationThreshold *big.Int, liquidationBonusPercent *big.Int, liquidationFeePercent *big.Int, ltv *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateRiskConfig(&_SDUtilityPool.TransactOpts, liquidationThreshold, liquidationBonusPercent, liquidationFeePercent, ltv) +} + +// UpdateStaderConfig is a paid mutator transaction binding the contract method 0x9ee804cb. // // Solidity: function updateStaderConfig(address _staderConfig) returns() func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateStaderConfig(opts *bind.TransactOpts, _staderConfig common.Address) (*types.Transaction, error) { return _SDUtilityPool.contract.Transact(opts, "updateStaderConfig", _staderConfig) } -// UpdateStaderConfig is a paid mutator transaction binding the contract method 0x9ee804cb. +// UpdateStaderConfig is a paid mutator transaction binding the contract method 0x9ee804cb. +// +// Solidity: function updateStaderConfig(address _staderConfig) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateStaderConfig(_staderConfig common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateStaderConfig(&_SDUtilityPool.TransactOpts, _staderConfig) +} + +// UpdateStaderConfig is a paid mutator transaction binding the contract method 0x9ee804cb. +// +// Solidity: function updateStaderConfig(address _staderConfig) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateStaderConfig(_staderConfig common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateStaderConfig(&_SDUtilityPool.TransactOpts, _staderConfig) +} + +// UpdateUtilizationRatePerBlock is a paid mutator transaction binding the contract method 0xcb2d89dd. +// +// Solidity: function updateUtilizationRatePerBlock(uint256 _utilizationRatePerBlock) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateUtilizationRatePerBlock(opts *bind.TransactOpts, _utilizationRatePerBlock *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateUtilizationRatePerBlock", _utilizationRatePerBlock) +} + +// UpdateUtilizationRatePerBlock is a paid mutator transaction binding the contract method 0xcb2d89dd. +// +// Solidity: function updateUtilizationRatePerBlock(uint256 _utilizationRatePerBlock) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateUtilizationRatePerBlock(_utilizationRatePerBlock *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateUtilizationRatePerBlock(&_SDUtilityPool.TransactOpts, _utilizationRatePerBlock) +} + +// UpdateUtilizationRatePerBlock is a paid mutator transaction binding the contract method 0xcb2d89dd. +// +// Solidity: function updateUtilizationRatePerBlock(uint256 _utilizationRatePerBlock) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateUtilizationRatePerBlock(_utilizationRatePerBlock *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateUtilizationRatePerBlock(&_SDUtilityPool.TransactOpts, _utilizationRatePerBlock) +} + +// Utilize is a paid mutator transaction binding the contract method 0xec29c551. +// +// Solidity: function utilize(uint256 utilizeAmount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) Utilize(opts *bind.TransactOpts, utilizeAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "utilize", utilizeAmount) +} + +// Utilize is a paid mutator transaction binding the contract method 0xec29c551. +// +// Solidity: function utilize(uint256 utilizeAmount) returns() +func (_SDUtilityPool *SDUtilityPoolSession) Utilize(utilizeAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Utilize(&_SDUtilityPool.TransactOpts, utilizeAmount) +} + +// Utilize is a paid mutator transaction binding the contract method 0xec29c551. +// +// Solidity: function utilize(uint256 utilizeAmount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Utilize(utilizeAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Utilize(&_SDUtilityPool.TransactOpts, utilizeAmount) +} + +// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. +// +// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UtilizeWhileAddingKeys(opts *bind.TransactOpts, operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "utilizeWhileAddingKeys", operator, utilizeAmount, nonTerminalKeyCount) +} + +// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. +// +// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UtilizeWhileAddingKeys(operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UtilizeWhileAddingKeys(&_SDUtilityPool.TransactOpts, operator, utilizeAmount, nonTerminalKeyCount) +} + +// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. +// +// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UtilizeWhileAddingKeys(operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UtilizeWhileAddingKeys(&_SDUtilityPool.TransactOpts, operator, utilizeAmount, nonTerminalKeyCount) +} + +// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. +// +// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactor) UtilizerBalanceCurrent(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "utilizerBalanceCurrent", account) +} + +// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. +// +// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) UtilizerBalanceCurrent(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UtilizerBalanceCurrent(&_SDUtilityPool.TransactOpts, account) +} + +// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. +// +// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UtilizerBalanceCurrent(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UtilizerBalanceCurrent(&_SDUtilityPool.TransactOpts, account) +} + +// WithdrawProtocolFee is a paid mutator transaction binding the contract method 0x424cd833. +// +// Solidity: function withdrawProtocolFee(uint256 _amount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) WithdrawProtocolFee(opts *bind.TransactOpts, _amount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "withdrawProtocolFee", _amount) +} + +// WithdrawProtocolFee is a paid mutator transaction binding the contract method 0x424cd833. +// +// Solidity: function withdrawProtocolFee(uint256 _amount) returns() +func (_SDUtilityPool *SDUtilityPoolSession) WithdrawProtocolFee(_amount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.WithdrawProtocolFee(&_SDUtilityPool.TransactOpts, _amount) +} + +// WithdrawProtocolFee is a paid mutator transaction binding the contract method 0x424cd833. +// +// Solidity: function withdrawProtocolFee(uint256 _amount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) WithdrawProtocolFee(_amount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.WithdrawProtocolFee(&_SDUtilityPool.TransactOpts, _amount) +} + +// SDUtilityPoolAccruedFeesIterator is returned from FilterAccruedFees and is used to iterate over the raw logs and unpacked data for AccruedFees events raised by the SDUtilityPool contract. +type SDUtilityPoolAccruedFeesIterator struct { + Event *SDUtilityPoolAccruedFees // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolAccruedFeesIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolAccruedFees) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolAccruedFees) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolAccruedFeesIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolAccruedFeesIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolAccruedFees represents a AccruedFees event raised by the SDUtilityPool contract. +type SDUtilityPoolAccruedFees struct { + FeeAccumulated *big.Int + TotalProtocolFee *big.Int + TotalUtilizedSD *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterAccruedFees is a free log retrieval operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. +// +// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterAccruedFees(opts *bind.FilterOpts) (*SDUtilityPoolAccruedFeesIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "AccruedFees") + if err != nil { + return nil, err + } + return &SDUtilityPoolAccruedFeesIterator{contract: _SDUtilityPool.contract, event: "AccruedFees", logs: logs, sub: sub}, nil +} + +// WatchAccruedFees is a free log subscription operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. +// +// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchAccruedFees(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolAccruedFees) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "AccruedFees") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolAccruedFees) + if err := _SDUtilityPool.contract.UnpackLog(event, "AccruedFees", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseAccruedFees is a log parse operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. +// +// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseAccruedFees(log types.Log) (*SDUtilityPoolAccruedFees, error) { + event := new(SDUtilityPoolAccruedFees) + if err := _SDUtilityPool.contract.UnpackLog(event, "AccruedFees", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolCompleteLiquidationIterator is returned from FilterCompleteLiquidation and is used to iterate over the raw logs and unpacked data for CompleteLiquidation events raised by the SDUtilityPool contract. +type SDUtilityPoolCompleteLiquidationIterator struct { + Event *SDUtilityPoolCompleteLiquidation // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolCompleteLiquidationIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolCompleteLiquidation) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolCompleteLiquidation) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolCompleteLiquidationIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolCompleteLiquidationIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolCompleteLiquidation represents a CompleteLiquidation event raised by the SDUtilityPool contract. +type SDUtilityPoolCompleteLiquidation struct { + Index *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterCompleteLiquidation is a free log retrieval operation binding the contract event 0x2f0c36e8e230af6ceee7ecc30319e10800731fef4913c80afcf23f84b148df5d. +// +// Solidity: event CompleteLiquidation(uint256 indexed index) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterCompleteLiquidation(opts *bind.FilterOpts, index []*big.Int) (*SDUtilityPoolCompleteLiquidationIterator, error) { + + var indexRule []interface{} + for _, indexItem := range index { + indexRule = append(indexRule, indexItem) + } + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "CompleteLiquidation", indexRule) + if err != nil { + return nil, err + } + return &SDUtilityPoolCompleteLiquidationIterator{contract: _SDUtilityPool.contract, event: "CompleteLiquidation", logs: logs, sub: sub}, nil +} + +// WatchCompleteLiquidation is a free log subscription operation binding the contract event 0x2f0c36e8e230af6ceee7ecc30319e10800731fef4913c80afcf23f84b148df5d. +// +// Solidity: event CompleteLiquidation(uint256 indexed index) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchCompleteLiquidation(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolCompleteLiquidation, index []*big.Int) (event.Subscription, error) { + + var indexRule []interface{} + for _, indexItem := range index { + indexRule = append(indexRule, indexItem) + } + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "CompleteLiquidation", indexRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolCompleteLiquidation) + if err := _SDUtilityPool.contract.UnpackLog(event, "CompleteLiquidation", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseCompleteLiquidation is a log parse operation binding the contract event 0x2f0c36e8e230af6ceee7ecc30319e10800731fef4913c80afcf23f84b148df5d. +// +// Solidity: event CompleteLiquidation(uint256 indexed index) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseCompleteLiquidation(log types.Log) (*SDUtilityPoolCompleteLiquidation, error) { + event := new(SDUtilityPoolCompleteLiquidation) + if err := _SDUtilityPool.contract.UnpackLog(event, "CompleteLiquidation", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolDelegatedIterator is returned from FilterDelegated and is used to iterate over the raw logs and unpacked data for Delegated events raised by the SDUtilityPool contract. +type SDUtilityPoolDelegatedIterator struct { + Event *SDUtilityPoolDelegated // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolDelegatedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolDelegated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolDelegated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolDelegatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolDelegatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolDelegated represents a Delegated event raised by the SDUtilityPool contract. +type SDUtilityPoolDelegated struct { + Delegator common.Address + SdAmount *big.Int + SdXToMint *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterDelegated is a free log retrieval operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// +// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterDelegated(opts *bind.FilterOpts, delegator []common.Address) (*SDUtilityPoolDelegatedIterator, error) { + + var delegatorRule []interface{} + for _, delegatorItem := range delegator { + delegatorRule = append(delegatorRule, delegatorItem) + } + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Delegated", delegatorRule) + if err != nil { + return nil, err + } + return &SDUtilityPoolDelegatedIterator{contract: _SDUtilityPool.contract, event: "Delegated", logs: logs, sub: sub}, nil +} + +// WatchDelegated is a free log subscription operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// +// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchDelegated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolDelegated, delegator []common.Address) (event.Subscription, error) { + + var delegatorRule []interface{} + for _, delegatorItem := range delegator { + delegatorRule = append(delegatorRule, delegatorItem) + } + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Delegated", delegatorRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolDelegated) + if err := _SDUtilityPool.contract.UnpackLog(event, "Delegated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseDelegated is a log parse operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// +// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseDelegated(log types.Log) (*SDUtilityPoolDelegated, error) { + event := new(SDUtilityPoolDelegated) + if err := _SDUtilityPool.contract.UnpackLog(event, "Delegated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolFinalizedWithdrawRequestIterator is returned from FilterFinalizedWithdrawRequest and is used to iterate over the raw logs and unpacked data for FinalizedWithdrawRequest events raised by the SDUtilityPool contract. +type SDUtilityPoolFinalizedWithdrawRequestIterator struct { + Event *SDUtilityPoolFinalizedWithdrawRequest // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolFinalizedWithdrawRequest) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolFinalizedWithdrawRequest) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolFinalizedWithdrawRequest represents a FinalizedWithdrawRequest event raised by the SDUtilityPool contract. +type SDUtilityPoolFinalizedWithdrawRequest struct { + NextRequestIdToFinalize *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterFinalizedWithdrawRequest is a free log retrieval operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. // -// Solidity: function updateStaderConfig(address _staderConfig) returns() -func (_SDUtilityPool *SDUtilityPoolSession) UpdateStaderConfig(_staderConfig common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateStaderConfig(&_SDUtilityPool.TransactOpts, _staderConfig) +// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterFinalizedWithdrawRequest(opts *bind.FilterOpts) (*SDUtilityPoolFinalizedWithdrawRequestIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "FinalizedWithdrawRequest") + if err != nil { + return nil, err + } + return &SDUtilityPoolFinalizedWithdrawRequestIterator{contract: _SDUtilityPool.contract, event: "FinalizedWithdrawRequest", logs: logs, sub: sub}, nil } -// UpdateStaderConfig is a paid mutator transaction binding the contract method 0x9ee804cb. +// WatchFinalizedWithdrawRequest is a free log subscription operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. // -// Solidity: function updateStaderConfig(address _staderConfig) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateStaderConfig(_staderConfig common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateStaderConfig(&_SDUtilityPool.TransactOpts, _staderConfig) +// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchFinalizedWithdrawRequest(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolFinalizedWithdrawRequest) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "FinalizedWithdrawRequest") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolFinalizedWithdrawRequest) + if err := _SDUtilityPool.contract.UnpackLog(event, "FinalizedWithdrawRequest", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseFinalizedWithdrawRequest is a log parse operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. +// +// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseFinalizedWithdrawRequest(log types.Log) (*SDUtilityPoolFinalizedWithdrawRequest, error) { + event := new(SDUtilityPoolFinalizedWithdrawRequest) + if err := _SDUtilityPool.contract.UnpackLog(event, "FinalizedWithdrawRequest", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the SDUtilityPool contract. +type SDUtilityPoolInitializedIterator struct { + Event *SDUtilityPoolInitialized // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolInitializedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolInitialized) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolInitialized) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolInitializedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolInitializedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolInitialized represents a Initialized event raised by the SDUtilityPool contract. +type SDUtilityPoolInitialized struct { + Version uint8 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterInitialized is a free log retrieval operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterInitialized(opts *bind.FilterOpts) (*SDUtilityPoolInitializedIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Initialized") + if err != nil { + return nil, err + } + return &SDUtilityPoolInitializedIterator{contract: _SDUtilityPool.contract, event: "Initialized", logs: logs, sub: sub}, nil +} + +// WatchInitialized is a free log subscription operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolInitialized) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Initialized") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolInitialized) + if err := _SDUtilityPool.contract.UnpackLog(event, "Initialized", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseInitialized is a log parse operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseInitialized(log types.Log) (*SDUtilityPoolInitialized, error) { + event := new(SDUtilityPoolInitialized) + if err := _SDUtilityPool.contract.UnpackLog(event, "Initialized", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolLiquidationCallIterator is returned from FilterLiquidationCall and is used to iterate over the raw logs and unpacked data for LiquidationCall events raised by the SDUtilityPool contract. +type SDUtilityPoolLiquidationCallIterator struct { + Event *SDUtilityPoolLiquidationCall // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration } -// UpdateUtilizationRatePerBlock is a paid mutator transaction binding the contract method 0xcb2d89dd. -// -// Solidity: function updateUtilizationRatePerBlock(uint256 _utilizationRatePerBlock) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateUtilizationRatePerBlock(opts *bind.TransactOpts, _utilizationRatePerBlock *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "updateUtilizationRatePerBlock", _utilizationRatePerBlock) -} +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolLiquidationCallIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolLiquidationCall) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolLiquidationCall) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true -// UpdateUtilizationRatePerBlock is a paid mutator transaction binding the contract method 0xcb2d89dd. -// -// Solidity: function updateUtilizationRatePerBlock(uint256 _utilizationRatePerBlock) returns() -func (_SDUtilityPool *SDUtilityPoolSession) UpdateUtilizationRatePerBlock(_utilizationRatePerBlock *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateUtilizationRatePerBlock(&_SDUtilityPool.TransactOpts, _utilizationRatePerBlock) + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } } -// UpdateUtilizationRatePerBlock is a paid mutator transaction binding the contract method 0xcb2d89dd. -// -// Solidity: function updateUtilizationRatePerBlock(uint256 _utilizationRatePerBlock) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateUtilizationRatePerBlock(_utilizationRatePerBlock *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateUtilizationRatePerBlock(&_SDUtilityPool.TransactOpts, _utilizationRatePerBlock) +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolLiquidationCallIterator) Error() error { + return it.fail } -// Utilize is a paid mutator transaction binding the contract method 0xec29c551. -// -// Solidity: function utilize(uint256 utilizeAmount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) Utilize(opts *bind.TransactOpts, utilizeAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "utilize", utilizeAmount) +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolLiquidationCallIterator) Close() error { + it.sub.Unsubscribe() + return nil } -// Utilize is a paid mutator transaction binding the contract method 0xec29c551. -// -// Solidity: function utilize(uint256 utilizeAmount) returns() -func (_SDUtilityPool *SDUtilityPoolSession) Utilize(utilizeAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Utilize(&_SDUtilityPool.TransactOpts, utilizeAmount) +// SDUtilityPoolLiquidationCall represents a LiquidationCall event raised by the SDUtilityPool contract. +type SDUtilityPoolLiquidationCall struct { + Account common.Address + TotalLiquidationAmountInEth *big.Int + LiquidationBonusInEth *big.Int + LiquidationFeeInEth *big.Int + Liquidator common.Address + Raw types.Log // Blockchain specific contextual infos } -// Utilize is a paid mutator transaction binding the contract method 0xec29c551. +// FilterLiquidationCall is a free log retrieval operation binding the contract event 0xcc9de8be9ac1f02b70a8ca2612f451a769d6d160ad91de17dcc38e54c567a532. // -// Solidity: function utilize(uint256 utilizeAmount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) Utilize(utilizeAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Utilize(&_SDUtilityPool.TransactOpts, utilizeAmount) -} +// Solidity: event LiquidationCall(address indexed account, uint256 totalLiquidationAmountInEth, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth, address indexed liquidator) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterLiquidationCall(opts *bind.FilterOpts, account []common.Address, liquidator []common.Address) (*SDUtilityPoolLiquidationCallIterator, error) { -// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. -// -// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) UtilizeWhileAddingKeys(opts *bind.TransactOpts, operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "utilizeWhileAddingKeys", operator, utilizeAmount, nonTerminalKeyCount) -} + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } -// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. -// -// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() -func (_SDUtilityPool *SDUtilityPoolSession) UtilizeWhileAddingKeys(operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UtilizeWhileAddingKeys(&_SDUtilityPool.TransactOpts, operator, utilizeAmount, nonTerminalKeyCount) -} + var liquidatorRule []interface{} + for _, liquidatorItem := range liquidator { + liquidatorRule = append(liquidatorRule, liquidatorItem) + } -// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. -// -// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UtilizeWhileAddingKeys(operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UtilizeWhileAddingKeys(&_SDUtilityPool.TransactOpts, operator, utilizeAmount, nonTerminalKeyCount) + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "LiquidationCall", accountRule, liquidatorRule) + if err != nil { + return nil, err + } + return &SDUtilityPoolLiquidationCallIterator{contract: _SDUtilityPool.contract, event: "LiquidationCall", logs: logs, sub: sub}, nil } -// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. +// WatchLiquidationCall is a free log subscription operation binding the contract event 0xcc9de8be9ac1f02b70a8ca2612f451a769d6d160ad91de17dcc38e54c567a532. // -// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactor) UtilizerBalanceCurrent(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "utilizerBalanceCurrent", account) -} +// Solidity: event LiquidationCall(address indexed account, uint256 totalLiquidationAmountInEth, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth, address indexed liquidator) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchLiquidationCall(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolLiquidationCall, account []common.Address, liquidator []common.Address) (event.Subscription, error) { -// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. -// -// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) UtilizerBalanceCurrent(account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UtilizerBalanceCurrent(&_SDUtilityPool.TransactOpts, account) -} + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } -// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. -// -// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UtilizerBalanceCurrent(account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UtilizerBalanceCurrent(&_SDUtilityPool.TransactOpts, account) -} + var liquidatorRule []interface{} + for _, liquidatorItem := range liquidator { + liquidatorRule = append(liquidatorRule, liquidatorItem) + } -// WithdrawProtocolFee is a paid mutator transaction binding the contract method 0x424cd833. -// -// Solidity: function withdrawProtocolFee(uint256 _amount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) WithdrawProtocolFee(opts *bind.TransactOpts, _amount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "withdrawProtocolFee", _amount) -} + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "LiquidationCall", accountRule, liquidatorRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolLiquidationCall) + if err := _SDUtilityPool.contract.UnpackLog(event, "LiquidationCall", log); err != nil { + return err + } + event.Raw = log -// WithdrawProtocolFee is a paid mutator transaction binding the contract method 0x424cd833. -// -// Solidity: function withdrawProtocolFee(uint256 _amount) returns() -func (_SDUtilityPool *SDUtilityPoolSession) WithdrawProtocolFee(_amount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.WithdrawProtocolFee(&_SDUtilityPool.TransactOpts, _amount) + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil } -// WithdrawProtocolFee is a paid mutator transaction binding the contract method 0x424cd833. +// ParseLiquidationCall is a log parse operation binding the contract event 0xcc9de8be9ac1f02b70a8ca2612f451a769d6d160ad91de17dcc38e54c567a532. // -// Solidity: function withdrawProtocolFee(uint256 _amount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) WithdrawProtocolFee(_amount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.WithdrawProtocolFee(&_SDUtilityPool.TransactOpts, _amount) +// Solidity: event LiquidationCall(address indexed account, uint256 totalLiquidationAmountInEth, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth, address indexed liquidator) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseLiquidationCall(log types.Log) (*SDUtilityPoolLiquidationCall, error) { + event := new(SDUtilityPoolLiquidationCall) + if err := _SDUtilityPool.contract.UnpackLog(event, "LiquidationCall", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil } -// SDUtilityPoolAccruedFeesIterator is returned from FilterAccruedFees and is used to iterate over the raw logs and unpacked data for AccruedFees events raised by the SDUtilityPool contract. -type SDUtilityPoolAccruedFeesIterator struct { - Event *SDUtilityPoolAccruedFees // Event containing the contract specifics and raw log +// SDUtilityPoolPausedIterator is returned from FilterPaused and is used to iterate over the raw logs and unpacked data for Paused events raised by the SDUtilityPool contract. +type SDUtilityPoolPausedIterator struct { + Event *SDUtilityPoolPaused // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1381,7 +3213,7 @@ type SDUtilityPoolAccruedFeesIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolAccruedFeesIterator) Next() bool { +func (it *SDUtilityPoolPausedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1390,7 +3222,7 @@ func (it *SDUtilityPoolAccruedFeesIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolAccruedFees) + it.Event = new(SDUtilityPoolPaused) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1405,7 +3237,7 @@ func (it *SDUtilityPoolAccruedFeesIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolAccruedFees) + it.Event = new(SDUtilityPoolPaused) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1421,43 +3253,41 @@ func (it *SDUtilityPoolAccruedFeesIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolAccruedFeesIterator) Error() error { +func (it *SDUtilityPoolPausedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolAccruedFeesIterator) Close() error { +func (it *SDUtilityPoolPausedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolAccruedFees represents a AccruedFees event raised by the SDUtilityPool contract. -type SDUtilityPoolAccruedFees struct { - FeeAccumulated *big.Int - TotalProtocolFee *big.Int - TotalUtilizedSD *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolPaused represents a Paused event raised by the SDUtilityPool contract. +type SDUtilityPoolPaused struct { + Account common.Address + Raw types.Log // Blockchain specific contextual infos } -// FilterAccruedFees is a free log retrieval operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. +// FilterPaused is a free log retrieval operation binding the contract event 0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258. // -// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterAccruedFees(opts *bind.FilterOpts) (*SDUtilityPoolAccruedFeesIterator, error) { +// Solidity: event Paused(address account) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterPaused(opts *bind.FilterOpts) (*SDUtilityPoolPausedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "AccruedFees") + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Paused") if err != nil { return nil, err } - return &SDUtilityPoolAccruedFeesIterator{contract: _SDUtilityPool.contract, event: "AccruedFees", logs: logs, sub: sub}, nil + return &SDUtilityPoolPausedIterator{contract: _SDUtilityPool.contract, event: "Paused", logs: logs, sub: sub}, nil } -// WatchAccruedFees is a free log subscription operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. +// WatchPaused is a free log subscription operation binding the contract event 0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258. // -// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchAccruedFees(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolAccruedFees) (event.Subscription, error) { +// Solidity: event Paused(address account) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchPaused(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolPaused) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "AccruedFees") + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Paused") if err != nil { return nil, err } @@ -1467,8 +3297,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchAccruedFees(opts *bind.WatchOp select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolAccruedFees) - if err := _SDUtilityPool.contract.UnpackLog(event, "AccruedFees", log); err != nil { + event := new(SDUtilityPoolPaused) + if err := _SDUtilityPool.contract.UnpackLog(event, "Paused", log); err != nil { return err } event.Raw = log @@ -1489,21 +3319,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchAccruedFees(opts *bind.WatchOp }), nil } -// ParseAccruedFees is a log parse operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. +// ParsePaused is a log parse operation binding the contract event 0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258. // -// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseAccruedFees(log types.Log) (*SDUtilityPoolAccruedFees, error) { - event := new(SDUtilityPoolAccruedFees) - if err := _SDUtilityPool.contract.UnpackLog(event, "AccruedFees", log); err != nil { +// Solidity: event Paused(address account) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParsePaused(log types.Log) (*SDUtilityPoolPaused, error) { + event := new(SDUtilityPoolPaused) + if err := _SDUtilityPool.contract.UnpackLog(event, "Paused", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolCompleteLiquidationIterator is returned from FilterCompleteLiquidation and is used to iterate over the raw logs and unpacked data for CompleteLiquidation events raised by the SDUtilityPool contract. -type SDUtilityPoolCompleteLiquidationIterator struct { - Event *SDUtilityPoolCompleteLiquidation // Event containing the contract specifics and raw log +// SDUtilityPoolProtocolFeeFactorUpdatedIterator is returned from FilterProtocolFeeFactorUpdated and is used to iterate over the raw logs and unpacked data for ProtocolFeeFactorUpdated events raised by the SDUtilityPool contract. +type SDUtilityPoolProtocolFeeFactorUpdatedIterator struct { + Event *SDUtilityPoolProtocolFeeFactorUpdated // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1517,7 +3347,7 @@ type SDUtilityPoolCompleteLiquidationIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolCompleteLiquidationIterator) Next() bool { +func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1526,7 +3356,7 @@ func (it *SDUtilityPoolCompleteLiquidationIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolCompleteLiquidation) + it.Event = new(SDUtilityPoolProtocolFeeFactorUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1541,7 +3371,7 @@ func (it *SDUtilityPoolCompleteLiquidationIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolCompleteLiquidation) + it.Event = new(SDUtilityPoolProtocolFeeFactorUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1557,51 +3387,41 @@ func (it *SDUtilityPoolCompleteLiquidationIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolCompleteLiquidationIterator) Error() error { +func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolCompleteLiquidationIterator) Close() error { +func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolCompleteLiquidation represents a CompleteLiquidation event raised by the SDUtilityPool contract. -type SDUtilityPoolCompleteLiquidation struct { - Index *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolProtocolFeeFactorUpdated represents a ProtocolFeeFactorUpdated event raised by the SDUtilityPool contract. +type SDUtilityPoolProtocolFeeFactorUpdated struct { + ProtocolFeeFactor *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterCompleteLiquidation is a free log retrieval operation binding the contract event 0x2f0c36e8e230af6ceee7ecc30319e10800731fef4913c80afcf23f84b148df5d. +// FilterProtocolFeeFactorUpdated is a free log retrieval operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. // -// Solidity: event CompleteLiquidation(uint256 indexed index) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterCompleteLiquidation(opts *bind.FilterOpts, index []*big.Int) (*SDUtilityPoolCompleteLiquidationIterator, error) { - - var indexRule []interface{} - for _, indexItem := range index { - indexRule = append(indexRule, indexItem) - } +// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterProtocolFeeFactorUpdated(opts *bind.FilterOpts) (*SDUtilityPoolProtocolFeeFactorUpdatedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "CompleteLiquidation", indexRule) + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "ProtocolFeeFactorUpdated") if err != nil { return nil, err } - return &SDUtilityPoolCompleteLiquidationIterator{contract: _SDUtilityPool.contract, event: "CompleteLiquidation", logs: logs, sub: sub}, nil + return &SDUtilityPoolProtocolFeeFactorUpdatedIterator{contract: _SDUtilityPool.contract, event: "ProtocolFeeFactorUpdated", logs: logs, sub: sub}, nil } -// WatchCompleteLiquidation is a free log subscription operation binding the contract event 0x2f0c36e8e230af6ceee7ecc30319e10800731fef4913c80afcf23f84b148df5d. +// WatchProtocolFeeFactorUpdated is a free log subscription operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. // -// Solidity: event CompleteLiquidation(uint256 indexed index) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchCompleteLiquidation(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolCompleteLiquidation, index []*big.Int) (event.Subscription, error) { - - var indexRule []interface{} - for _, indexItem := range index { - indexRule = append(indexRule, indexItem) - } +// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchProtocolFeeFactorUpdated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolProtocolFeeFactorUpdated) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "CompleteLiquidation", indexRule) + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "ProtocolFeeFactorUpdated") if err != nil { return nil, err } @@ -1611,8 +3431,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchCompleteLiquidation(opts *bind select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolCompleteLiquidation) - if err := _SDUtilityPool.contract.UnpackLog(event, "CompleteLiquidation", log); err != nil { + event := new(SDUtilityPoolProtocolFeeFactorUpdated) + if err := _SDUtilityPool.contract.UnpackLog(event, "ProtocolFeeFactorUpdated", log); err != nil { return err } event.Raw = log @@ -1633,21 +3453,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchCompleteLiquidation(opts *bind }), nil } -// ParseCompleteLiquidation is a log parse operation binding the contract event 0x2f0c36e8e230af6ceee7ecc30319e10800731fef4913c80afcf23f84b148df5d. +// ParseProtocolFeeFactorUpdated is a log parse operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. // -// Solidity: event CompleteLiquidation(uint256 indexed index) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseCompleteLiquidation(log types.Log) (*SDUtilityPoolCompleteLiquidation, error) { - event := new(SDUtilityPoolCompleteLiquidation) - if err := _SDUtilityPool.contract.UnpackLog(event, "CompleteLiquidation", log); err != nil { +// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseProtocolFeeFactorUpdated(log types.Log) (*SDUtilityPoolProtocolFeeFactorUpdated, error) { + event := new(SDUtilityPoolProtocolFeeFactorUpdated) + if err := _SDUtilityPool.contract.UnpackLog(event, "ProtocolFeeFactorUpdated", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolDelegatedIterator is returned from FilterDelegated and is used to iterate over the raw logs and unpacked data for Delegated events raised by the SDUtilityPool contract. -type SDUtilityPoolDelegatedIterator struct { - Event *SDUtilityPoolDelegated // Event containing the contract specifics and raw log +// SDUtilityPoolRedeemedIterator is returned from FilterRedeemed and is used to iterate over the raw logs and unpacked data for Redeemed events raised by the SDUtilityPool contract. +type SDUtilityPoolRedeemedIterator struct { + Event *SDUtilityPoolRedeemed // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1661,7 +3481,7 @@ type SDUtilityPoolDelegatedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolDelegatedIterator) Next() bool { +func (it *SDUtilityPoolRedeemedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1670,7 +3490,7 @@ func (it *SDUtilityPoolDelegatedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolDelegated) + it.Event = new(SDUtilityPoolRedeemed) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1685,7 +3505,7 @@ func (it *SDUtilityPoolDelegatedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolDelegated) + it.Event = new(SDUtilityPoolRedeemed) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1701,53 +3521,53 @@ func (it *SDUtilityPoolDelegatedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolDelegatedIterator) Error() error { +func (it *SDUtilityPoolRedeemedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolDelegatedIterator) Close() error { +func (it *SDUtilityPoolRedeemedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolDelegated represents a Delegated event raised by the SDUtilityPool contract. -type SDUtilityPoolDelegated struct { +// SDUtilityPoolRedeemed represents a Redeemed event raised by the SDUtilityPool contract. +type SDUtilityPoolRedeemed struct { Delegator common.Address SdAmount *big.Int - SdXToMint *big.Int + SdXAmount *big.Int Raw types.Log // Blockchain specific contextual infos } -// FilterDelegated is a free log retrieval operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// FilterRedeemed is a free log retrieval operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. // -// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterDelegated(opts *bind.FilterOpts, delegator []common.Address) (*SDUtilityPoolDelegatedIterator, error) { +// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRedeemed(opts *bind.FilterOpts, delegator []common.Address) (*SDUtilityPoolRedeemedIterator, error) { var delegatorRule []interface{} for _, delegatorItem := range delegator { delegatorRule = append(delegatorRule, delegatorItem) } - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Delegated", delegatorRule) + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Redeemed", delegatorRule) if err != nil { return nil, err } - return &SDUtilityPoolDelegatedIterator{contract: _SDUtilityPool.contract, event: "Delegated", logs: logs, sub: sub}, nil + return &SDUtilityPoolRedeemedIterator{contract: _SDUtilityPool.contract, event: "Redeemed", logs: logs, sub: sub}, nil } -// WatchDelegated is a free log subscription operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// WatchRedeemed is a free log subscription operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. // -// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchDelegated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolDelegated, delegator []common.Address) (event.Subscription, error) { +// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRedeemed(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRedeemed, delegator []common.Address) (event.Subscription, error) { var delegatorRule []interface{} for _, delegatorItem := range delegator { delegatorRule = append(delegatorRule, delegatorItem) } - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Delegated", delegatorRule) + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Redeemed", delegatorRule) if err != nil { return nil, err } @@ -1757,8 +3577,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchDelegated(opts *bind.WatchOpts select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolDelegated) - if err := _SDUtilityPool.contract.UnpackLog(event, "Delegated", log); err != nil { + event := new(SDUtilityPoolRedeemed) + if err := _SDUtilityPool.contract.UnpackLog(event, "Redeemed", log); err != nil { return err } event.Raw = log @@ -1779,21 +3599,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchDelegated(opts *bind.WatchOpts }), nil } -// ParseDelegated is a log parse operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// ParseRedeemed is a log parse operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. // -// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseDelegated(log types.Log) (*SDUtilityPoolDelegated, error) { - event := new(SDUtilityPoolDelegated) - if err := _SDUtilityPool.contract.UnpackLog(event, "Delegated", log); err != nil { +// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRedeemed(log types.Log) (*SDUtilityPoolRedeemed, error) { + event := new(SDUtilityPoolRedeemed) + if err := _SDUtilityPool.contract.UnpackLog(event, "Redeemed", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolFinalizedWithdrawRequestIterator is returned from FilterFinalizedWithdrawRequest and is used to iterate over the raw logs and unpacked data for FinalizedWithdrawRequest events raised by the SDUtilityPool contract. -type SDUtilityPoolFinalizedWithdrawRequestIterator struct { - Event *SDUtilityPoolFinalizedWithdrawRequest // Event containing the contract specifics and raw log +// SDUtilityPoolRepaidIterator is returned from FilterRepaid and is used to iterate over the raw logs and unpacked data for Repaid events raised by the SDUtilityPool contract. +type SDUtilityPoolRepaidIterator struct { + Event *SDUtilityPoolRepaid // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1807,7 +3627,7 @@ type SDUtilityPoolFinalizedWithdrawRequestIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Next() bool { +func (it *SDUtilityPoolRepaidIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1816,7 +3636,7 @@ func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolFinalizedWithdrawRequest) + it.Event = new(SDUtilityPoolRepaid) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1831,7 +3651,7 @@ func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolFinalizedWithdrawRequest) + it.Event = new(SDUtilityPoolRepaid) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1847,41 +3667,52 @@ func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Error() error { +func (it *SDUtilityPoolRepaidIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Close() error { +func (it *SDUtilityPoolRepaidIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolFinalizedWithdrawRequest represents a FinalizedWithdrawRequest event raised by the SDUtilityPool contract. -type SDUtilityPoolFinalizedWithdrawRequest struct { - NextRequestIdToFinalize *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolRepaid represents a Repaid event raised by the SDUtilityPool contract. +type SDUtilityPoolRepaid struct { + Utilizer common.Address + RepayAmount *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterFinalizedWithdrawRequest is a free log retrieval operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. +// FilterRepaid is a free log retrieval operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. // -// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterFinalizedWithdrawRequest(opts *bind.FilterOpts) (*SDUtilityPoolFinalizedWithdrawRequestIterator, error) { +// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRepaid(opts *bind.FilterOpts, utilizer []common.Address) (*SDUtilityPoolRepaidIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "FinalizedWithdrawRequest") + var utilizerRule []interface{} + for _, utilizerItem := range utilizer { + utilizerRule = append(utilizerRule, utilizerItem) + } + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Repaid", utilizerRule) if err != nil { return nil, err } - return &SDUtilityPoolFinalizedWithdrawRequestIterator{contract: _SDUtilityPool.contract, event: "FinalizedWithdrawRequest", logs: logs, sub: sub}, nil + return &SDUtilityPoolRepaidIterator{contract: _SDUtilityPool.contract, event: "Repaid", logs: logs, sub: sub}, nil } -// WatchFinalizedWithdrawRequest is a free log subscription operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. +// WatchRepaid is a free log subscription operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. // -// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchFinalizedWithdrawRequest(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolFinalizedWithdrawRequest) (event.Subscription, error) { +// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRepaid(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRepaid, utilizer []common.Address) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "FinalizedWithdrawRequest") + var utilizerRule []interface{} + for _, utilizerItem := range utilizer { + utilizerRule = append(utilizerRule, utilizerItem) + } + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Repaid", utilizerRule) if err != nil { return nil, err } @@ -1891,8 +3722,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchFinalizedWithdrawRequest(opts select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolFinalizedWithdrawRequest) - if err := _SDUtilityPool.contract.UnpackLog(event, "FinalizedWithdrawRequest", log); err != nil { + event := new(SDUtilityPoolRepaid) + if err := _SDUtilityPool.contract.UnpackLog(event, "Repaid", log); err != nil { return err } event.Raw = log @@ -1913,21 +3744,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchFinalizedWithdrawRequest(opts }), nil } -// ParseFinalizedWithdrawRequest is a log parse operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. +// ParseRepaid is a log parse operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. // -// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseFinalizedWithdrawRequest(log types.Log) (*SDUtilityPoolFinalizedWithdrawRequest, error) { - event := new(SDUtilityPoolFinalizedWithdrawRequest) - if err := _SDUtilityPool.contract.UnpackLog(event, "FinalizedWithdrawRequest", log); err != nil { +// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRepaid(log types.Log) (*SDUtilityPoolRepaid, error) { + event := new(SDUtilityPoolRepaid) + if err := _SDUtilityPool.contract.UnpackLog(event, "Repaid", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolLiquidationCallIterator is returned from FilterLiquidationCall and is used to iterate over the raw logs and unpacked data for LiquidationCall events raised by the SDUtilityPool contract. -type SDUtilityPoolLiquidationCallIterator struct { - Event *SDUtilityPoolLiquidationCall // Event containing the contract specifics and raw log +// SDUtilityPoolRequestRedeemedIterator is returned from FilterRequestRedeemed and is used to iterate over the raw logs and unpacked data for RequestRedeemed events raised by the SDUtilityPool contract. +type SDUtilityPoolRequestRedeemedIterator struct { + Event *SDUtilityPoolRequestRedeemed // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1941,7 +3772,7 @@ type SDUtilityPoolLiquidationCallIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolLiquidationCallIterator) Next() bool { +func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1950,7 +3781,7 @@ func (it *SDUtilityPoolLiquidationCallIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolLiquidationCall) + it.Event = new(SDUtilityPoolRequestRedeemed) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1965,7 +3796,7 @@ func (it *SDUtilityPoolLiquidationCallIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolLiquidationCall) + it.Event = new(SDUtilityPoolRequestRedeemed) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1981,65 +3812,42 @@ func (it *SDUtilityPoolLiquidationCallIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolLiquidationCallIterator) Error() error { +func (it *SDUtilityPoolRequestRedeemedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolLiquidationCallIterator) Close() error { +func (it *SDUtilityPoolRequestRedeemedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolLiquidationCall represents a LiquidationCall event raised by the SDUtilityPool contract. -type SDUtilityPoolLiquidationCall struct { - Account common.Address - TotalLiquidationAmountInEth *big.Int - LiquidationBonusInEth *big.Int - LiquidationFeeInEth *big.Int - Liquidator common.Address - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolRequestRedeemed represents a RequestRedeemed event raised by the SDUtilityPool contract. +type SDUtilityPoolRequestRedeemed struct { + Caller common.Address + SdToTransfer *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterLiquidationCall is a free log retrieval operation binding the contract event 0xcc9de8be9ac1f02b70a8ca2612f451a769d6d160ad91de17dcc38e54c567a532. +// FilterRequestRedeemed is a free log retrieval operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. // -// Solidity: event LiquidationCall(address indexed account, uint256 totalLiquidationAmountInEth, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth, address indexed liquidator) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterLiquidationCall(opts *bind.FilterOpts, account []common.Address, liquidator []common.Address) (*SDUtilityPoolLiquidationCallIterator, error) { - - var accountRule []interface{} - for _, accountItem := range account { - accountRule = append(accountRule, accountItem) - } - - var liquidatorRule []interface{} - for _, liquidatorItem := range liquidator { - liquidatorRule = append(liquidatorRule, liquidatorItem) - } +// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRequestRedeemed(opts *bind.FilterOpts) (*SDUtilityPoolRequestRedeemedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "LiquidationCall", accountRule, liquidatorRule) + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RequestRedeemed") if err != nil { return nil, err } - return &SDUtilityPoolLiquidationCallIterator{contract: _SDUtilityPool.contract, event: "LiquidationCall", logs: logs, sub: sub}, nil + return &SDUtilityPoolRequestRedeemedIterator{contract: _SDUtilityPool.contract, event: "RequestRedeemed", logs: logs, sub: sub}, nil } -// WatchLiquidationCall is a free log subscription operation binding the contract event 0xcc9de8be9ac1f02b70a8ca2612f451a769d6d160ad91de17dcc38e54c567a532. +// WatchRequestRedeemed is a free log subscription operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. // -// Solidity: event LiquidationCall(address indexed account, uint256 totalLiquidationAmountInEth, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth, address indexed liquidator) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchLiquidationCall(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolLiquidationCall, account []common.Address, liquidator []common.Address) (event.Subscription, error) { - - var accountRule []interface{} - for _, accountItem := range account { - accountRule = append(accountRule, accountItem) - } - - var liquidatorRule []interface{} - for _, liquidatorItem := range liquidator { - liquidatorRule = append(liquidatorRule, liquidatorItem) - } +// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRequestRedeemed(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRequestRedeemed) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "LiquidationCall", accountRule, liquidatorRule) + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RequestRedeemed") if err != nil { return nil, err } @@ -2049,8 +3857,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchLiquidationCall(opts *bind.Wat select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolLiquidationCall) - if err := _SDUtilityPool.contract.UnpackLog(event, "LiquidationCall", log); err != nil { + event := new(SDUtilityPoolRequestRedeemed) + if err := _SDUtilityPool.contract.UnpackLog(event, "RequestRedeemed", log); err != nil { return err } event.Raw = log @@ -2071,21 +3879,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchLiquidationCall(opts *bind.Wat }), nil } -// ParseLiquidationCall is a log parse operation binding the contract event 0xcc9de8be9ac1f02b70a8ca2612f451a769d6d160ad91de17dcc38e54c567a532. +// ParseRequestRedeemed is a log parse operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. // -// Solidity: event LiquidationCall(address indexed account, uint256 totalLiquidationAmountInEth, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth, address indexed liquidator) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseLiquidationCall(log types.Log) (*SDUtilityPoolLiquidationCall, error) { - event := new(SDUtilityPoolLiquidationCall) - if err := _SDUtilityPool.contract.UnpackLog(event, "LiquidationCall", log); err != nil { +// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRequestRedeemed(log types.Log) (*SDUtilityPoolRequestRedeemed, error) { + event := new(SDUtilityPoolRequestRedeemed) + if err := _SDUtilityPool.contract.UnpackLog(event, "RequestRedeemed", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolProtocolFeeFactorUpdatedIterator is returned from FilterProtocolFeeFactorUpdated and is used to iterate over the raw logs and unpacked data for ProtocolFeeFactorUpdated events raised by the SDUtilityPool contract. -type SDUtilityPoolProtocolFeeFactorUpdatedIterator struct { - Event *SDUtilityPoolProtocolFeeFactorUpdated // Event containing the contract specifics and raw log +// SDUtilityPoolRiskConfigUpdatedIterator is returned from FilterRiskConfigUpdated and is used to iterate over the raw logs and unpacked data for RiskConfigUpdated events raised by the SDUtilityPool contract. +type SDUtilityPoolRiskConfigUpdatedIterator struct { + Event *SDUtilityPoolRiskConfigUpdated // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -2099,7 +3907,7 @@ type SDUtilityPoolProtocolFeeFactorUpdatedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Next() bool { +func (it *SDUtilityPoolRiskConfigUpdatedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -2108,7 +3916,7 @@ func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolProtocolFeeFactorUpdated) + it.Event = new(SDUtilityPoolRiskConfigUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2123,7 +3931,7 @@ func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolProtocolFeeFactorUpdated) + it.Event = new(SDUtilityPoolRiskConfigUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2139,41 +3947,44 @@ func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Error() error { +func (it *SDUtilityPoolRiskConfigUpdatedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Close() error { +func (it *SDUtilityPoolRiskConfigUpdatedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolProtocolFeeFactorUpdated represents a ProtocolFeeFactorUpdated event raised by the SDUtilityPool contract. -type SDUtilityPoolProtocolFeeFactorUpdated struct { - ProtocolFeeFactor *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolRiskConfigUpdated represents a RiskConfigUpdated event raised by the SDUtilityPool contract. +type SDUtilityPoolRiskConfigUpdated struct { + LiquidationThreshold *big.Int + LiquidationBonusPercent *big.Int + LiquidationFeePercent *big.Int + Ltv *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterProtocolFeeFactorUpdated is a free log retrieval operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. +// FilterRiskConfigUpdated is a free log retrieval operation binding the contract event 0x62dd46f943681bd727e339f4baaa19fb66ea209fbe7d9b4a75aa74c33acc18f3. // -// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterProtocolFeeFactorUpdated(opts *bind.FilterOpts) (*SDUtilityPoolProtocolFeeFactorUpdatedIterator, error) { +// Solidity: event RiskConfigUpdated(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRiskConfigUpdated(opts *bind.FilterOpts) (*SDUtilityPoolRiskConfigUpdatedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "ProtocolFeeFactorUpdated") + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RiskConfigUpdated") if err != nil { return nil, err } - return &SDUtilityPoolProtocolFeeFactorUpdatedIterator{contract: _SDUtilityPool.contract, event: "ProtocolFeeFactorUpdated", logs: logs, sub: sub}, nil + return &SDUtilityPoolRiskConfigUpdatedIterator{contract: _SDUtilityPool.contract, event: "RiskConfigUpdated", logs: logs, sub: sub}, nil } -// WatchProtocolFeeFactorUpdated is a free log subscription operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. +// WatchRiskConfigUpdated is a free log subscription operation binding the contract event 0x62dd46f943681bd727e339f4baaa19fb66ea209fbe7d9b4a75aa74c33acc18f3. // -// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchProtocolFeeFactorUpdated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolProtocolFeeFactorUpdated) (event.Subscription, error) { +// Solidity: event RiskConfigUpdated(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRiskConfigUpdated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRiskConfigUpdated) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "ProtocolFeeFactorUpdated") + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RiskConfigUpdated") if err != nil { return nil, err } @@ -2183,8 +3994,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchProtocolFeeFactorUpdated(opts select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolProtocolFeeFactorUpdated) - if err := _SDUtilityPool.contract.UnpackLog(event, "ProtocolFeeFactorUpdated", log); err != nil { + event := new(SDUtilityPoolRiskConfigUpdated) + if err := _SDUtilityPool.contract.UnpackLog(event, "RiskConfigUpdated", log); err != nil { return err } event.Raw = log @@ -2205,21 +4016,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchProtocolFeeFactorUpdated(opts }), nil } -// ParseProtocolFeeFactorUpdated is a log parse operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. +// ParseRiskConfigUpdated is a log parse operation binding the contract event 0x62dd46f943681bd727e339f4baaa19fb66ea209fbe7d9b4a75aa74c33acc18f3. // -// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseProtocolFeeFactorUpdated(log types.Log) (*SDUtilityPoolProtocolFeeFactorUpdated, error) { - event := new(SDUtilityPoolProtocolFeeFactorUpdated) - if err := _SDUtilityPool.contract.UnpackLog(event, "ProtocolFeeFactorUpdated", log); err != nil { +// Solidity: event RiskConfigUpdated(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRiskConfigUpdated(log types.Log) (*SDUtilityPoolRiskConfigUpdated, error) { + event := new(SDUtilityPoolRiskConfigUpdated) + if err := _SDUtilityPool.contract.UnpackLog(event, "RiskConfigUpdated", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolRedeemedIterator is returned from FilterRedeemed and is used to iterate over the raw logs and unpacked data for Redeemed events raised by the SDUtilityPool contract. -type SDUtilityPoolRedeemedIterator struct { - Event *SDUtilityPoolRedeemed // Event containing the contract specifics and raw log +// SDUtilityPoolRoleAdminChangedIterator is returned from FilterRoleAdminChanged and is used to iterate over the raw logs and unpacked data for RoleAdminChanged events raised by the SDUtilityPool contract. +type SDUtilityPoolRoleAdminChangedIterator struct { + Event *SDUtilityPoolRoleAdminChanged // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -2233,7 +4044,7 @@ type SDUtilityPoolRedeemedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolRedeemedIterator) Next() bool { +func (it *SDUtilityPoolRoleAdminChangedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -2242,7 +4053,7 @@ func (it *SDUtilityPoolRedeemedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRedeemed) + it.Event = new(SDUtilityPoolRoleAdminChanged) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2257,7 +4068,7 @@ func (it *SDUtilityPoolRedeemedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRedeemed) + it.Event = new(SDUtilityPoolRoleAdminChanged) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2273,53 +4084,69 @@ func (it *SDUtilityPoolRedeemedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolRedeemedIterator) Error() error { +func (it *SDUtilityPoolRoleAdminChangedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolRedeemedIterator) Close() error { +func (it *SDUtilityPoolRoleAdminChangedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolRedeemed represents a Redeemed event raised by the SDUtilityPool contract. -type SDUtilityPoolRedeemed struct { - Delegator common.Address - SdAmount *big.Int - SdXAmount *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolRoleAdminChanged represents a RoleAdminChanged event raised by the SDUtilityPool contract. +type SDUtilityPoolRoleAdminChanged struct { + Role [32]byte + PreviousAdminRole [32]byte + NewAdminRole [32]byte + Raw types.Log // Blockchain specific contextual infos } -// FilterRedeemed is a free log retrieval operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. +// FilterRoleAdminChanged is a free log retrieval operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. // -// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRedeemed(opts *bind.FilterOpts, delegator []common.Address) (*SDUtilityPoolRedeemedIterator, error) { +// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRoleAdminChanged(opts *bind.FilterOpts, role [][32]byte, previousAdminRole [][32]byte, newAdminRole [][32]byte) (*SDUtilityPoolRoleAdminChangedIterator, error) { - var delegatorRule []interface{} - for _, delegatorItem := range delegator { - delegatorRule = append(delegatorRule, delegatorItem) + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var previousAdminRoleRule []interface{} + for _, previousAdminRoleItem := range previousAdminRole { + previousAdminRoleRule = append(previousAdminRoleRule, previousAdminRoleItem) + } + var newAdminRoleRule []interface{} + for _, newAdminRoleItem := range newAdminRole { + newAdminRoleRule = append(newAdminRoleRule, newAdminRoleItem) } - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Redeemed", delegatorRule) + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RoleAdminChanged", roleRule, previousAdminRoleRule, newAdminRoleRule) if err != nil { return nil, err } - return &SDUtilityPoolRedeemedIterator{contract: _SDUtilityPool.contract, event: "Redeemed", logs: logs, sub: sub}, nil + return &SDUtilityPoolRoleAdminChangedIterator{contract: _SDUtilityPool.contract, event: "RoleAdminChanged", logs: logs, sub: sub}, nil } -// WatchRedeemed is a free log subscription operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. +// WatchRoleAdminChanged is a free log subscription operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. // -// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRedeemed(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRedeemed, delegator []common.Address) (event.Subscription, error) { +// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRoleAdminChanged(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRoleAdminChanged, role [][32]byte, previousAdminRole [][32]byte, newAdminRole [][32]byte) (event.Subscription, error) { - var delegatorRule []interface{} - for _, delegatorItem := range delegator { - delegatorRule = append(delegatorRule, delegatorItem) + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var previousAdminRoleRule []interface{} + for _, previousAdminRoleItem := range previousAdminRole { + previousAdminRoleRule = append(previousAdminRoleRule, previousAdminRoleItem) + } + var newAdminRoleRule []interface{} + for _, newAdminRoleItem := range newAdminRole { + newAdminRoleRule = append(newAdminRoleRule, newAdminRoleItem) } - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Redeemed", delegatorRule) + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RoleAdminChanged", roleRule, previousAdminRoleRule, newAdminRoleRule) if err != nil { return nil, err } @@ -2329,8 +4156,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRedeemed(opts *bind.WatchOpts, select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolRedeemed) - if err := _SDUtilityPool.contract.UnpackLog(event, "Redeemed", log); err != nil { + event := new(SDUtilityPoolRoleAdminChanged) + if err := _SDUtilityPool.contract.UnpackLog(event, "RoleAdminChanged", log); err != nil { return err } event.Raw = log @@ -2351,21 +4178,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRedeemed(opts *bind.WatchOpts, }), nil } -// ParseRedeemed is a log parse operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. +// ParseRoleAdminChanged is a log parse operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. // -// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRedeemed(log types.Log) (*SDUtilityPoolRedeemed, error) { - event := new(SDUtilityPoolRedeemed) - if err := _SDUtilityPool.contract.UnpackLog(event, "Redeemed", log); err != nil { +// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRoleAdminChanged(log types.Log) (*SDUtilityPoolRoleAdminChanged, error) { + event := new(SDUtilityPoolRoleAdminChanged) + if err := _SDUtilityPool.contract.UnpackLog(event, "RoleAdminChanged", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolRepaidIterator is returned from FilterRepaid and is used to iterate over the raw logs and unpacked data for Repaid events raised by the SDUtilityPool contract. -type SDUtilityPoolRepaidIterator struct { - Event *SDUtilityPoolRepaid // Event containing the contract specifics and raw log +// SDUtilityPoolRoleGrantedIterator is returned from FilterRoleGranted and is used to iterate over the raw logs and unpacked data for RoleGranted events raised by the SDUtilityPool contract. +type SDUtilityPoolRoleGrantedIterator struct { + Event *SDUtilityPoolRoleGranted // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -2379,7 +4206,7 @@ type SDUtilityPoolRepaidIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolRepaidIterator) Next() bool { +func (it *SDUtilityPoolRoleGrantedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -2388,7 +4215,7 @@ func (it *SDUtilityPoolRepaidIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRepaid) + it.Event = new(SDUtilityPoolRoleGranted) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2403,7 +4230,7 @@ func (it *SDUtilityPoolRepaidIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRepaid) + it.Event = new(SDUtilityPoolRoleGranted) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2419,52 +4246,69 @@ func (it *SDUtilityPoolRepaidIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolRepaidIterator) Error() error { +func (it *SDUtilityPoolRoleGrantedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolRepaidIterator) Close() error { +func (it *SDUtilityPoolRoleGrantedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolRepaid represents a Repaid event raised by the SDUtilityPool contract. -type SDUtilityPoolRepaid struct { - Utilizer common.Address - RepayAmount *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolRoleGranted represents a RoleGranted event raised by the SDUtilityPool contract. +type SDUtilityPoolRoleGranted struct { + Role [32]byte + Account common.Address + Sender common.Address + Raw types.Log // Blockchain specific contextual infos } -// FilterRepaid is a free log retrieval operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. +// FilterRoleGranted is a free log retrieval operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. // -// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRepaid(opts *bind.FilterOpts, utilizer []common.Address) (*SDUtilityPoolRepaidIterator, error) { +// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRoleGranted(opts *bind.FilterOpts, role [][32]byte, account []common.Address, sender []common.Address) (*SDUtilityPoolRoleGrantedIterator, error) { - var utilizerRule []interface{} - for _, utilizerItem := range utilizer { - utilizerRule = append(utilizerRule, utilizerItem) + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) } - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Repaid", utilizerRule) + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RoleGranted", roleRule, accountRule, senderRule) if err != nil { return nil, err } - return &SDUtilityPoolRepaidIterator{contract: _SDUtilityPool.contract, event: "Repaid", logs: logs, sub: sub}, nil + return &SDUtilityPoolRoleGrantedIterator{contract: _SDUtilityPool.contract, event: "RoleGranted", logs: logs, sub: sub}, nil } -// WatchRepaid is a free log subscription operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. +// WatchRoleGranted is a free log subscription operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. // -// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRepaid(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRepaid, utilizer []common.Address) (event.Subscription, error) { +// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRoleGranted(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRoleGranted, role [][32]byte, account []common.Address, sender []common.Address) (event.Subscription, error) { - var utilizerRule []interface{} - for _, utilizerItem := range utilizer { - utilizerRule = append(utilizerRule, utilizerItem) + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) } - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Repaid", utilizerRule) + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RoleGranted", roleRule, accountRule, senderRule) if err != nil { return nil, err } @@ -2474,8 +4318,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRepaid(opts *bind.WatchOpts, s select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolRepaid) - if err := _SDUtilityPool.contract.UnpackLog(event, "Repaid", log); err != nil { + event := new(SDUtilityPoolRoleGranted) + if err := _SDUtilityPool.contract.UnpackLog(event, "RoleGranted", log); err != nil { return err } event.Raw = log @@ -2496,21 +4340,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRepaid(opts *bind.WatchOpts, s }), nil } -// ParseRepaid is a log parse operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. +// ParseRoleGranted is a log parse operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. // -// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRepaid(log types.Log) (*SDUtilityPoolRepaid, error) { - event := new(SDUtilityPoolRepaid) - if err := _SDUtilityPool.contract.UnpackLog(event, "Repaid", log); err != nil { +// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRoleGranted(log types.Log) (*SDUtilityPoolRoleGranted, error) { + event := new(SDUtilityPoolRoleGranted) + if err := _SDUtilityPool.contract.UnpackLog(event, "RoleGranted", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolRequestRedeemedIterator is returned from FilterRequestRedeemed and is used to iterate over the raw logs and unpacked data for RequestRedeemed events raised by the SDUtilityPool contract. -type SDUtilityPoolRequestRedeemedIterator struct { - Event *SDUtilityPoolRequestRedeemed // Event containing the contract specifics and raw log +// SDUtilityPoolRoleRevokedIterator is returned from FilterRoleRevoked and is used to iterate over the raw logs and unpacked data for RoleRevoked events raised by the SDUtilityPool contract. +type SDUtilityPoolRoleRevokedIterator struct { + Event *SDUtilityPoolRoleRevoked // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -2524,7 +4368,7 @@ type SDUtilityPoolRequestRedeemedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { +func (it *SDUtilityPoolRoleRevokedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -2533,7 +4377,7 @@ func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRequestRedeemed) + it.Event = new(SDUtilityPoolRoleRevoked) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2548,7 +4392,7 @@ func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRequestRedeemed) + it.Event = new(SDUtilityPoolRoleRevoked) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2564,42 +4408,69 @@ func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolRequestRedeemedIterator) Error() error { +func (it *SDUtilityPoolRoleRevokedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolRequestRedeemedIterator) Close() error { +func (it *SDUtilityPoolRoleRevokedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolRequestRedeemed represents a RequestRedeemed event raised by the SDUtilityPool contract. -type SDUtilityPoolRequestRedeemed struct { - Caller common.Address - SdToTransfer *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolRoleRevoked represents a RoleRevoked event raised by the SDUtilityPool contract. +type SDUtilityPoolRoleRevoked struct { + Role [32]byte + Account common.Address + Sender common.Address + Raw types.Log // Blockchain specific contextual infos } -// FilterRequestRedeemed is a free log retrieval operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. +// FilterRoleRevoked is a free log retrieval operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. // -// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRequestRedeemed(opts *bind.FilterOpts) (*SDUtilityPoolRequestRedeemedIterator, error) { +// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRoleRevoked(opts *bind.FilterOpts, role [][32]byte, account []common.Address, sender []common.Address) (*SDUtilityPoolRoleRevokedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RequestRedeemed") + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RoleRevoked", roleRule, accountRule, senderRule) if err != nil { return nil, err } - return &SDUtilityPoolRequestRedeemedIterator{contract: _SDUtilityPool.contract, event: "RequestRedeemed", logs: logs, sub: sub}, nil + return &SDUtilityPoolRoleRevokedIterator{contract: _SDUtilityPool.contract, event: "RoleRevoked", logs: logs, sub: sub}, nil } -// WatchRequestRedeemed is a free log subscription operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. +// WatchRoleRevoked is a free log subscription operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. // -// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRequestRedeemed(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRequestRedeemed) (event.Subscription, error) { +// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRoleRevoked(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRoleRevoked, role [][32]byte, account []common.Address, sender []common.Address) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RequestRedeemed") + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RoleRevoked", roleRule, accountRule, senderRule) if err != nil { return nil, err } @@ -2609,8 +4480,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRequestRedeemed(opts *bind.Wat select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolRequestRedeemed) - if err := _SDUtilityPool.contract.UnpackLog(event, "RequestRedeemed", log); err != nil { + event := new(SDUtilityPoolRoleRevoked) + if err := _SDUtilityPool.contract.UnpackLog(event, "RoleRevoked", log); err != nil { return err } event.Raw = log @@ -2631,21 +4502,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRequestRedeemed(opts *bind.Wat }), nil } -// ParseRequestRedeemed is a log parse operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. +// ParseRoleRevoked is a log parse operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. // -// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRequestRedeemed(log types.Log) (*SDUtilityPoolRequestRedeemed, error) { - event := new(SDUtilityPoolRequestRedeemed) - if err := _SDUtilityPool.contract.UnpackLog(event, "RequestRedeemed", log); err != nil { +// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRoleRevoked(log types.Log) (*SDUtilityPoolRoleRevoked, error) { + event := new(SDUtilityPoolRoleRevoked) + if err := _SDUtilityPool.contract.UnpackLog(event, "RoleRevoked", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolRiskConfigUpdatedIterator is returned from FilterRiskConfigUpdated and is used to iterate over the raw logs and unpacked data for RiskConfigUpdated events raised by the SDUtilityPool contract. -type SDUtilityPoolRiskConfigUpdatedIterator struct { - Event *SDUtilityPoolRiskConfigUpdated // Event containing the contract specifics and raw log +// SDUtilityPoolSDUtilizedIterator is returned from FilterSDUtilized and is used to iterate over the raw logs and unpacked data for SDUtilized events raised by the SDUtilityPool contract. +type SDUtilityPoolSDUtilizedIterator struct { + Event *SDUtilityPoolSDUtilized // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -2659,7 +4530,7 @@ type SDUtilityPoolRiskConfigUpdatedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolRiskConfigUpdatedIterator) Next() bool { +func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -2668,7 +4539,7 @@ func (it *SDUtilityPoolRiskConfigUpdatedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRiskConfigUpdated) + it.Event = new(SDUtilityPoolSDUtilized) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2683,7 +4554,7 @@ func (it *SDUtilityPoolRiskConfigUpdatedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRiskConfigUpdated) + it.Event = new(SDUtilityPoolSDUtilized) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2699,44 +4570,42 @@ func (it *SDUtilityPoolRiskConfigUpdatedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolRiskConfigUpdatedIterator) Error() error { +func (it *SDUtilityPoolSDUtilizedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolRiskConfigUpdatedIterator) Close() error { +func (it *SDUtilityPoolSDUtilizedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolRiskConfigUpdated represents a RiskConfigUpdated event raised by the SDUtilityPool contract. -type SDUtilityPoolRiskConfigUpdated struct { - LiquidationThreshold *big.Int - LiquidationBonusPercent *big.Int - LiquidationFeePercent *big.Int - Ltv *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolSDUtilized represents a SDUtilized event raised by the SDUtilityPool contract. +type SDUtilityPoolSDUtilized struct { + Utilizer common.Address + UtilizeAmount *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterRiskConfigUpdated is a free log retrieval operation binding the contract event 0x62dd46f943681bd727e339f4baaa19fb66ea209fbe7d9b4a75aa74c33acc18f3. +// FilterSDUtilized is a free log retrieval operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. // -// Solidity: event RiskConfigUpdated(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRiskConfigUpdated(opts *bind.FilterOpts) (*SDUtilityPoolRiskConfigUpdatedIterator, error) { +// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterSDUtilized(opts *bind.FilterOpts) (*SDUtilityPoolSDUtilizedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RiskConfigUpdated") + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "SDUtilized") if err != nil { return nil, err } - return &SDUtilityPoolRiskConfigUpdatedIterator{contract: _SDUtilityPool.contract, event: "RiskConfigUpdated", logs: logs, sub: sub}, nil + return &SDUtilityPoolSDUtilizedIterator{contract: _SDUtilityPool.contract, event: "SDUtilized", logs: logs, sub: sub}, nil } -// WatchRiskConfigUpdated is a free log subscription operation binding the contract event 0x62dd46f943681bd727e339f4baaa19fb66ea209fbe7d9b4a75aa74c33acc18f3. +// WatchSDUtilized is a free log subscription operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. // -// Solidity: event RiskConfigUpdated(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRiskConfigUpdated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRiskConfigUpdated) (event.Subscription, error) { +// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchSDUtilized(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolSDUtilized) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RiskConfigUpdated") + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "SDUtilized") if err != nil { return nil, err } @@ -2746,8 +4615,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRiskConfigUpdated(opts *bind.W select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolRiskConfigUpdated) - if err := _SDUtilityPool.contract.UnpackLog(event, "RiskConfigUpdated", log); err != nil { + event := new(SDUtilityPoolSDUtilized) + if err := _SDUtilityPool.contract.UnpackLog(event, "SDUtilized", log); err != nil { return err } event.Raw = log @@ -2768,21 +4637,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRiskConfigUpdated(opts *bind.W }), nil } -// ParseRiskConfigUpdated is a log parse operation binding the contract event 0x62dd46f943681bd727e339f4baaa19fb66ea209fbe7d9b4a75aa74c33acc18f3. +// ParseSDUtilized is a log parse operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. // -// Solidity: event RiskConfigUpdated(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRiskConfigUpdated(log types.Log) (*SDUtilityPoolRiskConfigUpdated, error) { - event := new(SDUtilityPoolRiskConfigUpdated) - if err := _SDUtilityPool.contract.UnpackLog(event, "RiskConfigUpdated", log); err != nil { +// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseSDUtilized(log types.Log) (*SDUtilityPoolSDUtilized, error) { + event := new(SDUtilityPoolSDUtilized) + if err := _SDUtilityPool.contract.UnpackLog(event, "SDUtilized", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolSDUtilizedIterator is returned from FilterSDUtilized and is used to iterate over the raw logs and unpacked data for SDUtilized events raised by the SDUtilityPool contract. -type SDUtilityPoolSDUtilizedIterator struct { - Event *SDUtilityPoolSDUtilized // Event containing the contract specifics and raw log +// SDUtilityPoolUnpausedIterator is returned from FilterUnpaused and is used to iterate over the raw logs and unpacked data for Unpaused events raised by the SDUtilityPool contract. +type SDUtilityPoolUnpausedIterator struct { + Event *SDUtilityPoolUnpaused // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -2796,7 +4665,7 @@ type SDUtilityPoolSDUtilizedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { +func (it *SDUtilityPoolUnpausedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -2805,7 +4674,7 @@ func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolSDUtilized) + it.Event = new(SDUtilityPoolUnpaused) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2820,7 +4689,7 @@ func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolSDUtilized) + it.Event = new(SDUtilityPoolUnpaused) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2836,42 +4705,41 @@ func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolSDUtilizedIterator) Error() error { +func (it *SDUtilityPoolUnpausedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolSDUtilizedIterator) Close() error { +func (it *SDUtilityPoolUnpausedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolSDUtilized represents a SDUtilized event raised by the SDUtilityPool contract. -type SDUtilityPoolSDUtilized struct { - Utilizer common.Address - UtilizeAmount *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolUnpaused represents a Unpaused event raised by the SDUtilityPool contract. +type SDUtilityPoolUnpaused struct { + Account common.Address + Raw types.Log // Blockchain specific contextual infos } -// FilterSDUtilized is a free log retrieval operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. +// FilterUnpaused is a free log retrieval operation binding the contract event 0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa. // -// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterSDUtilized(opts *bind.FilterOpts) (*SDUtilityPoolSDUtilizedIterator, error) { +// Solidity: event Unpaused(address account) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterUnpaused(opts *bind.FilterOpts) (*SDUtilityPoolUnpausedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "SDUtilized") + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Unpaused") if err != nil { return nil, err } - return &SDUtilityPoolSDUtilizedIterator{contract: _SDUtilityPool.contract, event: "SDUtilized", logs: logs, sub: sub}, nil + return &SDUtilityPoolUnpausedIterator{contract: _SDUtilityPool.contract, event: "Unpaused", logs: logs, sub: sub}, nil } -// WatchSDUtilized is a free log subscription operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. +// WatchUnpaused is a free log subscription operation binding the contract event 0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa. // -// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchSDUtilized(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolSDUtilized) (event.Subscription, error) { +// Solidity: event Unpaused(address account) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchUnpaused(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolUnpaused) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "SDUtilized") + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Unpaused") if err != nil { return nil, err } @@ -2881,8 +4749,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchSDUtilized(opts *bind.WatchOpt select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolSDUtilized) - if err := _SDUtilityPool.contract.UnpackLog(event, "SDUtilized", log); err != nil { + event := new(SDUtilityPoolUnpaused) + if err := _SDUtilityPool.contract.UnpackLog(event, "Unpaused", log); err != nil { return err } event.Raw = log @@ -2903,12 +4771,12 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchSDUtilized(opts *bind.WatchOpt }), nil } -// ParseSDUtilized is a log parse operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. +// ParseUnpaused is a log parse operation binding the contract event 0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa. // -// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseSDUtilized(log types.Log) (*SDUtilityPoolSDUtilized, error) { - event := new(SDUtilityPoolSDUtilized) - if err := _SDUtilityPool.contract.UnpackLog(event, "SDUtilized", log); err != nil { +// Solidity: event Unpaused(address account) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseUnpaused(log types.Log) (*SDUtilityPoolUnpaused, error) { + event := new(SDUtilityPoolUnpaused) + if err := _SDUtilityPool.contract.UnpackLog(event, "Unpaused", log); err != nil { return nil, err } event.Raw = log diff --git a/stader-lib/sdutility/sd-utility.go b/stader-lib/sdutility/sd-utility.go index 98bc22e2d..72f10db41 100644 --- a/stader-lib/sdutility/sd-utility.go +++ b/stader-lib/sdutility/sd-utility.go @@ -14,9 +14,44 @@ func GetUtilizerLatestBalance(sp *stader.SDUtilityPoolContractManager, address c } func GetPoolAvailableSDBalance(sp *stader.SDUtilityPoolContractManager, opts *bind.CallOpts) (*big.Int, error) { + accumulatedProtocolFee, err := GetAccumulatedProtocolFee(sp, opts) + if err != nil { + return nil, err + } + sdRequestedForWithdraw, err := GetSdRequestedForWithdraw(sp, opts) + if err != nil { + return nil, err + } + utilityPoolBalance, err := GetUtilityPoolBalance(sp, opts) + if err != nil { + return nil, err + } + + utilityPoolBalanceMinusSdForWithdraw := new(big.Int).Sub(utilityPoolBalance, sdRequestedForWithdraw) + if utilityPoolBalanceMinusSdForWithdraw.Cmp(big.NewInt(0)) < 0 { + return big.NewInt(0), nil + } + + availableSdBalance := new(big.Int).Sub(utilityPoolBalanceMinusSdForWithdraw, accumulatedProtocolFee) + if availableSdBalance.Cmp(big.NewInt(0)) < 0 { + return big.NewInt(0), nil + } + + return availableSdBalance, nil +} + +func GetUtilityPoolBalance(sp *stader.SDUtilityPoolContractManager, opts *bind.CallOpts) (*big.Int, error) { return sp.SDUtilityPool.GetPoolAvailableSDBalance(opts) } +func GetAccumulatedProtocolFee(sp *stader.SDUtilityPoolContractManager, opts *bind.CallOpts) (*big.Int, error) { + return sp.SDUtilityPool.AccumulatedProtocolFee(opts) +} + +func GetSdRequestedForWithdraw(sp *stader.SDUtilityPoolContractManager, opts *bind.CallOpts) (*big.Int, error) { + return sp.SDUtilityPool.SdRequestedForWithdraw(opts) +} + // Estimate the gas of Utilize func EstimateUtilize(sp *stader.SDUtilityPoolContractManager, utilityAmount *big.Int, opts *bind.TransactOpts) (stader.GasInfo, error) { return sp.SDUtilityPoolContract.GetTransactionGasInfo(opts, "utilize", utilityAmount) diff --git a/update-abis.sh b/update-abis.sh index 97ddfc262..55bb86554 100755 --- a/update-abis.sh +++ b/update-abis.sh @@ -15,6 +15,7 @@ abigen --abi ./../../abis/Penalty.abi.json --pkg contracts --type PenaltyTracker abigen --abi ./../../abis/NodeElRewardVault.abi.json --pkg contracts --type NodeElRewardVault --out node-el-reward-vault.go; abigen --abi ./../../abis/OperatorRewardsCollector.abi.json --pkg contracts --type OperatorRewardsCollector --out operator-rewards-collector.go; abigen --abi ./../../abis/SdCollateral.abi.json --pkg contracts --type SdCollateral --out sd-collateral.go; +abigen --abi ./../../abis/SDUtilityPool.abi.json --pkg contracts --type SDUtilityPool --out sd-utility.go; cd ../..; From 5a3908b299d7eabb36bb4f5b27436d7318719d51 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Wed, 13 Dec 2023 14:59:14 +0530 Subject: [PATCH 077/159] some copy changes --- stader-cli/node/status.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 8e12198b0..ef3a06610 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -172,21 +172,21 @@ func getNodeStatus(c *cli.Context) error { sdStatus := sdStatusResp.SDStatus fmt.Printf( - "The node %s%s%s current utilized %.6f SD.\n\n", + "The node %s%s%s currently utilizes %.6f SD.\n\n", log.ColorBlue, status.AccountAddress, log.ColorReset, math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizedBalance), eth.Decimal)) fmt.Printf( - "The node %s%s%s had SD Utilization Position (including the fee) %.6f SD.\n\n", + "The node %s%s%s has SD Utilization Position (including the fee) %.6f SD.\n\n", log.ColorBlue, status.AccountAddress, log.ColorReset, math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizerLatestBalance), eth.Decimal)) fmt.Printf( - "The node %s%s%s require to had %.6f SD in collateral.\n\n", + "The node %s%s%s requires %.6f SD in collateral.\n\n", log.ColorBlue, status.AccountAddress, log.ColorReset, @@ -194,7 +194,7 @@ func getNodeStatus(c *cli.Context) error { totalCollateral := new(big.Int).Add(sdStatus.SdCollateralCurrentAmount, sdStatus.SdUtilizerLatestBalance) fmt.Printf( - "The node %s%s%s current had %.6f SD in collateral.\n\n", + "The node %s%s%s current has %.6f SD in collateral.\n\n", log.ColorBlue, status.AccountAddress, log.ColorReset, @@ -208,13 +208,16 @@ func getNodeStatus(c *cli.Context) error { math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralCurrentAmount), eth.Decimal)) maxUtilizable := new(big.Int).Sub(sdStatus.SdMaxUtilizableAmount, sdStatus.SdUtilizerLatestBalance) + if maxUtilizable.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { + maxUtilizable = sdStatus.PoolAvailableSDBalance + } fmt.Printf( "The node %s%s%s can utilize max of %.6f SD.\n\n", log.ColorBlue, status.AccountAddress, log.ColorReset, - (eth.WeiToEth(maxUtilizable))) + eth.WeiToEth(maxUtilizable)) fmt.Printf( "The SD utility can provide max of %.6f SD.\n\n", From 42bd2bb4e2a74294b04652077996a2956ebb4431 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Wed, 13 Dec 2023 15:05:20 +0530 Subject: [PATCH 078/159] minor fixes --- stader-lib/sdutility/sd-utility.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stader-lib/sdutility/sd-utility.go b/stader-lib/sdutility/sd-utility.go index 72f10db41..fe751205d 100644 --- a/stader-lib/sdutility/sd-utility.go +++ b/stader-lib/sdutility/sd-utility.go @@ -27,12 +27,12 @@ func GetPoolAvailableSDBalance(sp *stader.SDUtilityPoolContractManager, opts *bi return nil, err } - utilityPoolBalanceMinusSdForWithdraw := new(big.Int).Sub(utilityPoolBalance, sdRequestedForWithdraw) + utilityPoolBalanceMinusSdForWithdraw := big.NewInt(0).Sub(utilityPoolBalance, sdRequestedForWithdraw) if utilityPoolBalanceMinusSdForWithdraw.Cmp(big.NewInt(0)) < 0 { return big.NewInt(0), nil } - availableSdBalance := new(big.Int).Sub(utilityPoolBalanceMinusSdForWithdraw, accumulatedProtocolFee) + availableSdBalance := big.NewInt(0).Sub(utilityPoolBalanceMinusSdForWithdraw, accumulatedProtocolFee) if availableSdBalance.Cmp(big.NewInt(0)) < 0 { return big.NewInt(0), nil } From 1258a37178f1d817c39928aec59a7ff12b8fc04a Mon Sep 17 00:00:00 2001 From: batphonghan Date: Thu, 14 Dec 2023 16:39:50 +0700 Subject: [PATCH 079/159] Update withdraw SD message --- stader-cli/node/withdraw-sd.go | 35 ++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index b7ed7574c..69e26fcd7 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -51,20 +51,23 @@ func WithdrawSd(c *cli.Context) error { return err } - if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(amountWei) > 0 { - confirm := cliutils.Confirm(fmt.Sprintf("You have an existing Utilization Position of %.6f SD. The excess SD collateral you are trying to withdraw will be used to repay the utilized SD.\n Do you wish to proceed?", math.RoundDown(eth.WeiToEth(sdStatusResponse.SDStatus.SdUtilizerLatestBalance), 6))) - if !confirm { - fmt.Println("Cancelled.") - return nil - } - } else { - confirm := cliutils.Confirm(fmt.Sprintf("You have an existing Utilization Position of %.6f SD. The excess SD collateral you are trying to withdraw will be used to repay the utilized SD and the remaining SD will be sent to your Reward Address.\n Do you wish to proceed?", math.RoundDown(eth.WeiToEth(sdStatusResponse.SDStatus.SdUtilizerLatestBalance), 6))) - if !confirm { - fmt.Println("Cancelled.") - return nil + hasUtilizePosition := sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) != 0 + + if hasUtilizePosition { + if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(amountWei) > 0 { + confirm := cliutils.Confirm(fmt.Sprintf("You have an existing Utilization Position of %.6f SD. The excess SD collateral you are trying to withdraw will be used to repay the utilized SD.\n Do you wish to proceed?", math.RoundDown(eth.WeiToEth(sdStatusResponse.SDStatus.SdUtilizerLatestBalance), 6))) + if !confirm { + fmt.Println("Cancelled.") + return nil + } + } else { + confirm := cliutils.Confirm(fmt.Sprintf("You have an existing Utilization Position of %.6f SD. The excess SD collateral you are trying to withdraw will be used to repay the utilized SD and the remaining SD will be sent to your Reward Address.\n Do you wish to proceed?", math.RoundDown(eth.WeiToEth(sdStatusResponse.SDStatus.SdUtilizerLatestBalance), 6))) + if !confirm { + fmt.Println("Cancelled.") + return nil + } } } - // Assign max fees err = gas.AssignMaxFeeAndLimit(canWithdrawSdResponse.GasInfo, staderClient, c.Bool("yes")) if err != nil { @@ -97,6 +100,13 @@ func WithdrawSd(c *cli.Context) error { // Log & return // withdraw request amount lesser than the Utilization Position + + if !hasUtilizePosition { + fmt.Printf("Successfully withdrawn %.6f SD Collateral. \n", math.RoundDown(eth.WeiToEth(amountWei), 6)) + + return nil + } + if remainUtilize.Cmp(big.NewInt(0)) > 0 { fmt.Printf("Successfully withdrawn %.6f SD Collateral. \n", math.RoundDown(eth.WeiToEth(amountWei), 6)) fmt.Printf("Current Utilization Position: %.6f SD \nCurrent SD collateral: %.6f SD\n", math.RoundDown(eth.WeiToEth(remainUtilize), 6), math.RoundDown(eth.WeiToEth(remainCollateral), 6)) @@ -105,5 +115,6 @@ func WithdrawSd(c *cli.Context) error { fmt.Printf("Repayment of %.6f SD successful using the excess SD Collateral.\n", math.RoundDown(eth.WeiToEth(amountWei), 6)) fmt.Printf("The remaining %.6f SD has been sent to your Operator Reward Address\n", math.RoundDown(eth.WeiToEth(new(big.Int).Abs(remainUtilize)), 6)) } + return nil } From 9f1d06ddb38f7f7f34252922b9818fc836730b8f Mon Sep 17 00:00:00 2001 From: batphonghan Date: Thu, 14 Dec 2023 17:51:14 +0700 Subject: [PATCH 080/159] Fix approve issue --- stader-cli/node/repay-sd.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index 500c42133..21dd33aab 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -62,6 +62,8 @@ func repaySD(c *cli.Context) error { // If almost equal repay with all Utilize position to make sure the position is cleared if sd.WeiAlmostEqual(amountWei, sdStatus.SdUtilizerLatestBalance) { amountWei = sdStatus.SdUtilizerLatestBalance + + amountInString = fmt.Sprintf("%.18f", eth.WeiToEth(sdStatus.SdUtilizerLatestBalance)) } // 1. Check if repay more than need @@ -84,6 +86,7 @@ func repaySD(c *cli.Context) error { if allowance.Allowance.Cmp(amountWei) < 0 { fmt.Println("Before repaying the SD, you must first give the utility contract approval to interact with your SD. Amount to approve: ", eth.WeiToEth(amountWei)) + err = nodeApproveUtilitySd(c, amountInString) if err != nil { return err From e559d813520d171ac6632327bb162aacd5adcba0 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Thu, 14 Dec 2023 17:51:40 +0700 Subject: [PATCH 081/159] Revert back build config --- build-release.sh | 4 ++-- shared/version.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build-release.sh b/build-release.sh index 94048d704..3d8bbeb48 100755 --- a/build-release.sh +++ b/build-release.sh @@ -27,8 +27,8 @@ # === Functions === # ================= -DOCKER_ACCOUNT=staderdev -S3_BUCKET=stader-cli-beta +DOCKER_ACCOUNT=staderlabs +S3_BUCKET=stader-cli-permissionless/eth/releases/stader-node-build/permissionless # Print a failure message to stderr and exit fail() { diff --git a/shared/version.go b/shared/version.go index 4ce8982ac..35b90fc24 100644 --- a/shared/version.go +++ b/shared/version.go @@ -20,8 +20,8 @@ along with this program. If not, see . package shared const BinaryBucket string = "/stader-node-build/permissionless" -const DockerAccount string = "staderdev" -const StaderVersion string = "1.4.4-SD-utility" +const DockerAccount string = "staderlabs" +const StaderVersion string = "1.4.3" const Logo string = ` _____ _ _ _ _ 𝅺 From 98880a9d372f65cbed6013969247c656ca540864 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Fri, 15 Dec 2023 16:47:46 +0700 Subject: [PATCH 082/159] Show small amount in float format --- stader-cli/node/repay-sd.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index 21dd33aab..ed8f40fcb 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -10,7 +10,6 @@ import ( "github.com/stader-labs/stader-node/shared/services/gas" "github.com/stader-labs/stader-node/shared/services/stader" cliutils "github.com/stader-labs/stader-node/shared/utils/cli" - "github.com/stader-labs/stader-node/shared/utils/math" "github.com/stader-labs/stader-node/stader-lib/utils/eth" "github.com/stader-labs/stader-node/stader-lib/utils/sd" ) @@ -85,7 +84,7 @@ func repaySD(c *cli.Context) error { } if allowance.Allowance.Cmp(amountWei) < 0 { - fmt.Println("Before repaying the SD, you must first give the utility contract approval to interact with your SD. Amount to approve: ", eth.WeiToEth(amountWei)) + fmt.Printf("Before repaying the SD, you must first give the utility contract approval to interact with your SD. Amount to approve: %.6f\n", eth.WeiToEth(amountWei)) err = nodeApproveUtilitySd(c, amountInString) if err != nil { @@ -122,7 +121,7 @@ func repaySD(c *cli.Context) error { } remainUtilize := new(big.Int).Sub(sdStatus.SdUtilizerLatestBalance, amountWei) - fmt.Printf("Repayment of %.6f SD successful. Current Utilization Position: %.6f SD.\n", math.RoundDown(eth.WeiToEth(amountWei), 6), math.RoundDown(eth.WeiToEth(remainUtilize), 6)) + fmt.Printf("Repayment of %.6f SD successful. Current Utilization Position: %.6f SD.\n", eth.WeiToEth(amountWei), eth.WeiToEth(remainUtilize)) return nil } From ceb6bbae19d6567addbbbcf8a132ff0167a538c0 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Fri, 15 Dec 2023 19:15:49 +0700 Subject: [PATCH 083/159] Remove convert from float to bigint --- stader-cli/node/utilize-sd.go | 8 ++------ stader-lib/utils/sd/sd.go | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index 0cd614966..92add83d2 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -136,13 +136,11 @@ Maximum utilization amount: %f SD`, eth.WeiToEth(sdStatus.PoolAvailableSDBalance errMsg := fmt.Sprintf("Invalid input, please specify an amount within %f and %f SD range\n", min, max) - utilityAmountFloat, err := sd.PromptChooseSDWithMaxMin(msg, errMsg, min, max) + utilityAmount, err := sd.PromptChooseSDWithMaxMin(msg, errMsg, minUtility, maxUtility) if err != nil { return nil, err } - utilityAmount := eth.EthToWei(utilityAmountFloat) - return utilityAmount, nil } @@ -161,12 +159,10 @@ Maximum bond: %f SD`, min, max) errMsg := fmt.Sprintf("Invalid input, please specify an amount within %f and %f SD range\n", min, max) - utilityAmountFloat, err := sd.PromptChooseSDWithMaxMin(msg, errMsg, min, max) + utilityAmount, err := sd.PromptChooseSDWithMaxMin(msg, errMsg, amountToCollateralRemain, sdRewardEligibleRemain) if err != nil { return nil, err } - utilityAmount := eth.EthToWei(utilityAmountFloat) - return utilityAmount, nil } diff --git a/stader-lib/utils/sd/sd.go b/stader-lib/utils/sd/sd.go index 3c329443d..8064e26e1 100644 --- a/stader-lib/utils/sd/sd.go +++ b/stader-lib/utils/sd/sd.go @@ -26,8 +26,8 @@ func WeiAlmostEqual(lhs, rhs *big.Int) bool { return diversity.CmpAbs(SDWeiEqualityThreshold) <= 0 } -func PromptChooseSDWithMaxMin(msg, errMsg string, min, max float64) (float64, error) { - var utilityAmountFloat float64 +func PromptChooseSDWithMaxMin(msg, errMsg string, min, max *big.Int) (*big.Int, error) { + var utilityAmountWei *big.Int var errParse error @@ -37,21 +37,23 @@ func PromptChooseSDWithMaxMin(msg, errMsg string, min, max float64) (float64, er `^[0-9]\d*(\.\d+)?$`, errMsg) - utilityAmountFloat, errParse = strconv.ParseFloat(s, 64) + utilityAmountFloat, errParse := strconv.ParseFloat(s, 64) if errParse != nil { fmt.Println(errMsg) continue } - if almostEqual(utilityAmountFloat, min) { - utilityAmountFloat = min + utilityAmountWei = eth.EthToWei(utilityAmountFloat) + + if WeiAlmostEqual(utilityAmountWei, min) { + utilityAmountWei = min } - if almostEqual(utilityAmountFloat, max) { - utilityAmountFloat = max + if WeiAlmostEqual(utilityAmountWei, max) { + utilityAmountWei = max } - if utilityAmountFloat < min || utilityAmountFloat > max { + if utilityAmountWei.Cmp(min) < 0 || utilityAmountWei.Cmp(max) > 0 { fmt.Println(errMsg) continue } @@ -59,5 +61,5 @@ func PromptChooseSDWithMaxMin(msg, errMsg string, min, max float64) (float64, er break } - return utilityAmountFloat, errParse + return utilityAmountWei, errParse } From 53e3fee501e3b6e0843adc36bcf2586676d4e6bc Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Mon, 18 Dec 2023 15:24:03 +0530 Subject: [PATCH 084/159] increase precision of socializing pool rewards while displaying --- stader-cli/node/claim-sp-rewards.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stader-cli/node/claim-sp-rewards.go b/stader-cli/node/claim-sp-rewards.go index 570d2ecc1..586a352b3 100644 --- a/stader-cli/node/claim-sp-rewards.go +++ b/stader-cli/node/claim-sp-rewards.go @@ -82,12 +82,12 @@ func ClaimSpRewards(c *cli.Context) error { if !ok { return fmt.Errorf("Unable to parse eth rewards: %s", cycleInfo.MerkleProofInfo.Eth) } - ethRewardsConverted := math.RoundDown(eth.WeiToEth(ethRewards), 2) + ethRewardsConverted := math.RoundDown(eth.WeiToEth(ethRewards), 5) sdRewards, ok := big.NewInt(0).SetString(cycleInfo.MerkleProofInfo.Sd, 10) if !ok { return fmt.Errorf("Unable to parse sd rewards: %s", cycleInfo.MerkleProofInfo.Sd) } - sdRewardsConverted := math.RoundDown(eth.WeiToEth(sdRewards), 2) + sdRewardsConverted := math.RoundDown(eth.WeiToEth(sdRewards), 5) if ethRewardsConverted == 0 && sdRewardsConverted == 0 { continue From c37fa59866caa6a590be46b3ad592f75af27393c Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Mon, 18 Dec 2023 15:43:16 +0530 Subject: [PATCH 085/159] minor fixes --- stader-cli/node/claim-sp-rewards.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/stader-cli/node/claim-sp-rewards.go b/stader-cli/node/claim-sp-rewards.go index 586a352b3..ee1b1c8b4 100644 --- a/stader-cli/node/claim-sp-rewards.go +++ b/stader-cli/node/claim-sp-rewards.go @@ -164,25 +164,25 @@ func ClaimSpRewards(c *cli.Context) error { fmt.Printf("Please select one of the following options:\n") fmt.Printf("1. Claim all SD rewards to your Reward Address\n") - fmt.Printf("2. Redeposit all the SD rewards as SD collateral for additional earnings\n\n") + fmt.Printf("2. Redeposit all the SD rewards as SD collateral for additional earnings\n") option := cliutils.Prompt("", "^(1|2)$", "Please enter a valid option") if option == "1" { - if cliutils.Confirm(fmt.Sprintf( + if !cliutils.Confirm(fmt.Sprintf( "Are you sure you want to claim %f ETH and %f SD for cycles %v to your reward address?", eth.WeiToEth(totalClaimableEth), eth.WeiToEth(totalClaimableSd), cyclesToClaimArray)) { fmt.Println("Claim Cancelled.") return nil } } else if option == "2" { - if cliutils.Confirm(fmt.Sprintf( - "Your %f ETH rewards will be sent to your Reward Address.\n For your %f SD rewards, are you sure you want to re-deposit it as SD collateral for additional earnings?", eth.WeiToEth(totalClaimableEth), eth.WeiToEth(totalClaimableSd))) { + if !cliutils.Confirm(fmt.Sprintf( + "Your %f ETH rewards will be sent to your Reward Address.\nFor your %f SD rewards, are you sure you want to re-deposit it as SD collateral for additional earnings?", eth.WeiToEth(totalClaimableEth), eth.WeiToEth(totalClaimableSd))) { fmt.Println("Claim Cancelled.") return nil } depositSd = true } } else { - if cliutils.Confirm(fmt.Sprintf( + if !cliutils.Confirm(fmt.Sprintf( "Are you sure you want to claim %s ETH for cycles %v to your reward address?", totalClaimableEth.String(), cyclesToClaimArray)) { fmt.Println("Cancelled.") return nil From a832fcd5c8c6bfd24ffee884da7fc637abcbadee Mon Sep 17 00:00:00 2001 From: batphonghan Date: Sun, 24 Dec 2023 21:22:56 +0700 Subject: [PATCH 086/159] Update contract --- abis/PermissionlessNodeRegistry.abi.json | 554 +++++++++++--- abis/SDUtilityPool.abi.json | 692 +----------------- shared/types/api/node.go | 1 + stader-cli/node/status.go | 151 ++-- .../contracts/permissionless-node-registry.go | 161 +++- stader-lib/node/validator.go | 5 +- stader-lib/sdutility/sd-utility.go | 10 + stader/api/validator/deposit.go | 11 +- 8 files changed, 719 insertions(+), 866 deletions(-) diff --git a/abis/PermissionlessNodeRegistry.abi.json b/abis/PermissionlessNodeRegistry.abi.json index bd36bf44f..7377f2e86 100644 --- a/abis/PermissionlessNodeRegistry.abi.json +++ b/abis/PermissionlessNodeRegistry.abi.json @@ -1,34 +1,134 @@ [ - { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, - { "inputs": [], "name": "CallerNotExistingRewardAddress", "type": "error" }, - { "inputs": [], "name": "CallerNotManager", "type": "error" }, - { "inputs": [], "name": "CallerNotNewRewardAddress", "type": "error" }, - { "inputs": [], "name": "CallerNotOperator", "type": "error" }, - { "inputs": [], "name": "CallerNotStaderContract", "type": "error" }, - { "inputs": [], "name": "CooldownNotComplete", "type": "error" }, - { "inputs": [], "name": "DuplicatePoolIDOrPoolNotAdded", "type": "error" }, - { "inputs": [], "name": "InSufficientBalance", "type": "error" }, - { "inputs": [], "name": "InvalidBondEthValue", "type": "error" }, - { "inputs": [], "name": "InvalidKeyCount", "type": "error" }, - { "inputs": [], "name": "InvalidStartAndEndIndex", "type": "error" }, - { "inputs": [], "name": "MisMatchingInputKeysSize", "type": "error" }, - { "inputs": [], "name": "NoChangeInState", "type": "error" }, - { "inputs": [], "name": "NotEnoughSDCollateral", "type": "error" }, + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "CallerNotExistingRewardAddress", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotManager", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotNewRewardAddress", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotOperator", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotStaderContract", + "type": "error" + }, + { + "inputs": [], + "name": "CooldownNotComplete", + "type": "error" + }, + { + "inputs": [], + "name": "DuplicatePoolIDOrPoolNotAdded", + "type": "error" + }, + { + "inputs": [], + "name": "InSufficientBalance", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidBondEthValue", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidKeyCount", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidStartAndEndIndex", + "type": "error" + }, + { + "inputs": [], + "name": "MisMatchingInputKeysSize", + "type": "error" + }, + { + "inputs": [], + "name": "NoChangeInState", + "type": "error" + }, + { + "inputs": [], + "name": "NotEnoughSDCollateral", + "type": "error" + }, { "inputs": [], "name": "OperatorAlreadyOnBoardedInProtocol", "type": "error" }, - { "inputs": [], "name": "OperatorIsDeactivate", "type": "error" }, - { "inputs": [], "name": "OperatorNotOnBoarded", "type": "error" }, - { "inputs": [], "name": "PageNumberIsZero", "type": "error" }, - { "inputs": [], "name": "PubkeyAlreadyExist", "type": "error" }, - { "inputs": [], "name": "TooManyVerifiedKeysReported", "type": "error" }, - { "inputs": [], "name": "TooManyWithdrawnKeysReported", "type": "error" }, - { "inputs": [], "name": "TransferFailed", "type": "error" }, - { "inputs": [], "name": "UNEXPECTED_STATUS", "type": "error" }, - { "inputs": [], "name": "ZeroAddress", "type": "error" }, - { "inputs": [], "name": "maxKeyLimitReached", "type": "error" }, + { + "inputs": [], + "name": "OperatorIsDeactivate", + "type": "error" + }, + { + "inputs": [], + "name": "OperatorNotOnBoarded", + "type": "error" + }, + { + "inputs": [], + "name": "PageNumberIsZero", + "type": "error" + }, + { + "inputs": [], + "name": "PubkeyAlreadyExist", + "type": "error" + }, + { + "inputs": [], + "name": "TooManyVerifiedKeysReported", + "type": "error" + }, + { + "inputs": [], + "name": "TooManyWithdrawnKeysReported", + "type": "error" + }, + { + "inputs": [], + "name": "TransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "UNEXPECTED_STATUS", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "maxKeyLimitReached", + "type": "error" + }, { "anonymous": false, "inputs": [ @@ -417,6 +517,25 @@ "name": "UpdatedWithdrawnKeyBatchSize", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "string", + "name": "referralId", + "type": "string" + } + ], + "name": "ValidatorAddedViaReferral", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -497,7 +616,11 @@ "inputs": [], "name": "COLLATERAL_ETH", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" @@ -506,7 +629,11 @@ "inputs": [], "name": "DEFAULT_ADMIN_ROLE", "outputs": [ - { "internalType": "bytes32", "name": "", "type": "bytes32" } + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } ], "stateMutability": "view", "type": "function" @@ -515,7 +642,11 @@ "inputs": [], "name": "FRONT_RUN_PENALTY", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" @@ -523,13 +654,23 @@ { "inputs": [], "name": "POOL_ID", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "bytes[]", "name": "_pubkey", "type": "bytes[]" }, + { + "internalType": "bytes[]", + "name": "_pubkey", + "type": "bytes[]" + }, { "internalType": "bytes[]", "name": "_preDepositSignature", @@ -548,12 +689,21 @@ }, { "inputs": [ + { + "internalType": "string", + "name": "_referralId", + "type": "string" + }, { "internalType": "uint256", "name": "_amountOfSDToUtilize", "type": "uint256" }, - { "internalType": "bytes[]", "name": "_pubkey", "type": "bytes[]" }, + { + "internalType": "bytes[]", + "name": "_pubkey", + "type": "bytes[]" + }, { "internalType": "bytes[]", "name": "_preDepositSignature", @@ -683,7 +833,11 @@ ], "name": "getAllNodeELVaultAddress", "outputs": [ - { "internalType": "address[]", "name": "", "type": "address[]" } + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } ], "stateMutability": "view", "type": "function" @@ -692,7 +846,11 @@ "inputs": [], "name": "getCollateralETH", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "pure", "type": "function" @@ -707,7 +865,11 @@ ], "name": "getOperatorRewardAddress", "outputs": [ - { "internalType": "address payable", "name": "", "type": "address" } + { + "internalType": "address payable", + "name": "", + "type": "address" + } ], "stateMutability": "view", "type": "function" @@ -750,17 +912,31 @@ } ], "name": "getOperatorTotalNonTerminalKeys", - "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" } + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } ], "name": "getRoleAdmin", "outputs": [ - { "internalType": "bytes32", "name": "", "type": "bytes32" } + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } ], "stateMutability": "view", "type": "function" @@ -775,7 +951,11 @@ ], "name": "getSocializingPoolStateChangeBlock", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" @@ -784,7 +964,11 @@ "inputs": [], "name": "getTotalActiveValidatorCount", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" @@ -793,7 +977,11 @@ "inputs": [], "name": "getTotalQueuedValidatorCount", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" @@ -871,8 +1059,16 @@ }, { "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "grantRole", "outputs": [], @@ -881,17 +1077,35 @@ }, { "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "hasRole", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "_count", "type": "uint256" } + { + "internalType": "uint256", + "name": "_count", + "type": "uint256" + } ], "name": "increaseTotalActiveValidatorCount", "outputs": [], @@ -900,7 +1114,11 @@ }, { "inputs": [ - { "internalType": "address", "name": "_admin", "type": "address" }, + { + "internalType": "address", + "name": "_admin", + "type": "address" + }, { "internalType": "address", "name": "_staderConfig", @@ -915,7 +1133,13 @@ { "inputs": [], "name": "inputKeyCountLimit", - "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], "stateMutability": "view", "type": "function" }, @@ -928,16 +1152,32 @@ } ], "name": "isExistingOperator", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "bytes", "name": "_pubkey", "type": "bytes" } + { + "internalType": "bytes", + "name": "_pubkey", + "type": "bytes" + } ], "name": "isExistingPubkey", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, @@ -967,7 +1207,13 @@ { "inputs": [], "name": "maxNonTerminalKeyPerOperator", - "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], "stateMutability": "view", "type": "function" }, @@ -975,7 +1221,11 @@ "inputs": [], "name": "nextOperatorId", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" @@ -984,7 +1234,11 @@ "inputs": [], "name": "nextQueuedValidatorIndex", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" @@ -993,18 +1247,30 @@ "inputs": [], "name": "nextValidatorId", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "name": "nodeELRewardVaultByOperatorId", "outputs": [ - { "internalType": "address", "name": "", "type": "address" } + { + "internalType": "address", + "name": "", + "type": "address" + } ], "stateMutability": "view", "type": "function" @@ -1040,22 +1306,38 @@ }, { "inputs": [ - { "internalType": "address", "name": "", "type": "address" } + { + "internalType": "address", + "name": "", + "type": "address" + } ], "name": "operatorIDByAddress", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "name": "operatorStructById", "outputs": [ - { "internalType": "bool", "name": "active", "type": "bool" }, + { + "internalType": "bool", + "name": "active", + "type": "bool" + }, { "internalType": "bool", "name": "optedForSocializingPool", @@ -1090,7 +1372,13 @@ { "inputs": [], "name": "paused", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, @@ -1114,30 +1402,54 @@ }, { "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "name": "proposedRewardAddressByOperatorId", "outputs": [ - { "internalType": "address", "name": "", "type": "address" } + { + "internalType": "address", + "name": "", + "type": "address" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "name": "queuedValidators", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "renounceRole", "outputs": [], @@ -1146,8 +1458,16 @@ }, { "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "revokeRole", "outputs": [], @@ -1156,11 +1476,19 @@ }, { "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "name": "socializingPoolStateChangeBlock", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" @@ -1187,7 +1515,13 @@ } ], "name": "supportsInterface", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, @@ -1195,14 +1529,22 @@ "inputs": [], "name": "totalActiveValidatorCount", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "_amount", "type": "uint256" } + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } ], "name": "transferCollateralToPool", "outputs": [], @@ -1308,22 +1650,44 @@ "type": "function" }, { - "inputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], "name": "validatorIdByPubkey", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "name": "validatorIdsByOperatorId", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" @@ -1332,14 +1696,22 @@ "inputs": [], "name": "validatorQueueSize", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "name": "validatorRegistry", "outputs": [ @@ -1348,7 +1720,11 @@ "name": "status", "type": "uint8" }, - { "internalType": "bytes", "name": "pubkey", "type": "bytes" }, + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, { "internalType": "bytes", "name": "preDepositSignature", @@ -1387,14 +1763,22 @@ "inputs": [], "name": "verifiedKeyBatchSize", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "bytes[]", "name": "_pubkeys", "type": "bytes[]" } + { + "internalType": "bytes[]", + "name": "_pubkeys", + "type": "bytes[]" + } ], "name": "withdrawnValidators", "outputs": [], diff --git a/abis/SDUtilityPool.abi.json b/abis/SDUtilityPool.abi.json index 5cd338445..3b746ba5a 100644 --- a/abis/SDUtilityPool.abi.json +++ b/abis/SDUtilityPool.abi.json @@ -1,9 +1,4 @@ [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, { "inputs": [], "name": "AccrualBlockNumberNotLatest", @@ -24,16 +19,6 @@ "name": "CallerNotAuthorizedToRedeem", "type": "error" }, - { - "inputs": [], - "name": "CallerNotManager", - "type": "error" - }, - { - "inputs": [], - "name": "CallerNotStaderContract", - "type": "error" - }, { "inputs": [], "name": "CannotFindRequestId", @@ -100,11 +85,6 @@ "name": "SDUtilizeLimitReached", "type": "error" }, - { - "inputs": [], - "name": "ZeroAddress", - "type": "error" - }, { "anonymous": false, "inputs": [ @@ -181,19 +161,6 @@ "name": "FinalizedWithdrawRequest", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -231,19 +198,6 @@ "name": "LiquidationCall", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Paused", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -351,81 +305,6 @@ "name": "RiskConfigUpdated", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -445,19 +324,6 @@ "name": "SDUtilized", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Unpaused", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -587,71 +453,6 @@ "name": "WithdrawnProtocolFee", "type": "event" }, - { - "inputs": [], - "name": "DECIMAL", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_PROTOCOL_FEE", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_UTILIZATION_RATE_PER_BLOCK", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "accrualBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "accrueFee", @@ -659,19 +460,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "accumulatedProtocolFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "cTokenTotalSupply", @@ -689,7 +477,7 @@ "inputs": [ { "internalType": "uint256", - "name": "_requestId", + "name": "requestId", "type": "uint256" } ], @@ -711,19 +499,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "conservativeEthPerKey", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -840,19 +615,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "finalizationBatchLimit", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "finalizeDelegatorWithdrawalRequest", @@ -922,7 +684,7 @@ "inputs": [ { "internalType": "address", - "name": "account", + "name": "", "type": "address" } ], @@ -969,25 +731,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "getOperatorTotalEth", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "getPoolAvailableSDBalance", @@ -1005,7 +748,7 @@ "inputs": [ { "internalType": "address", - "name": "_delegator", + "name": "_owner", "type": "address" } ], @@ -1020,25 +763,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -1101,208 +825,32 @@ }, { "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, { "internalType": "address", "name": "account", "type": "address" } ], - "name": "grantRole", + "name": "liquidationCall", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", + "inputs": [], + "name": "maxApproveSD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "maxETHWorthOfSDPerValidator", "outputs": [ { - "internalType": "bool", + "internalType": "uint256", "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_admin", - "type": "address" - }, - { - "internalType": "address", - "name": "_staderConfig", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "liquidationCall", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "liquidations", - "outputs": [ - { - "internalType": "uint256", - "name": "totalAmountInEth", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBonusInEth", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalFeeInEth", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isRepaid", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isClaimed", - "type": "bool" - }, - { - "internalType": "address", - "name": "liquidator", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxApproveSD", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "maxETHWorthOfSDPerValidator", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxNonRedeemedDelegatorRequestCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "minBlockDelayToFinalizeRequest", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "nextRequestId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "nextRequestIdToFinalize", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" + "type": "uint256" } ], "stateMutability": "view", @@ -1321,37 +869,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "protocolFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -1364,12 +881,12 @@ "outputs": [ { "internalType": "uint256", - "name": "repaidAmount", + "name": "", "type": "uint256" }, { "internalType": "uint256", - "name": "feePaid", + "name": "", "type": "uint256" } ], @@ -1393,12 +910,12 @@ "outputs": [ { "internalType": "uint256", - "name": "repaidAmount", + "name": "", "type": "uint256" }, { "internalType": "uint256", - "name": "feePaid", + "name": "", "type": "uint256" } ], @@ -1433,7 +950,7 @@ "inputs": [ { "internalType": "uint256", - "name": "_cTokenAmount", + "name": "cTokenAmount", "type": "uint256" } ], @@ -1441,7 +958,7 @@ "outputs": [ { "internalType": "uint256", - "name": "_requestId", + "name": "", "type": "uint256" } ], @@ -1452,83 +969,11 @@ "inputs": [ { "internalType": "uint256", - "name": "_sdAmount", + "name": "sdAmount", "type": "uint256" } ], "name": "requestWithdrawWithSDAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "_requestId", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "riskConfig", - "outputs": [ - { - "internalType": "uint256", - "name": "liquidationThreshold", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationBonusPercent", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationFeePercent", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "ltv", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "sdRequestedForWithdraw", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "sdReservedForClaim", "outputs": [ { "internalType": "uint256", @@ -1536,58 +981,6 @@ "type": "uint256" } ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "staderConfig", - "outputs": [ - { - "internalType": "contract IStaderConfig", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalUtilizedSD", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "unpause", - "outputs": [], "stateMutability": "nonpayable", "type": "function" }, @@ -1669,34 +1062,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "liquidationThreshold", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationBonusPercent", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationFeePercent", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "ltv", - "type": "uint256" - } - ], - "name": "updateRiskConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -1749,19 +1114,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "utilizeIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { diff --git a/shared/types/api/node.go b/shared/types/api/node.go index 6c335b23f..b1966384a 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -454,6 +454,7 @@ type SdStatusResponse struct { SdBalance *big.Int `json:"sdBalance"` PoolAvailableSDBalance *big.Int `json:"poolAvailableSDBalance"` SdRewardEligible *big.Int `json:"sdRewardEligible"` + HealthFactor *big.Int `json:"healthFactor"` NotEnoughSdCollateral bool `json:"notEnoughSdCollateral"` } diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index ef3a06610..4e2076caf 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -71,42 +71,6 @@ func getNodeStatus(c *cli.Context) error { noOfValidatorsWeCanRegister = noOfValidatorsWeCanRegisterBasedOnEthBalance } - // Account address & balances - fmt.Printf("%s=== Account and Balances ===%s\n", log.ColorGreen, log.ColorReset) - fmt.Printf( - "The node %s%s%s has a balance of %.6f ETH.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - math.RoundDown(eth.WeiToEth(status.AccountBalances.ETH), 6)) - fmt.Printf( - "The node %s%s%s has a balance of %.6f SD.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - math.RoundDown(eth.WeiToEth(status.AccountBalances.Sd), 18)) - - fmt.Printf( - "The node %s%s%s has a deposited %d Eth as collateral.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - totalEthCollateral) - - fmt.Printf( - "The node %s%s%s has a deposited %.6f SD as collateral.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - math.RoundDown(eth.WeiToEth(status.DepositedSdCollateral), 18)) - - fmt.Printf( - "The node %s%s%s can register %d more validators based on the ETH balance and the SD collateral provided.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - noOfValidatorsWeCanRegister) - fmt.Printf("%s=== Operator Registration Details ===%s\n", log.ColorGreen, log.ColorReset) if !status.Registered { @@ -114,7 +78,6 @@ func getNodeStatus(c *cli.Context) error { return nil } - fmt.Printf("The operator is registered with Stader. Below are operator details:\n") fmt.Printf("Operator Id: %d\n\n", status.OperatorId) fmt.Printf("Operator Name: %s\n\n", status.OperatorName) fmt.Printf("Operator Address: %s\n\n", status.OperatorAddress.String()) @@ -124,12 +87,13 @@ func getNodeStatus(c *cli.Context) error { } else { fmt.Printf("Operator Status: Not Active\n\n") } - fmt.Printf("The Operator has registered a total of %d validators\n\n", len(status.ValidatorInfos)) + + fmt.Printf("The Operator has registered a total of %d validators (To view details of each validator, please use the `stader-cli validator status` command)\n\n", len(status.ValidatorInfos)) if !status.OptedInForSocializingPool { - fmt.Printf("Operator has Opted Out for Socializing Pool\n\n") + fmt.Printf("The Operator has Opted Out for Socializing Pool\n\n") } else { - fmt.Printf("Operator has Opted In for Socializing Pool\n\n") + fmt.Printf("The Operator has Opted In for Socializing Pool\n\n") } if totalUnclaimedSocializingPoolSd.Cmp(big.NewInt(0)) > 0 { @@ -157,93 +121,88 @@ func getNodeStatus(c *cli.Context) error { fmt.Printf("To transfer the claims to your operator reward address use the %sstader-cli node claim-rewards%s command\n\n", log.ColorGreen, log.ColorReset) } - fmt.Printf("%s=== Registered Validator Details ===%s\n", log.ColorGreen, log.ColorReset) - - fmt.Printf("To view details of each validator, please use the %sstader-cli validator status%s command\n\n", log.ColorGreen, log.ColorReset) - - // Get node SD status - sdStatusResp, err := staderClient.GetSDStatus(big.NewInt(0)) - if err != nil { - return err - } - - fmt.Printf("%s=== SD utilization Details ===%s\n", log.ColorGreen, log.ColorReset) + fmt.Printf( + "The Operator can register %d more validators considering the ETH balance and SD availability in the Operator Address and Utility Pool.\n\n", + noOfValidatorsWeCanRegister) - sdStatus := sdStatusResp.SDStatus + // Account address & balances + fmt.Printf("%s=== Account and Balances ===%s\n", log.ColorGreen, log.ColorReset) fmt.Printf( - "The node %s%s%s currently utilizes %.6f SD.\n\n", + "The Operator %s%s%s has a balance of %.6f ETH.\n\n", log.ColorBlue, status.AccountAddress, log.ColorReset, - math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizedBalance), eth.Decimal)) - + math.RoundDown(eth.WeiToEth(status.AccountBalances.ETH), 6)) fmt.Printf( - "The node %s%s%s has SD Utilization Position (including the fee) %.6f SD.\n\n", + "The Operator %s%s%s has a balance of %.6f SD.\n\n", log.ColorBlue, status.AccountAddress, log.ColorReset, - math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizerLatestBalance), eth.Decimal)) + math.RoundDown(eth.WeiToEth(status.AccountBalances.Sd), 18)) fmt.Printf( - "The node %s%s%s requires %.6f SD in collateral.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralRequireAmount), eth.Decimal)) + "The Operator has a deposited %d ETH as collateral.\n\n", + totalEthCollateral) + // Get node SD status + sdStatusResp, err := staderClient.GetSDStatus(big.NewInt(0)) + if err != nil { + return err + } + collateralPct := 0.0 + sdStatus := sdStatusResp.SDStatus totalCollateral := new(big.Int).Add(sdStatus.SdCollateralCurrentAmount, sdStatus.SdUtilizerLatestBalance) + + current := eth.WeiToEth(totalCollateral) + require := eth.WeiToEth(sdStatus.SdCollateralRequireAmount) + + if require > 0 { + collateralPct = current / require * 10 + } + fmt.Printf( - "The node %s%s%s current has %.6f SD in collateral.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - math.RoundDown(eth.WeiToEth(totalCollateral), eth.Decimal)) + "The Operator has a deposited %.6f SD (%.6f%s) as collateral. Below is the break-up: \n\n", + math.RoundDown(eth.WeiToEth(status.DepositedSdCollateral), 18), collateralPct, "%") fmt.Printf( - "The node %s%s%s current had %.6f SD in self bond.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, + "Self-bonded: %.6f SD \n\n", math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralCurrentAmount), eth.Decimal)) - maxUtilizable := new(big.Int).Sub(sdStatus.SdMaxUtilizableAmount, sdStatus.SdUtilizerLatestBalance) - if maxUtilizable.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { - maxUtilizable = sdStatus.PoolAvailableSDBalance - } - fmt.Printf( - "The node %s%s%s can utilize max of %.6f SD.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - eth.WeiToEth(maxUtilizable)) + "Utilized from the Utility Pool: %.6f SD.\n\n", + math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizedBalance), eth.Decimal)) fmt.Printf( - "The SD utility can provide max of %.6f SD.\n\n", - math.RoundDown(eth.WeiToEth(sdStatus.PoolAvailableSDBalance), eth.Decimal)) + "Noted: For the %d validator, the minimum SD collateral should be %.6f SD (%s) to be eligible for the SD rewards. Please ensure that the SD collateral percentage is greater than %s. The SD collateral snapshots are taken daily at a random block, and if the SD collateral value falls below the %s limit, the node operator will not earn SD rewards for that day.\n\n", + len(status.ValidatorInfos), + math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralRequireAmount), eth.Decimal), + "10%", "10%", "10%") - collateralPct := 0.0 + fmt.Printf("%s=== SD utilization Details ===%s\n", log.ColorGreen, log.ColorReset) - current := eth.WeiToEth(totalCollateral) - require := eth.WeiToEth(sdStatus.SdCollateralRequireAmount) + fmt.Printf("The Operator has utilized %.6f SD from the Utility Pool.\n\n", + math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizedBalance), eth.Decimal)) - if require > 0 { - collateralPct = current / require * 10 + fmt.Printf("The Operator has a current Utilization Position of %.6f SD. (including the utilization fee) Note: For repayment of your utilized SD, please use the `stader-cli node repay-sd ` command.\n\n", + math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizerLatestBalance), eth.Decimal)) + + maxUtilizable := new(big.Int).Sub(sdStatus.SdMaxUtilizableAmount, sdStatus.SdUtilizerLatestBalance) + if maxUtilizable.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { + maxUtilizable = sdStatus.PoolAvailableSDBalance } fmt.Printf( - "The node %s%s%s current had %.6f%s Collateral.\nPlease ensure that the SD collateral percentage is greater than %s. The SD collateral snapshots are taken daily at a random block, and if the SD collateral value falls below the %s limit, the node operator will not earn SD rewards for that day\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - collateralPct, "%", "10%", "10%") + "The Operator can utilize upto %.6f SD more.\nNote: The Operator can utilize a maximum of 1 ETH worth SD per validator.\n\n", + eth.WeiToEth(maxUtilizable)) fmt.Printf( - "The SD utility require %.6f SD.\n\n", - math.RoundDown(require, eth.Decimal)) + "The Operator has a Health Factor of %s. \nNote: Please ensure your Health Factor is greater than 1 to avoid liquidations.", + sdStatus.HealthFactor.String()) + fmt.Printf( - "The SD utility can provide max of %.6f SD.\n\n", + "The Utility Pool currently has a balance of %.6f SD.\n\n", math.RoundDown(eth.WeiToEth(sdStatus.PoolAvailableSDBalance), eth.Decimal)) + return nil } diff --git a/stader-lib/contracts/permissionless-node-registry.go b/stader-lib/contracts/permissionless-node-registry.go index 68169e67f..05464ec9e 100644 --- a/stader-lib/contracts/permissionless-node-registry.go +++ b/stader-lib/contracts/permissionless-node-registry.go @@ -43,7 +43,7 @@ type Validator struct { // PermissionlessNodeRegistryMetaData contains all meta data concerning the PermissionlessNodeRegistry contract. var PermissionlessNodeRegistryMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CallerNotExistingRewardAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotManager\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotNewRewardAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotOperator\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotStaderContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CooldownNotComplete\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DuplicatePoolIDOrPoolNotAdded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InSufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidBondEthValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidKeyCount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidStartAndEndIndex\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MisMatchingInputKeysSize\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoChangeInState\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotEnoughSDCollateral\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorAlreadyOnBoardedInProtocol\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorIsDeactivate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorNotOnBoarded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PageNumberIsZero\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PubkeyAlreadyExist\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooManyVerifiedKeysReported\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooManyWithdrawnKeysReported\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UNEXPECTED_STATUS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"maxKeyLimitReached\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"AddedValidatorKey\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalActiveValidatorCount\",\"type\":\"uint256\"}],\"name\":\"DecreasedTotalActiveValidatorCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalActiveValidatorCount\",\"type\":\"uint256\"}],\"name\":\"IncreasedTotalActiveValidatorCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"nodeRewardAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"optInForSocializingPool\",\"type\":\"bool\"}],\"name\":\"OnboardedOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardAddress\",\"type\":\"address\"}],\"name\":\"OperatorRewardAddressUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardAddress\",\"type\":\"address\"}],\"name\":\"RewardAddressProposed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferredCollateralToPool\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"batchKeyDepositLimit\",\"type\":\"uint256\"}],\"name\":\"UpdatedInputKeyCountLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"maxNonTerminalKeyPerOperator\",\"type\":\"uint64\"}],\"name\":\"UpdatedMaxNonTerminalKeyPerOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextQueuedValidatorIndex\",\"type\":\"uint256\"}],\"name\":\"UpdatedNextQueuedValidatorIndex\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"operatorName\",\"type\":\"string\"}],\"name\":\"UpdatedOperatorName\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"optedForSocializingPool\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"block\",\"type\":\"uint256\"}],\"name\":\"UpdatedSocializingPoolState\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"}],\"name\":\"UpdatedValidatorDepositBlock\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"verifiedKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"UpdatedVerifiedKeyBatchSize\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"withdrawnKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"UpdatedWithdrawnKeyBatchSize\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorMarkedAsFrontRunned\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorMarkedReadyToDeposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorStatusMarkedAsInvalidSignature\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorWithdrawn\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"COLLATERAL_ETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FRONT_RUN_PENALTY\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"POOL_ID\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_pubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_preDepositSignature\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_depositSignature\",\"type\":\"bytes[]\"}],\"name\":\"addValidatorKeys\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amountOfSDToUtilize\",\"type\":\"uint256\"},{\"internalType\":\"bytes[]\",\"name\":\"_pubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_preDepositSignature\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_depositSignature\",\"type\":\"bytes[]\"}],\"name\":\"addValidatorKeysWithUtilizeSD\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_optInForSocializingPool\",\"type\":\"bool\"}],\"name\":\"changeSocializingPoolState\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"feeRecipientAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operatorAddress\",\"type\":\"address\"}],\"name\":\"confirmRewardAddressChange\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_pageNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pageSize\",\"type\":\"uint256\"}],\"name\":\"getAllActiveValidators\",\"outputs\":[{\"components\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"preDepositSignature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"depositSignature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"withdrawVaultAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawnBlock\",\"type\":\"uint256\"}],\"internalType\":\"structValidator[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_pageNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pageSize\",\"type\":\"uint256\"}],\"name\":\"getAllNodeELVaultAddress\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCollateralETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"}],\"name\":\"getOperatorRewardAddress\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"}],\"name\":\"getOperatorTotalKeys\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_totalKeys\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_nodeOperator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_startIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_endIndex\",\"type\":\"uint256\"}],\"name\":\"getOperatorTotalNonTerminalKeys\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"}],\"name\":\"getSocializingPoolStateChangeBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalActiveValidatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalQueuedValidatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_pageNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pageSize\",\"type\":\"uint256\"}],\"name\":\"getValidatorsByOperator\",\"outputs\":[{\"components\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"preDepositSignature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"depositSignature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"withdrawVaultAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawnBlock\",\"type\":\"uint256\"}],\"internalType\":\"structValidator[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"name\":\"increaseTotalActiveValidatorCount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"inputKeyCountLimit\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operAddr\",\"type\":\"address\"}],\"name\":\"isExistingOperator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_pubkey\",\"type\":\"bytes\"}],\"name\":\"isExistingPubkey\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_readyToDepositPubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_frontRunPubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_invalidSignaturePubkey\",\"type\":\"bytes[]\"}],\"name\":\"markValidatorReadyToDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxNonTerminalKeyPerOperator\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextOperatorId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextQueuedValidatorIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextValidatorId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"nodeELRewardVaultByOperatorId\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_optInForSocializingPool\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"_operatorName\",\"type\":\"string\"},{\"internalType\":\"addresspayable\",\"name\":\"_operatorRewardAddress\",\"type\":\"address\"}],\"name\":\"onboardNodeOperator\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"feeRecipientAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"operatorIDByAddress\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"operatorStructById\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"optedForSocializingPool\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"operatorName\",\"type\":\"string\"},{\"internalType\":\"addresspayable\",\"name\":\"operatorRewardAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operatorAddress\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operatorAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newRewardAddress\",\"type\":\"address\"}],\"name\":\"proposeRewardAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"proposedRewardAddressByOperatorId\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"queuedValidators\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"socializingPoolStateChangeBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"staderConfig\",\"outputs\":[{\"internalType\":\"contractIStaderConfig\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalActiveValidatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"transferCollateralToPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_validatorId\",\"type\":\"uint256\"}],\"name\":\"updateDepositStatusAndBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_inputKeyCountLimit\",\"type\":\"uint16\"}],\"name\":\"updateInputKeyCountLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"_maxNonTerminalKeyPerOperator\",\"type\":\"uint64\"}],\"name\":\"updateMaxNonTerminalKeyPerOperator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_nextQueuedValidatorIndex\",\"type\":\"uint256\"}],\"name\":\"updateNextQueuedValidatorIndex\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_operatorName\",\"type\":\"string\"}],\"name\":\"updateOperatorName\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_verifiedKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"updateVerifiedKeysBatchSize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"validatorIdByPubkey\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"validatorIdsByOperatorId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorQueueSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"validatorRegistry\",\"outputs\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"preDepositSignature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"depositSignature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"withdrawVaultAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawnBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"verifiedKeyBatchSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_pubkeys\",\"type\":\"bytes[]\"}],\"name\":\"withdrawnValidators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CallerNotExistingRewardAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotManager\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotNewRewardAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotOperator\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotStaderContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CooldownNotComplete\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DuplicatePoolIDOrPoolNotAdded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InSufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidBondEthValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidKeyCount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidStartAndEndIndex\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MisMatchingInputKeysSize\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoChangeInState\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotEnoughSDCollateral\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorAlreadyOnBoardedInProtocol\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorIsDeactivate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorNotOnBoarded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PageNumberIsZero\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PubkeyAlreadyExist\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooManyVerifiedKeysReported\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooManyWithdrawnKeysReported\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UNEXPECTED_STATUS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"maxKeyLimitReached\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"AddedValidatorKey\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalActiveValidatorCount\",\"type\":\"uint256\"}],\"name\":\"DecreasedTotalActiveValidatorCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalActiveValidatorCount\",\"type\":\"uint256\"}],\"name\":\"IncreasedTotalActiveValidatorCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"nodeRewardAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"optInForSocializingPool\",\"type\":\"bool\"}],\"name\":\"OnboardedOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardAddress\",\"type\":\"address\"}],\"name\":\"OperatorRewardAddressUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardAddress\",\"type\":\"address\"}],\"name\":\"RewardAddressProposed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferredCollateralToPool\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"batchKeyDepositLimit\",\"type\":\"uint256\"}],\"name\":\"UpdatedInputKeyCountLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"maxNonTerminalKeyPerOperator\",\"type\":\"uint64\"}],\"name\":\"UpdatedMaxNonTerminalKeyPerOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextQueuedValidatorIndex\",\"type\":\"uint256\"}],\"name\":\"UpdatedNextQueuedValidatorIndex\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"operatorName\",\"type\":\"string\"}],\"name\":\"UpdatedOperatorName\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"optedForSocializingPool\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"block\",\"type\":\"uint256\"}],\"name\":\"UpdatedSocializingPoolState\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"}],\"name\":\"UpdatedValidatorDepositBlock\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"verifiedKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"UpdatedVerifiedKeyBatchSize\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"withdrawnKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"UpdatedWithdrawnKeyBatchSize\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"referralId\",\"type\":\"string\"}],\"name\":\"ValidatorAddedViaReferral\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorMarkedAsFrontRunned\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorMarkedReadyToDeposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorStatusMarkedAsInvalidSignature\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorWithdrawn\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"COLLATERAL_ETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FRONT_RUN_PENALTY\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"POOL_ID\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_pubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_preDepositSignature\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_depositSignature\",\"type\":\"bytes[]\"}],\"name\":\"addValidatorKeys\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_referralId\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_amountOfSDToUtilize\",\"type\":\"uint256\"},{\"internalType\":\"bytes[]\",\"name\":\"_pubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_preDepositSignature\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_depositSignature\",\"type\":\"bytes[]\"}],\"name\":\"addValidatorKeysWithUtilizeSD\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_optInForSocializingPool\",\"type\":\"bool\"}],\"name\":\"changeSocializingPoolState\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"feeRecipientAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operatorAddress\",\"type\":\"address\"}],\"name\":\"confirmRewardAddressChange\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_pageNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pageSize\",\"type\":\"uint256\"}],\"name\":\"getAllActiveValidators\",\"outputs\":[{\"components\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"preDepositSignature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"depositSignature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"withdrawVaultAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawnBlock\",\"type\":\"uint256\"}],\"internalType\":\"structValidator[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_pageNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pageSize\",\"type\":\"uint256\"}],\"name\":\"getAllNodeELVaultAddress\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCollateralETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"}],\"name\":\"getOperatorRewardAddress\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"}],\"name\":\"getOperatorTotalKeys\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_totalKeys\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_nodeOperator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_startIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_endIndex\",\"type\":\"uint256\"}],\"name\":\"getOperatorTotalNonTerminalKeys\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"}],\"name\":\"getSocializingPoolStateChangeBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalActiveValidatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalQueuedValidatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_pageNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pageSize\",\"type\":\"uint256\"}],\"name\":\"getValidatorsByOperator\",\"outputs\":[{\"components\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"preDepositSignature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"depositSignature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"withdrawVaultAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawnBlock\",\"type\":\"uint256\"}],\"internalType\":\"structValidator[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"name\":\"increaseTotalActiveValidatorCount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"inputKeyCountLimit\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operAddr\",\"type\":\"address\"}],\"name\":\"isExistingOperator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_pubkey\",\"type\":\"bytes\"}],\"name\":\"isExistingPubkey\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_readyToDepositPubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_frontRunPubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_invalidSignaturePubkey\",\"type\":\"bytes[]\"}],\"name\":\"markValidatorReadyToDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxNonTerminalKeyPerOperator\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextOperatorId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextQueuedValidatorIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextValidatorId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"nodeELRewardVaultByOperatorId\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_optInForSocializingPool\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"_operatorName\",\"type\":\"string\"},{\"internalType\":\"addresspayable\",\"name\":\"_operatorRewardAddress\",\"type\":\"address\"}],\"name\":\"onboardNodeOperator\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"feeRecipientAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"operatorIDByAddress\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"operatorStructById\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"optedForSocializingPool\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"operatorName\",\"type\":\"string\"},{\"internalType\":\"addresspayable\",\"name\":\"operatorRewardAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operatorAddress\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operatorAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newRewardAddress\",\"type\":\"address\"}],\"name\":\"proposeRewardAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"proposedRewardAddressByOperatorId\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"queuedValidators\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"socializingPoolStateChangeBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"staderConfig\",\"outputs\":[{\"internalType\":\"contractIStaderConfig\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalActiveValidatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"transferCollateralToPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_validatorId\",\"type\":\"uint256\"}],\"name\":\"updateDepositStatusAndBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_inputKeyCountLimit\",\"type\":\"uint16\"}],\"name\":\"updateInputKeyCountLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"_maxNonTerminalKeyPerOperator\",\"type\":\"uint64\"}],\"name\":\"updateMaxNonTerminalKeyPerOperator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_nextQueuedValidatorIndex\",\"type\":\"uint256\"}],\"name\":\"updateNextQueuedValidatorIndex\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_operatorName\",\"type\":\"string\"}],\"name\":\"updateOperatorName\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_verifiedKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"updateVerifiedKeysBatchSize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"validatorIdByPubkey\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"validatorIdsByOperatorId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorQueueSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"validatorRegistry\",\"outputs\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"preDepositSignature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"depositSignature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"withdrawVaultAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawnBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"verifiedKeyBatchSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_pubkeys\",\"type\":\"bytes[]\"}],\"name\":\"withdrawnValidators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // PermissionlessNodeRegistryABI is the input ABI used to generate the binding from. @@ -1464,25 +1464,25 @@ func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryTransactorSession) return _PermissionlessNodeRegistry.Contract.AddValidatorKeys(&_PermissionlessNodeRegistry.TransactOpts, _pubkey, _preDepositSignature, _depositSignature) } -// AddValidatorKeysWithUtilizeSD is a paid mutator transaction binding the contract method 0x60cb299d. +// AddValidatorKeysWithUtilizeSD is a paid mutator transaction binding the contract method 0x7da55a1e. // -// Solidity: function addValidatorKeysWithUtilizeSD(uint256 _amountOfSDToUtilize, bytes[] _pubkey, bytes[] _preDepositSignature, bytes[] _depositSignature) payable returns() -func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryTransactor) AddValidatorKeysWithUtilizeSD(opts *bind.TransactOpts, _amountOfSDToUtilize *big.Int, _pubkey [][]byte, _preDepositSignature [][]byte, _depositSignature [][]byte) (*types.Transaction, error) { - return _PermissionlessNodeRegistry.contract.Transact(opts, "addValidatorKeysWithUtilizeSD", _amountOfSDToUtilize, _pubkey, _preDepositSignature, _depositSignature) +// Solidity: function addValidatorKeysWithUtilizeSD(string _referralId, uint256 _amountOfSDToUtilize, bytes[] _pubkey, bytes[] _preDepositSignature, bytes[] _depositSignature) payable returns() +func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryTransactor) AddValidatorKeysWithUtilizeSD(opts *bind.TransactOpts, _referralId string, _amountOfSDToUtilize *big.Int, _pubkey [][]byte, _preDepositSignature [][]byte, _depositSignature [][]byte) (*types.Transaction, error) { + return _PermissionlessNodeRegistry.contract.Transact(opts, "addValidatorKeysWithUtilizeSD", _referralId, _amountOfSDToUtilize, _pubkey, _preDepositSignature, _depositSignature) } -// AddValidatorKeysWithUtilizeSD is a paid mutator transaction binding the contract method 0x60cb299d. +// AddValidatorKeysWithUtilizeSD is a paid mutator transaction binding the contract method 0x7da55a1e. // -// Solidity: function addValidatorKeysWithUtilizeSD(uint256 _amountOfSDToUtilize, bytes[] _pubkey, bytes[] _preDepositSignature, bytes[] _depositSignature) payable returns() -func (_PermissionlessNodeRegistry *PermissionlessNodeRegistrySession) AddValidatorKeysWithUtilizeSD(_amountOfSDToUtilize *big.Int, _pubkey [][]byte, _preDepositSignature [][]byte, _depositSignature [][]byte) (*types.Transaction, error) { - return _PermissionlessNodeRegistry.Contract.AddValidatorKeysWithUtilizeSD(&_PermissionlessNodeRegistry.TransactOpts, _amountOfSDToUtilize, _pubkey, _preDepositSignature, _depositSignature) +// Solidity: function addValidatorKeysWithUtilizeSD(string _referralId, uint256 _amountOfSDToUtilize, bytes[] _pubkey, bytes[] _preDepositSignature, bytes[] _depositSignature) payable returns() +func (_PermissionlessNodeRegistry *PermissionlessNodeRegistrySession) AddValidatorKeysWithUtilizeSD(_referralId string, _amountOfSDToUtilize *big.Int, _pubkey [][]byte, _preDepositSignature [][]byte, _depositSignature [][]byte) (*types.Transaction, error) { + return _PermissionlessNodeRegistry.Contract.AddValidatorKeysWithUtilizeSD(&_PermissionlessNodeRegistry.TransactOpts, _referralId, _amountOfSDToUtilize, _pubkey, _preDepositSignature, _depositSignature) } -// AddValidatorKeysWithUtilizeSD is a paid mutator transaction binding the contract method 0x60cb299d. +// AddValidatorKeysWithUtilizeSD is a paid mutator transaction binding the contract method 0x7da55a1e. // -// Solidity: function addValidatorKeysWithUtilizeSD(uint256 _amountOfSDToUtilize, bytes[] _pubkey, bytes[] _preDepositSignature, bytes[] _depositSignature) payable returns() -func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryTransactorSession) AddValidatorKeysWithUtilizeSD(_amountOfSDToUtilize *big.Int, _pubkey [][]byte, _preDepositSignature [][]byte, _depositSignature [][]byte) (*types.Transaction, error) { - return _PermissionlessNodeRegistry.Contract.AddValidatorKeysWithUtilizeSD(&_PermissionlessNodeRegistry.TransactOpts, _amountOfSDToUtilize, _pubkey, _preDepositSignature, _depositSignature) +// Solidity: function addValidatorKeysWithUtilizeSD(string _referralId, uint256 _amountOfSDToUtilize, bytes[] _pubkey, bytes[] _preDepositSignature, bytes[] _depositSignature) payable returns() +func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryTransactorSession) AddValidatorKeysWithUtilizeSD(_referralId string, _amountOfSDToUtilize *big.Int, _pubkey [][]byte, _preDepositSignature [][]byte, _depositSignature [][]byte) (*types.Transaction, error) { + return _PermissionlessNodeRegistry.Contract.AddValidatorKeysWithUtilizeSD(&_PermissionlessNodeRegistry.TransactOpts, _referralId, _amountOfSDToUtilize, _pubkey, _preDepositSignature, _depositSignature) } // ChangeSocializingPoolState is a paid mutator transaction binding the contract method 0xf90b0838. @@ -5035,6 +5035,141 @@ func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryFilterer) ParseUpda return event, nil } +// PermissionlessNodeRegistryValidatorAddedViaReferralIterator is returned from FilterValidatorAddedViaReferral and is used to iterate over the raw logs and unpacked data for ValidatorAddedViaReferral events raised by the PermissionlessNodeRegistry contract. +type PermissionlessNodeRegistryValidatorAddedViaReferralIterator struct { + Event *PermissionlessNodeRegistryValidatorAddedViaReferral // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *PermissionlessNodeRegistryValidatorAddedViaReferralIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(PermissionlessNodeRegistryValidatorAddedViaReferral) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(PermissionlessNodeRegistryValidatorAddedViaReferral) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *PermissionlessNodeRegistryValidatorAddedViaReferralIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *PermissionlessNodeRegistryValidatorAddedViaReferralIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// PermissionlessNodeRegistryValidatorAddedViaReferral represents a ValidatorAddedViaReferral event raised by the PermissionlessNodeRegistry contract. +type PermissionlessNodeRegistryValidatorAddedViaReferral struct { + Amount *big.Int + ReferralId string + Raw types.Log // Blockchain specific contextual infos +} + +// FilterValidatorAddedViaReferral is a free log retrieval operation binding the contract event 0xf1d3fcd20d6cf75aba4ee663e1e3bd6eb614be29d5d9d2b5b1c58238a2da26dd. +// +// Solidity: event ValidatorAddedViaReferral(uint256 amount, string referralId) +func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryFilterer) FilterValidatorAddedViaReferral(opts *bind.FilterOpts) (*PermissionlessNodeRegistryValidatorAddedViaReferralIterator, error) { + + logs, sub, err := _PermissionlessNodeRegistry.contract.FilterLogs(opts, "ValidatorAddedViaReferral") + if err != nil { + return nil, err + } + return &PermissionlessNodeRegistryValidatorAddedViaReferralIterator{contract: _PermissionlessNodeRegistry.contract, event: "ValidatorAddedViaReferral", logs: logs, sub: sub}, nil +} + +// WatchValidatorAddedViaReferral is a free log subscription operation binding the contract event 0xf1d3fcd20d6cf75aba4ee663e1e3bd6eb614be29d5d9d2b5b1c58238a2da26dd. +// +// Solidity: event ValidatorAddedViaReferral(uint256 amount, string referralId) +func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryFilterer) WatchValidatorAddedViaReferral(opts *bind.WatchOpts, sink chan<- *PermissionlessNodeRegistryValidatorAddedViaReferral) (event.Subscription, error) { + + logs, sub, err := _PermissionlessNodeRegistry.contract.WatchLogs(opts, "ValidatorAddedViaReferral") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(PermissionlessNodeRegistryValidatorAddedViaReferral) + if err := _PermissionlessNodeRegistry.contract.UnpackLog(event, "ValidatorAddedViaReferral", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseValidatorAddedViaReferral is a log parse operation binding the contract event 0xf1d3fcd20d6cf75aba4ee663e1e3bd6eb614be29d5d9d2b5b1c58238a2da26dd. +// +// Solidity: event ValidatorAddedViaReferral(uint256 amount, string referralId) +func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryFilterer) ParseValidatorAddedViaReferral(log types.Log) (*PermissionlessNodeRegistryValidatorAddedViaReferral, error) { + event := new(PermissionlessNodeRegistryValidatorAddedViaReferral) + if err := _PermissionlessNodeRegistry.contract.UnpackLog(event, "ValidatorAddedViaReferral", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + // PermissionlessNodeRegistryValidatorMarkedAsFrontRunnedIterator is returned from FilterValidatorMarkedAsFrontRunned and is used to iterate over the raw logs and unpacked data for ValidatorMarkedAsFrontRunned events raised by the PermissionlessNodeRegistry contract. type PermissionlessNodeRegistryValidatorMarkedAsFrontRunnedIterator struct { Event *PermissionlessNodeRegistryValidatorMarkedAsFrontRunned // Event containing the contract specifics and raw log diff --git a/stader-lib/node/validator.go b/stader-lib/node/validator.go index 45990548c..416ca9dcc 100644 --- a/stader-lib/node/validator.go +++ b/stader-lib/node/validator.go @@ -15,6 +15,7 @@ import ( func EstimateAddValidatorKeys( pnr *stader.PermissionlessNodeRegistryContractManager, + referralID string, utilityAmount *big.Int, pubKeys [][]byte, preDepositSignatures [][]byte, @@ -24,6 +25,7 @@ func EstimateAddValidatorKeys( return pnr.PermissionlessNodeRegistryContract.GetTransactionGasInfo( opts, "addValidatorKeysWithUtilizeSD", + referralID, utilityAmount, pubKeys, preDepositSignatures, @@ -33,12 +35,13 @@ func EstimateAddValidatorKeys( func AddValidatorKeysWithAmount( pnr *stader.PermissionlessNodeRegistryContractManager, + referralID string, pubKeys [][]byte, preDepositSignatures [][]byte, depositSignatures [][]byte, utilityAmount *big.Int, opts *bind.TransactOpts) (*types.Transaction, error) { - tx, err := pnr.PermissionlessNodeRegistry.AddValidatorKeysWithUtilizeSD(opts, utilityAmount, pubKeys, preDepositSignatures, depositSignatures) + tx, err := pnr.PermissionlessNodeRegistry.AddValidatorKeysWithUtilizeSD(opts, referralID, utilityAmount, pubKeys, preDepositSignatures, depositSignatures) if err != nil { return nil, fmt.Errorf("could not add validator keys with utilize: %w", err) } diff --git a/stader-lib/sdutility/sd-utility.go b/stader-lib/sdutility/sd-utility.go index fe751205d..80cbb62f7 100644 --- a/stader-lib/sdutility/sd-utility.go +++ b/stader-lib/sdutility/sd-utility.go @@ -6,6 +6,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + "github.com/stader-labs/stader-node/stader-lib/contracts" "github.com/stader-labs/stader-node/stader-lib/stader" ) @@ -96,3 +97,12 @@ func GetUtilizationRate(sp *stader.SDUtilityPoolContractManager, opts *bind.Call return utilizationRateInPercent, nil } + +func GetUserData(sp *stader.SDUtilityPoolContractManager, address common.Address, opts *bind.CallOpts) (*contracts.UserData, error) { + userData, err := sp.SDUtilityPool.GetUserData(opts, address) + if err != nil { + return nil, err + } + + return &userData, nil +} diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index 0a01fad18..c94cf7dcf 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -37,6 +37,11 @@ func GetSDStatus( return nil, err } + userData, err := sdutility.GetUserData(sdu, operatorAddress, nil) + if err != nil { + return nil, err + } + poolAvailableSDBalance, err := sdutility.GetPoolAvailableSDBalance(sdu, nil) if err != nil { return nil, err @@ -94,6 +99,7 @@ func GetSDStatus( SdUtilizedBalance: sdUtilizedBalance, PoolAvailableSDBalance: poolAvailableSDBalance, SdRewardEligible: rewardEligibleSD, + HealthFactor: userData.HealthFactor, }, nil } @@ -265,6 +271,7 @@ func canNodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidato gasInfo, err := node.EstimateAddValidatorKeys( prn, + "referralID", utilityAmountWei, pubKeys, preDepositSignatures, @@ -421,7 +428,9 @@ func nodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidators return nil, fmt.Errorf("error checking for nonce override: %w", err) } - tx, err := node.AddValidatorKeysWithAmount(prn, + tx, err := node.AddValidatorKeysWithAmount( + prn, + "han_local", pubKeys, preDepositSignatures, depositSignatures, From cf1a20237fc48c054f03a6cb0663867ba63b7d52 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 26 Dec 2023 22:42:58 +0700 Subject: [PATCH 087/159] Revert "Update contract" This reverts commit a832fcd5c8c6bfd24ffee884da7fc637abcbadee. --- abis/PermissionlessNodeRegistry.abi.json | 554 +++----------- abis/SDUtilityPool.abi.json | 692 +++++++++++++++++- shared/types/api/node.go | 1 - stader-cli/node/status.go | 151 ++-- .../contracts/permissionless-node-registry.go | 161 +--- stader-lib/node/validator.go | 5 +- stader-lib/sdutility/sd-utility.go | 10 - stader/api/validator/deposit.go | 11 +- 8 files changed, 866 insertions(+), 719 deletions(-) diff --git a/abis/PermissionlessNodeRegistry.abi.json b/abis/PermissionlessNodeRegistry.abi.json index 7377f2e86..bd36bf44f 100644 --- a/abis/PermissionlessNodeRegistry.abi.json +++ b/abis/PermissionlessNodeRegistry.abi.json @@ -1,134 +1,34 @@ [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "CallerNotExistingRewardAddress", - "type": "error" - }, - { - "inputs": [], - "name": "CallerNotManager", - "type": "error" - }, - { - "inputs": [], - "name": "CallerNotNewRewardAddress", - "type": "error" - }, - { - "inputs": [], - "name": "CallerNotOperator", - "type": "error" - }, - { - "inputs": [], - "name": "CallerNotStaderContract", - "type": "error" - }, - { - "inputs": [], - "name": "CooldownNotComplete", - "type": "error" - }, - { - "inputs": [], - "name": "DuplicatePoolIDOrPoolNotAdded", - "type": "error" - }, - { - "inputs": [], - "name": "InSufficientBalance", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidBondEthValue", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidKeyCount", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidStartAndEndIndex", - "type": "error" - }, - { - "inputs": [], - "name": "MisMatchingInputKeysSize", - "type": "error" - }, - { - "inputs": [], - "name": "NoChangeInState", - "type": "error" - }, - { - "inputs": [], - "name": "NotEnoughSDCollateral", - "type": "error" - }, + { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, + { "inputs": [], "name": "CallerNotExistingRewardAddress", "type": "error" }, + { "inputs": [], "name": "CallerNotManager", "type": "error" }, + { "inputs": [], "name": "CallerNotNewRewardAddress", "type": "error" }, + { "inputs": [], "name": "CallerNotOperator", "type": "error" }, + { "inputs": [], "name": "CallerNotStaderContract", "type": "error" }, + { "inputs": [], "name": "CooldownNotComplete", "type": "error" }, + { "inputs": [], "name": "DuplicatePoolIDOrPoolNotAdded", "type": "error" }, + { "inputs": [], "name": "InSufficientBalance", "type": "error" }, + { "inputs": [], "name": "InvalidBondEthValue", "type": "error" }, + { "inputs": [], "name": "InvalidKeyCount", "type": "error" }, + { "inputs": [], "name": "InvalidStartAndEndIndex", "type": "error" }, + { "inputs": [], "name": "MisMatchingInputKeysSize", "type": "error" }, + { "inputs": [], "name": "NoChangeInState", "type": "error" }, + { "inputs": [], "name": "NotEnoughSDCollateral", "type": "error" }, { "inputs": [], "name": "OperatorAlreadyOnBoardedInProtocol", "type": "error" }, - { - "inputs": [], - "name": "OperatorIsDeactivate", - "type": "error" - }, - { - "inputs": [], - "name": "OperatorNotOnBoarded", - "type": "error" - }, - { - "inputs": [], - "name": "PageNumberIsZero", - "type": "error" - }, - { - "inputs": [], - "name": "PubkeyAlreadyExist", - "type": "error" - }, - { - "inputs": [], - "name": "TooManyVerifiedKeysReported", - "type": "error" - }, - { - "inputs": [], - "name": "TooManyWithdrawnKeysReported", - "type": "error" - }, - { - "inputs": [], - "name": "TransferFailed", - "type": "error" - }, - { - "inputs": [], - "name": "UNEXPECTED_STATUS", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "maxKeyLimitReached", - "type": "error" - }, + { "inputs": [], "name": "OperatorIsDeactivate", "type": "error" }, + { "inputs": [], "name": "OperatorNotOnBoarded", "type": "error" }, + { "inputs": [], "name": "PageNumberIsZero", "type": "error" }, + { "inputs": [], "name": "PubkeyAlreadyExist", "type": "error" }, + { "inputs": [], "name": "TooManyVerifiedKeysReported", "type": "error" }, + { "inputs": [], "name": "TooManyWithdrawnKeysReported", "type": "error" }, + { "inputs": [], "name": "TransferFailed", "type": "error" }, + { "inputs": [], "name": "UNEXPECTED_STATUS", "type": "error" }, + { "inputs": [], "name": "ZeroAddress", "type": "error" }, + { "inputs": [], "name": "maxKeyLimitReached", "type": "error" }, { "anonymous": false, "inputs": [ @@ -517,25 +417,6 @@ "name": "UpdatedWithdrawnKeyBatchSize", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "string", - "name": "referralId", - "type": "string" - } - ], - "name": "ValidatorAddedViaReferral", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -616,11 +497,7 @@ "inputs": [], "name": "COLLATERAL_ETH", "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" @@ -629,11 +506,7 @@ "inputs": [], "name": "DEFAULT_ADMIN_ROLE", "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } + { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" @@ -642,11 +515,7 @@ "inputs": [], "name": "FRONT_RUN_PENALTY", "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" @@ -654,23 +523,13 @@ { "inputs": [], "name": "POOL_ID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], "stateMutability": "view", "type": "function" }, { "inputs": [ - { - "internalType": "bytes[]", - "name": "_pubkey", - "type": "bytes[]" - }, + { "internalType": "bytes[]", "name": "_pubkey", "type": "bytes[]" }, { "internalType": "bytes[]", "name": "_preDepositSignature", @@ -689,21 +548,12 @@ }, { "inputs": [ - { - "internalType": "string", - "name": "_referralId", - "type": "string" - }, { "internalType": "uint256", "name": "_amountOfSDToUtilize", "type": "uint256" }, - { - "internalType": "bytes[]", - "name": "_pubkey", - "type": "bytes[]" - }, + { "internalType": "bytes[]", "name": "_pubkey", "type": "bytes[]" }, { "internalType": "bytes[]", "name": "_preDepositSignature", @@ -833,11 +683,7 @@ ], "name": "getAllNodeELVaultAddress", "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } + { "internalType": "address[]", "name": "", "type": "address[]" } ], "stateMutability": "view", "type": "function" @@ -846,11 +692,7 @@ "inputs": [], "name": "getCollateralETH", "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "pure", "type": "function" @@ -865,11 +707,7 @@ ], "name": "getOperatorRewardAddress", "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } + { "internalType": "address payable", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" @@ -912,31 +750,17 @@ } ], "name": "getOperatorTotalNonTerminalKeys", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], + "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } + { "internalType": "bytes32", "name": "role", "type": "bytes32" } ], "name": "getRoleAdmin", "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } + { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" @@ -951,11 +775,7 @@ ], "name": "getSocializingPoolStateChangeBlock", "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" @@ -964,11 +784,7 @@ "inputs": [], "name": "getTotalActiveValidatorCount", "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" @@ -977,11 +793,7 @@ "inputs": [], "name": "getTotalQueuedValidatorCount", "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" @@ -1059,16 +871,8 @@ }, { "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } ], "name": "grantRole", "outputs": [], @@ -1077,35 +881,17 @@ }, { "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } ], "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [ - { - "internalType": "uint256", - "name": "_count", - "type": "uint256" - } + { "internalType": "uint256", "name": "_count", "type": "uint256" } ], "name": "increaseTotalActiveValidatorCount", "outputs": [], @@ -1114,11 +900,7 @@ }, { "inputs": [ - { - "internalType": "address", - "name": "_admin", - "type": "address" - }, + { "internalType": "address", "name": "_admin", "type": "address" }, { "internalType": "address", "name": "_staderConfig", @@ -1133,13 +915,7 @@ { "inputs": [], "name": "inputKeyCountLimit", - "outputs": [ - { - "internalType": "uint16", - "name": "", - "type": "uint16" - } - ], + "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "stateMutability": "view", "type": "function" }, @@ -1152,32 +928,16 @@ } ], "name": "isExistingOperator", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [ - { - "internalType": "bytes", - "name": "_pubkey", - "type": "bytes" - } + { "internalType": "bytes", "name": "_pubkey", "type": "bytes" } ], "name": "isExistingPubkey", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, @@ -1207,13 +967,7 @@ { "inputs": [], "name": "maxNonTerminalKeyPerOperator", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], + "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, @@ -1221,11 +975,7 @@ "inputs": [], "name": "nextOperatorId", "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" @@ -1234,11 +984,7 @@ "inputs": [], "name": "nextQueuedValidatorIndex", "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" @@ -1247,30 +993,18 @@ "inputs": [], "name": "nextValidatorId", "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "nodeELRewardVaultByOperatorId", "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } + { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" @@ -1306,38 +1040,22 @@ }, { "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } + { "internalType": "address", "name": "", "type": "address" } ], "name": "operatorIDByAddress", "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "operatorStructById", "outputs": [ - { - "internalType": "bool", - "name": "active", - "type": "bool" - }, + { "internalType": "bool", "name": "active", "type": "bool" }, { "internalType": "bool", "name": "optedForSocializingPool", @@ -1372,13 +1090,7 @@ { "inputs": [], "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, @@ -1402,54 +1114,30 @@ }, { "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "proposedRewardAddressByOperatorId", "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } + { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "queuedValidators", "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } ], "name": "renounceRole", "outputs": [], @@ -1458,16 +1146,8 @@ }, { "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } ], "name": "revokeRole", "outputs": [], @@ -1476,19 +1156,11 @@ }, { "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "socializingPoolStateChangeBlock", "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" @@ -1515,13 +1187,7 @@ } ], "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, @@ -1529,22 +1195,14 @@ "inputs": [], "name": "totalActiveValidatorCount", "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } + { "internalType": "uint256", "name": "_amount", "type": "uint256" } ], "name": "transferCollateralToPool", "outputs": [], @@ -1650,44 +1308,22 @@ "type": "function" }, { - "inputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], + "inputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], "name": "validatorIdByPubkey", "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "validatorIdsByOperatorId", "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" @@ -1696,22 +1332,14 @@ "inputs": [], "name": "validatorQueueSize", "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "validatorRegistry", "outputs": [ @@ -1720,11 +1348,7 @@ "name": "status", "type": "uint8" }, - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, + { "internalType": "bytes", "name": "pubkey", "type": "bytes" }, { "internalType": "bytes", "name": "preDepositSignature", @@ -1763,22 +1387,14 @@ "inputs": [], "name": "verifiedKeyBatchSize", "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { - "internalType": "bytes[]", - "name": "_pubkeys", - "type": "bytes[]" - } + { "internalType": "bytes[]", "name": "_pubkeys", "type": "bytes[]" } ], "name": "withdrawnValidators", "outputs": [], diff --git a/abis/SDUtilityPool.abi.json b/abis/SDUtilityPool.abi.json index 3b746ba5a..5cd338445 100644 --- a/abis/SDUtilityPool.abi.json +++ b/abis/SDUtilityPool.abi.json @@ -1,4 +1,9 @@ [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, { "inputs": [], "name": "AccrualBlockNumberNotLatest", @@ -19,6 +24,16 @@ "name": "CallerNotAuthorizedToRedeem", "type": "error" }, + { + "inputs": [], + "name": "CallerNotManager", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotStaderContract", + "type": "error" + }, { "inputs": [], "name": "CannotFindRequestId", @@ -85,6 +100,11 @@ "name": "SDUtilizeLimitReached", "type": "error" }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, { "anonymous": false, "inputs": [ @@ -161,6 +181,19 @@ "name": "FinalizedWithdrawRequest", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -198,6 +231,19 @@ "name": "LiquidationCall", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -305,6 +351,81 @@ "name": "RiskConfigUpdated", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -324,6 +445,19 @@ "name": "SDUtilized", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -453,6 +587,71 @@ "name": "WithdrawnProtocolFee", "type": "event" }, + { + "inputs": [], + "name": "DECIMAL", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_PROTOCOL_FEE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_UTILIZATION_RATE_PER_BLOCK", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "accrualBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "accrueFee", @@ -460,6 +659,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "accumulatedProtocolFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "cTokenTotalSupply", @@ -477,7 +689,7 @@ "inputs": [ { "internalType": "uint256", - "name": "requestId", + "name": "_requestId", "type": "uint256" } ], @@ -499,6 +711,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "conservativeEthPerKey", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -615,6 +840,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "finalizationBatchLimit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "finalizeDelegatorWithdrawalRequest", @@ -684,7 +922,7 @@ "inputs": [ { "internalType": "address", - "name": "", + "name": "account", "type": "address" } ], @@ -731,6 +969,25 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "getOperatorTotalEth", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "getPoolAvailableSDBalance", @@ -748,7 +1005,7 @@ "inputs": [ { "internalType": "address", - "name": "_owner", + "name": "_delegator", "type": "address" } ], @@ -763,6 +1020,25 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -825,32 +1101,208 @@ }, { "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, { "internalType": "address", "name": "account", "type": "address" } ], - "name": "liquidationCall", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "maxApproveSD", + "name": "grantRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { - "inputs": [], - "name": "maxETHWorthOfSDPerValidator", + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", "outputs": [ { - "internalType": "uint256", + "internalType": "bool", "name": "", - "type": "uint256" + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_admin", + "type": "address" + }, + { + "internalType": "address", + "name": "_staderConfig", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "liquidationCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "liquidations", + "outputs": [ + { + "internalType": "uint256", + "name": "totalAmountInEth", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBonusInEth", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalFeeInEth", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isRepaid", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isClaimed", + "type": "bool" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxApproveSD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "maxETHWorthOfSDPerValidator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxNonRedeemedDelegatorRequestCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minBlockDelayToFinalizeRequest", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextRequestId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextRequestIdToFinalize", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" } ], "stateMutability": "view", @@ -869,6 +1321,37 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "protocolFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -881,12 +1364,12 @@ "outputs": [ { "internalType": "uint256", - "name": "", + "name": "repaidAmount", "type": "uint256" }, { "internalType": "uint256", - "name": "", + "name": "feePaid", "type": "uint256" } ], @@ -910,12 +1393,12 @@ "outputs": [ { "internalType": "uint256", - "name": "", + "name": "repaidAmount", "type": "uint256" }, { "internalType": "uint256", - "name": "", + "name": "feePaid", "type": "uint256" } ], @@ -950,7 +1433,7 @@ "inputs": [ { "internalType": "uint256", - "name": "cTokenAmount", + "name": "_cTokenAmount", "type": "uint256" } ], @@ -958,7 +1441,7 @@ "outputs": [ { "internalType": "uint256", - "name": "", + "name": "_requestId", "type": "uint256" } ], @@ -969,11 +1452,83 @@ "inputs": [ { "internalType": "uint256", - "name": "sdAmount", + "name": "_sdAmount", "type": "uint256" } ], "name": "requestWithdrawWithSDAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "_requestId", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "riskConfig", + "outputs": [ + { + "internalType": "uint256", + "name": "liquidationThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationBonusPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationFeePercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "ltv", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "sdRequestedForWithdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "sdReservedForClaim", "outputs": [ { "internalType": "uint256", @@ -981,6 +1536,58 @@ "type": "uint256" } ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "staderConfig", + "outputs": [ + { + "internalType": "contract IStaderConfig", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalUtilizedSD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], "stateMutability": "nonpayable", "type": "function" }, @@ -1062,6 +1669,34 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "liquidationThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationBonusPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationFeePercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "ltv", + "type": "uint256" + } + ], + "name": "updateRiskConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -1114,6 +1749,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "utilizeIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { diff --git a/shared/types/api/node.go b/shared/types/api/node.go index b1966384a..6c335b23f 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -454,7 +454,6 @@ type SdStatusResponse struct { SdBalance *big.Int `json:"sdBalance"` PoolAvailableSDBalance *big.Int `json:"poolAvailableSDBalance"` SdRewardEligible *big.Int `json:"sdRewardEligible"` - HealthFactor *big.Int `json:"healthFactor"` NotEnoughSdCollateral bool `json:"notEnoughSdCollateral"` } diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 4e2076caf..ef3a06610 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -71,6 +71,42 @@ func getNodeStatus(c *cli.Context) error { noOfValidatorsWeCanRegister = noOfValidatorsWeCanRegisterBasedOnEthBalance } + // Account address & balances + fmt.Printf("%s=== Account and Balances ===%s\n", log.ColorGreen, log.ColorReset) + fmt.Printf( + "The node %s%s%s has a balance of %.6f ETH.\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, + math.RoundDown(eth.WeiToEth(status.AccountBalances.ETH), 6)) + fmt.Printf( + "The node %s%s%s has a balance of %.6f SD.\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, + math.RoundDown(eth.WeiToEth(status.AccountBalances.Sd), 18)) + + fmt.Printf( + "The node %s%s%s has a deposited %d Eth as collateral.\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, + totalEthCollateral) + + fmt.Printf( + "The node %s%s%s has a deposited %.6f SD as collateral.\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, + math.RoundDown(eth.WeiToEth(status.DepositedSdCollateral), 18)) + + fmt.Printf( + "The node %s%s%s can register %d more validators based on the ETH balance and the SD collateral provided.\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, + noOfValidatorsWeCanRegister) + fmt.Printf("%s=== Operator Registration Details ===%s\n", log.ColorGreen, log.ColorReset) if !status.Registered { @@ -78,6 +114,7 @@ func getNodeStatus(c *cli.Context) error { return nil } + fmt.Printf("The operator is registered with Stader. Below are operator details:\n") fmt.Printf("Operator Id: %d\n\n", status.OperatorId) fmt.Printf("Operator Name: %s\n\n", status.OperatorName) fmt.Printf("Operator Address: %s\n\n", status.OperatorAddress.String()) @@ -87,13 +124,12 @@ func getNodeStatus(c *cli.Context) error { } else { fmt.Printf("Operator Status: Not Active\n\n") } - - fmt.Printf("The Operator has registered a total of %d validators (To view details of each validator, please use the `stader-cli validator status` command)\n\n", len(status.ValidatorInfos)) + fmt.Printf("The Operator has registered a total of %d validators\n\n", len(status.ValidatorInfos)) if !status.OptedInForSocializingPool { - fmt.Printf("The Operator has Opted Out for Socializing Pool\n\n") + fmt.Printf("Operator has Opted Out for Socializing Pool\n\n") } else { - fmt.Printf("The Operator has Opted In for Socializing Pool\n\n") + fmt.Printf("Operator has Opted In for Socializing Pool\n\n") } if totalUnclaimedSocializingPoolSd.Cmp(big.NewInt(0)) > 0 { @@ -121,88 +157,93 @@ func getNodeStatus(c *cli.Context) error { fmt.Printf("To transfer the claims to your operator reward address use the %sstader-cli node claim-rewards%s command\n\n", log.ColorGreen, log.ColorReset) } - fmt.Printf( - "The Operator can register %d more validators considering the ETH balance and SD availability in the Operator Address and Utility Pool.\n\n", - noOfValidatorsWeCanRegister) + fmt.Printf("%s=== Registered Validator Details ===%s\n", log.ColorGreen, log.ColorReset) - // Account address & balances + fmt.Printf("To view details of each validator, please use the %sstader-cli validator status%s command\n\n", log.ColorGreen, log.ColorReset) + + // Get node SD status + sdStatusResp, err := staderClient.GetSDStatus(big.NewInt(0)) + if err != nil { + return err + } + + fmt.Printf("%s=== SD utilization Details ===%s\n", log.ColorGreen, log.ColorReset) + + sdStatus := sdStatusResp.SDStatus - fmt.Printf("%s=== Account and Balances ===%s\n", log.ColorGreen, log.ColorReset) fmt.Printf( - "The Operator %s%s%s has a balance of %.6f ETH.\n\n", + "The node %s%s%s currently utilizes %.6f SD.\n\n", log.ColorBlue, status.AccountAddress, log.ColorReset, - math.RoundDown(eth.WeiToEth(status.AccountBalances.ETH), 6)) + math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizedBalance), eth.Decimal)) + fmt.Printf( - "The Operator %s%s%s has a balance of %.6f SD.\n\n", + "The node %s%s%s has SD Utilization Position (including the fee) %.6f SD.\n\n", log.ColorBlue, status.AccountAddress, log.ColorReset, - math.RoundDown(eth.WeiToEth(status.AccountBalances.Sd), 18)) + math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizerLatestBalance), eth.Decimal)) fmt.Printf( - "The Operator has a deposited %d ETH as collateral.\n\n", - totalEthCollateral) + "The node %s%s%s requires %.6f SD in collateral.\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, + math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralRequireAmount), eth.Decimal)) - // Get node SD status - sdStatusResp, err := staderClient.GetSDStatus(big.NewInt(0)) - if err != nil { - return err - } - collateralPct := 0.0 - sdStatus := sdStatusResp.SDStatus totalCollateral := new(big.Int).Add(sdStatus.SdCollateralCurrentAmount, sdStatus.SdUtilizerLatestBalance) - - current := eth.WeiToEth(totalCollateral) - require := eth.WeiToEth(sdStatus.SdCollateralRequireAmount) - - if require > 0 { - collateralPct = current / require * 10 - } - fmt.Printf( - "The Operator has a deposited %.6f SD (%.6f%s) as collateral. Below is the break-up: \n\n", - math.RoundDown(eth.WeiToEth(status.DepositedSdCollateral), 18), collateralPct, "%") + "The node %s%s%s current has %.6f SD in collateral.\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, + math.RoundDown(eth.WeiToEth(totalCollateral), eth.Decimal)) fmt.Printf( - "Self-bonded: %.6f SD \n\n", + "The node %s%s%s current had %.6f SD in self bond.\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralCurrentAmount), eth.Decimal)) - fmt.Printf( - "Utilized from the Utility Pool: %.6f SD.\n\n", - math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizedBalance), eth.Decimal)) + maxUtilizable := new(big.Int).Sub(sdStatus.SdMaxUtilizableAmount, sdStatus.SdUtilizerLatestBalance) + if maxUtilizable.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { + maxUtilizable = sdStatus.PoolAvailableSDBalance + } fmt.Printf( - "Noted: For the %d validator, the minimum SD collateral should be %.6f SD (%s) to be eligible for the SD rewards. Please ensure that the SD collateral percentage is greater than %s. The SD collateral snapshots are taken daily at a random block, and if the SD collateral value falls below the %s limit, the node operator will not earn SD rewards for that day.\n\n", - len(status.ValidatorInfos), - math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralRequireAmount), eth.Decimal), - "10%", "10%", "10%") + "The node %s%s%s can utilize max of %.6f SD.\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, + eth.WeiToEth(maxUtilizable)) - fmt.Printf("%s=== SD utilization Details ===%s\n", log.ColorGreen, log.ColorReset) + fmt.Printf( + "The SD utility can provide max of %.6f SD.\n\n", + math.RoundDown(eth.WeiToEth(sdStatus.PoolAvailableSDBalance), eth.Decimal)) - fmt.Printf("The Operator has utilized %.6f SD from the Utility Pool.\n\n", - math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizedBalance), eth.Decimal)) + collateralPct := 0.0 - fmt.Printf("The Operator has a current Utilization Position of %.6f SD. (including the utilization fee) Note: For repayment of your utilized SD, please use the `stader-cli node repay-sd ` command.\n\n", - math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizerLatestBalance), eth.Decimal)) + current := eth.WeiToEth(totalCollateral) + require := eth.WeiToEth(sdStatus.SdCollateralRequireAmount) - maxUtilizable := new(big.Int).Sub(sdStatus.SdMaxUtilizableAmount, sdStatus.SdUtilizerLatestBalance) - if maxUtilizable.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { - maxUtilizable = sdStatus.PoolAvailableSDBalance + if require > 0 { + collateralPct = current / require * 10 } fmt.Printf( - "The Operator can utilize upto %.6f SD more.\nNote: The Operator can utilize a maximum of 1 ETH worth SD per validator.\n\n", - eth.WeiToEth(maxUtilizable)) + "The node %s%s%s current had %.6f%s Collateral.\nPlease ensure that the SD collateral percentage is greater than %s. The SD collateral snapshots are taken daily at a random block, and if the SD collateral value falls below the %s limit, the node operator will not earn SD rewards for that day\n\n", + log.ColorBlue, + status.AccountAddress, + log.ColorReset, + collateralPct, "%", "10%", "10%") fmt.Printf( - "The Operator has a Health Factor of %s. \nNote: Please ensure your Health Factor is greater than 1 to avoid liquidations.", - sdStatus.HealthFactor.String()) - + "The SD utility require %.6f SD.\n\n", + math.RoundDown(require, eth.Decimal)) fmt.Printf( - "The Utility Pool currently has a balance of %.6f SD.\n\n", + "The SD utility can provide max of %.6f SD.\n\n", math.RoundDown(eth.WeiToEth(sdStatus.PoolAvailableSDBalance), eth.Decimal)) - return nil } diff --git a/stader-lib/contracts/permissionless-node-registry.go b/stader-lib/contracts/permissionless-node-registry.go index 05464ec9e..68169e67f 100644 --- a/stader-lib/contracts/permissionless-node-registry.go +++ b/stader-lib/contracts/permissionless-node-registry.go @@ -43,7 +43,7 @@ type Validator struct { // PermissionlessNodeRegistryMetaData contains all meta data concerning the PermissionlessNodeRegistry contract. var PermissionlessNodeRegistryMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CallerNotExistingRewardAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotManager\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotNewRewardAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotOperator\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotStaderContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CooldownNotComplete\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DuplicatePoolIDOrPoolNotAdded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InSufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidBondEthValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidKeyCount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidStartAndEndIndex\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MisMatchingInputKeysSize\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoChangeInState\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotEnoughSDCollateral\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorAlreadyOnBoardedInProtocol\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorIsDeactivate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorNotOnBoarded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PageNumberIsZero\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PubkeyAlreadyExist\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooManyVerifiedKeysReported\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooManyWithdrawnKeysReported\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UNEXPECTED_STATUS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"maxKeyLimitReached\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"AddedValidatorKey\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalActiveValidatorCount\",\"type\":\"uint256\"}],\"name\":\"DecreasedTotalActiveValidatorCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalActiveValidatorCount\",\"type\":\"uint256\"}],\"name\":\"IncreasedTotalActiveValidatorCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"nodeRewardAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"optInForSocializingPool\",\"type\":\"bool\"}],\"name\":\"OnboardedOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardAddress\",\"type\":\"address\"}],\"name\":\"OperatorRewardAddressUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardAddress\",\"type\":\"address\"}],\"name\":\"RewardAddressProposed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferredCollateralToPool\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"batchKeyDepositLimit\",\"type\":\"uint256\"}],\"name\":\"UpdatedInputKeyCountLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"maxNonTerminalKeyPerOperator\",\"type\":\"uint64\"}],\"name\":\"UpdatedMaxNonTerminalKeyPerOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextQueuedValidatorIndex\",\"type\":\"uint256\"}],\"name\":\"UpdatedNextQueuedValidatorIndex\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"operatorName\",\"type\":\"string\"}],\"name\":\"UpdatedOperatorName\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"optedForSocializingPool\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"block\",\"type\":\"uint256\"}],\"name\":\"UpdatedSocializingPoolState\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"}],\"name\":\"UpdatedValidatorDepositBlock\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"verifiedKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"UpdatedVerifiedKeyBatchSize\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"withdrawnKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"UpdatedWithdrawnKeyBatchSize\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"referralId\",\"type\":\"string\"}],\"name\":\"ValidatorAddedViaReferral\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorMarkedAsFrontRunned\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorMarkedReadyToDeposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorStatusMarkedAsInvalidSignature\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorWithdrawn\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"COLLATERAL_ETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FRONT_RUN_PENALTY\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"POOL_ID\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_pubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_preDepositSignature\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_depositSignature\",\"type\":\"bytes[]\"}],\"name\":\"addValidatorKeys\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_referralId\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_amountOfSDToUtilize\",\"type\":\"uint256\"},{\"internalType\":\"bytes[]\",\"name\":\"_pubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_preDepositSignature\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_depositSignature\",\"type\":\"bytes[]\"}],\"name\":\"addValidatorKeysWithUtilizeSD\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_optInForSocializingPool\",\"type\":\"bool\"}],\"name\":\"changeSocializingPoolState\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"feeRecipientAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operatorAddress\",\"type\":\"address\"}],\"name\":\"confirmRewardAddressChange\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_pageNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pageSize\",\"type\":\"uint256\"}],\"name\":\"getAllActiveValidators\",\"outputs\":[{\"components\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"preDepositSignature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"depositSignature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"withdrawVaultAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawnBlock\",\"type\":\"uint256\"}],\"internalType\":\"structValidator[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_pageNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pageSize\",\"type\":\"uint256\"}],\"name\":\"getAllNodeELVaultAddress\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCollateralETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"}],\"name\":\"getOperatorRewardAddress\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"}],\"name\":\"getOperatorTotalKeys\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_totalKeys\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_nodeOperator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_startIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_endIndex\",\"type\":\"uint256\"}],\"name\":\"getOperatorTotalNonTerminalKeys\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"}],\"name\":\"getSocializingPoolStateChangeBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalActiveValidatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalQueuedValidatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_pageNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pageSize\",\"type\":\"uint256\"}],\"name\":\"getValidatorsByOperator\",\"outputs\":[{\"components\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"preDepositSignature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"depositSignature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"withdrawVaultAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawnBlock\",\"type\":\"uint256\"}],\"internalType\":\"structValidator[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"name\":\"increaseTotalActiveValidatorCount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"inputKeyCountLimit\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operAddr\",\"type\":\"address\"}],\"name\":\"isExistingOperator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_pubkey\",\"type\":\"bytes\"}],\"name\":\"isExistingPubkey\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_readyToDepositPubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_frontRunPubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_invalidSignaturePubkey\",\"type\":\"bytes[]\"}],\"name\":\"markValidatorReadyToDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxNonTerminalKeyPerOperator\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextOperatorId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextQueuedValidatorIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextValidatorId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"nodeELRewardVaultByOperatorId\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_optInForSocializingPool\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"_operatorName\",\"type\":\"string\"},{\"internalType\":\"addresspayable\",\"name\":\"_operatorRewardAddress\",\"type\":\"address\"}],\"name\":\"onboardNodeOperator\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"feeRecipientAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"operatorIDByAddress\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"operatorStructById\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"optedForSocializingPool\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"operatorName\",\"type\":\"string\"},{\"internalType\":\"addresspayable\",\"name\":\"operatorRewardAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operatorAddress\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operatorAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newRewardAddress\",\"type\":\"address\"}],\"name\":\"proposeRewardAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"proposedRewardAddressByOperatorId\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"queuedValidators\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"socializingPoolStateChangeBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"staderConfig\",\"outputs\":[{\"internalType\":\"contractIStaderConfig\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalActiveValidatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"transferCollateralToPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_validatorId\",\"type\":\"uint256\"}],\"name\":\"updateDepositStatusAndBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_inputKeyCountLimit\",\"type\":\"uint16\"}],\"name\":\"updateInputKeyCountLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"_maxNonTerminalKeyPerOperator\",\"type\":\"uint64\"}],\"name\":\"updateMaxNonTerminalKeyPerOperator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_nextQueuedValidatorIndex\",\"type\":\"uint256\"}],\"name\":\"updateNextQueuedValidatorIndex\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_operatorName\",\"type\":\"string\"}],\"name\":\"updateOperatorName\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_verifiedKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"updateVerifiedKeysBatchSize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"validatorIdByPubkey\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"validatorIdsByOperatorId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorQueueSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"validatorRegistry\",\"outputs\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"preDepositSignature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"depositSignature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"withdrawVaultAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawnBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"verifiedKeyBatchSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_pubkeys\",\"type\":\"bytes[]\"}],\"name\":\"withdrawnValidators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CallerNotExistingRewardAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotManager\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotNewRewardAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotOperator\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotStaderContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CooldownNotComplete\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DuplicatePoolIDOrPoolNotAdded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InSufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidBondEthValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidKeyCount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidStartAndEndIndex\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MisMatchingInputKeysSize\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoChangeInState\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotEnoughSDCollateral\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorAlreadyOnBoardedInProtocol\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorIsDeactivate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorNotOnBoarded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PageNumberIsZero\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PubkeyAlreadyExist\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooManyVerifiedKeysReported\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooManyWithdrawnKeysReported\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UNEXPECTED_STATUS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"maxKeyLimitReached\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"AddedValidatorKey\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalActiveValidatorCount\",\"type\":\"uint256\"}],\"name\":\"DecreasedTotalActiveValidatorCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalActiveValidatorCount\",\"type\":\"uint256\"}],\"name\":\"IncreasedTotalActiveValidatorCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"nodeRewardAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"optInForSocializingPool\",\"type\":\"bool\"}],\"name\":\"OnboardedOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardAddress\",\"type\":\"address\"}],\"name\":\"OperatorRewardAddressUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardAddress\",\"type\":\"address\"}],\"name\":\"RewardAddressProposed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferredCollateralToPool\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"batchKeyDepositLimit\",\"type\":\"uint256\"}],\"name\":\"UpdatedInputKeyCountLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"maxNonTerminalKeyPerOperator\",\"type\":\"uint64\"}],\"name\":\"UpdatedMaxNonTerminalKeyPerOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextQueuedValidatorIndex\",\"type\":\"uint256\"}],\"name\":\"UpdatedNextQueuedValidatorIndex\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"operatorName\",\"type\":\"string\"}],\"name\":\"UpdatedOperatorName\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"optedForSocializingPool\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"block\",\"type\":\"uint256\"}],\"name\":\"UpdatedSocializingPoolState\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"}],\"name\":\"UpdatedValidatorDepositBlock\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"verifiedKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"UpdatedVerifiedKeyBatchSize\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"withdrawnKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"UpdatedWithdrawnKeyBatchSize\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorMarkedAsFrontRunned\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorMarkedReadyToDeposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorStatusMarkedAsInvalidSignature\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorWithdrawn\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"COLLATERAL_ETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FRONT_RUN_PENALTY\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"POOL_ID\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_pubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_preDepositSignature\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_depositSignature\",\"type\":\"bytes[]\"}],\"name\":\"addValidatorKeys\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amountOfSDToUtilize\",\"type\":\"uint256\"},{\"internalType\":\"bytes[]\",\"name\":\"_pubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_preDepositSignature\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_depositSignature\",\"type\":\"bytes[]\"}],\"name\":\"addValidatorKeysWithUtilizeSD\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_optInForSocializingPool\",\"type\":\"bool\"}],\"name\":\"changeSocializingPoolState\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"feeRecipientAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operatorAddress\",\"type\":\"address\"}],\"name\":\"confirmRewardAddressChange\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_pageNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pageSize\",\"type\":\"uint256\"}],\"name\":\"getAllActiveValidators\",\"outputs\":[{\"components\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"preDepositSignature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"depositSignature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"withdrawVaultAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawnBlock\",\"type\":\"uint256\"}],\"internalType\":\"structValidator[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_pageNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pageSize\",\"type\":\"uint256\"}],\"name\":\"getAllNodeELVaultAddress\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCollateralETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"}],\"name\":\"getOperatorRewardAddress\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"}],\"name\":\"getOperatorTotalKeys\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_totalKeys\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_nodeOperator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_startIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_endIndex\",\"type\":\"uint256\"}],\"name\":\"getOperatorTotalNonTerminalKeys\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"}],\"name\":\"getSocializingPoolStateChangeBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalActiveValidatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalQueuedValidatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_pageNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pageSize\",\"type\":\"uint256\"}],\"name\":\"getValidatorsByOperator\",\"outputs\":[{\"components\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"preDepositSignature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"depositSignature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"withdrawVaultAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawnBlock\",\"type\":\"uint256\"}],\"internalType\":\"structValidator[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"name\":\"increaseTotalActiveValidatorCount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"inputKeyCountLimit\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operAddr\",\"type\":\"address\"}],\"name\":\"isExistingOperator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_pubkey\",\"type\":\"bytes\"}],\"name\":\"isExistingPubkey\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_readyToDepositPubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_frontRunPubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_invalidSignaturePubkey\",\"type\":\"bytes[]\"}],\"name\":\"markValidatorReadyToDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxNonTerminalKeyPerOperator\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextOperatorId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextQueuedValidatorIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextValidatorId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"nodeELRewardVaultByOperatorId\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_optInForSocializingPool\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"_operatorName\",\"type\":\"string\"},{\"internalType\":\"addresspayable\",\"name\":\"_operatorRewardAddress\",\"type\":\"address\"}],\"name\":\"onboardNodeOperator\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"feeRecipientAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"operatorIDByAddress\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"operatorStructById\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"optedForSocializingPool\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"operatorName\",\"type\":\"string\"},{\"internalType\":\"addresspayable\",\"name\":\"operatorRewardAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operatorAddress\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operatorAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newRewardAddress\",\"type\":\"address\"}],\"name\":\"proposeRewardAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"proposedRewardAddressByOperatorId\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"queuedValidators\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"socializingPoolStateChangeBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"staderConfig\",\"outputs\":[{\"internalType\":\"contractIStaderConfig\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalActiveValidatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"transferCollateralToPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_validatorId\",\"type\":\"uint256\"}],\"name\":\"updateDepositStatusAndBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_inputKeyCountLimit\",\"type\":\"uint16\"}],\"name\":\"updateInputKeyCountLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"_maxNonTerminalKeyPerOperator\",\"type\":\"uint64\"}],\"name\":\"updateMaxNonTerminalKeyPerOperator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_nextQueuedValidatorIndex\",\"type\":\"uint256\"}],\"name\":\"updateNextQueuedValidatorIndex\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_operatorName\",\"type\":\"string\"}],\"name\":\"updateOperatorName\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_verifiedKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"updateVerifiedKeysBatchSize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"validatorIdByPubkey\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"validatorIdsByOperatorId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorQueueSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"validatorRegistry\",\"outputs\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"preDepositSignature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"depositSignature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"withdrawVaultAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawnBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"verifiedKeyBatchSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_pubkeys\",\"type\":\"bytes[]\"}],\"name\":\"withdrawnValidators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // PermissionlessNodeRegistryABI is the input ABI used to generate the binding from. @@ -1464,25 +1464,25 @@ func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryTransactorSession) return _PermissionlessNodeRegistry.Contract.AddValidatorKeys(&_PermissionlessNodeRegistry.TransactOpts, _pubkey, _preDepositSignature, _depositSignature) } -// AddValidatorKeysWithUtilizeSD is a paid mutator transaction binding the contract method 0x7da55a1e. +// AddValidatorKeysWithUtilizeSD is a paid mutator transaction binding the contract method 0x60cb299d. // -// Solidity: function addValidatorKeysWithUtilizeSD(string _referralId, uint256 _amountOfSDToUtilize, bytes[] _pubkey, bytes[] _preDepositSignature, bytes[] _depositSignature) payable returns() -func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryTransactor) AddValidatorKeysWithUtilizeSD(opts *bind.TransactOpts, _referralId string, _amountOfSDToUtilize *big.Int, _pubkey [][]byte, _preDepositSignature [][]byte, _depositSignature [][]byte) (*types.Transaction, error) { - return _PermissionlessNodeRegistry.contract.Transact(opts, "addValidatorKeysWithUtilizeSD", _referralId, _amountOfSDToUtilize, _pubkey, _preDepositSignature, _depositSignature) +// Solidity: function addValidatorKeysWithUtilizeSD(uint256 _amountOfSDToUtilize, bytes[] _pubkey, bytes[] _preDepositSignature, bytes[] _depositSignature) payable returns() +func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryTransactor) AddValidatorKeysWithUtilizeSD(opts *bind.TransactOpts, _amountOfSDToUtilize *big.Int, _pubkey [][]byte, _preDepositSignature [][]byte, _depositSignature [][]byte) (*types.Transaction, error) { + return _PermissionlessNodeRegistry.contract.Transact(opts, "addValidatorKeysWithUtilizeSD", _amountOfSDToUtilize, _pubkey, _preDepositSignature, _depositSignature) } -// AddValidatorKeysWithUtilizeSD is a paid mutator transaction binding the contract method 0x7da55a1e. +// AddValidatorKeysWithUtilizeSD is a paid mutator transaction binding the contract method 0x60cb299d. // -// Solidity: function addValidatorKeysWithUtilizeSD(string _referralId, uint256 _amountOfSDToUtilize, bytes[] _pubkey, bytes[] _preDepositSignature, bytes[] _depositSignature) payable returns() -func (_PermissionlessNodeRegistry *PermissionlessNodeRegistrySession) AddValidatorKeysWithUtilizeSD(_referralId string, _amountOfSDToUtilize *big.Int, _pubkey [][]byte, _preDepositSignature [][]byte, _depositSignature [][]byte) (*types.Transaction, error) { - return _PermissionlessNodeRegistry.Contract.AddValidatorKeysWithUtilizeSD(&_PermissionlessNodeRegistry.TransactOpts, _referralId, _amountOfSDToUtilize, _pubkey, _preDepositSignature, _depositSignature) +// Solidity: function addValidatorKeysWithUtilizeSD(uint256 _amountOfSDToUtilize, bytes[] _pubkey, bytes[] _preDepositSignature, bytes[] _depositSignature) payable returns() +func (_PermissionlessNodeRegistry *PermissionlessNodeRegistrySession) AddValidatorKeysWithUtilizeSD(_amountOfSDToUtilize *big.Int, _pubkey [][]byte, _preDepositSignature [][]byte, _depositSignature [][]byte) (*types.Transaction, error) { + return _PermissionlessNodeRegistry.Contract.AddValidatorKeysWithUtilizeSD(&_PermissionlessNodeRegistry.TransactOpts, _amountOfSDToUtilize, _pubkey, _preDepositSignature, _depositSignature) } -// AddValidatorKeysWithUtilizeSD is a paid mutator transaction binding the contract method 0x7da55a1e. +// AddValidatorKeysWithUtilizeSD is a paid mutator transaction binding the contract method 0x60cb299d. // -// Solidity: function addValidatorKeysWithUtilizeSD(string _referralId, uint256 _amountOfSDToUtilize, bytes[] _pubkey, bytes[] _preDepositSignature, bytes[] _depositSignature) payable returns() -func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryTransactorSession) AddValidatorKeysWithUtilizeSD(_referralId string, _amountOfSDToUtilize *big.Int, _pubkey [][]byte, _preDepositSignature [][]byte, _depositSignature [][]byte) (*types.Transaction, error) { - return _PermissionlessNodeRegistry.Contract.AddValidatorKeysWithUtilizeSD(&_PermissionlessNodeRegistry.TransactOpts, _referralId, _amountOfSDToUtilize, _pubkey, _preDepositSignature, _depositSignature) +// Solidity: function addValidatorKeysWithUtilizeSD(uint256 _amountOfSDToUtilize, bytes[] _pubkey, bytes[] _preDepositSignature, bytes[] _depositSignature) payable returns() +func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryTransactorSession) AddValidatorKeysWithUtilizeSD(_amountOfSDToUtilize *big.Int, _pubkey [][]byte, _preDepositSignature [][]byte, _depositSignature [][]byte) (*types.Transaction, error) { + return _PermissionlessNodeRegistry.Contract.AddValidatorKeysWithUtilizeSD(&_PermissionlessNodeRegistry.TransactOpts, _amountOfSDToUtilize, _pubkey, _preDepositSignature, _depositSignature) } // ChangeSocializingPoolState is a paid mutator transaction binding the contract method 0xf90b0838. @@ -5035,141 +5035,6 @@ func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryFilterer) ParseUpda return event, nil } -// PermissionlessNodeRegistryValidatorAddedViaReferralIterator is returned from FilterValidatorAddedViaReferral and is used to iterate over the raw logs and unpacked data for ValidatorAddedViaReferral events raised by the PermissionlessNodeRegistry contract. -type PermissionlessNodeRegistryValidatorAddedViaReferralIterator struct { - Event *PermissionlessNodeRegistryValidatorAddedViaReferral // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *PermissionlessNodeRegistryValidatorAddedViaReferralIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(PermissionlessNodeRegistryValidatorAddedViaReferral) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(PermissionlessNodeRegistryValidatorAddedViaReferral) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *PermissionlessNodeRegistryValidatorAddedViaReferralIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *PermissionlessNodeRegistryValidatorAddedViaReferralIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// PermissionlessNodeRegistryValidatorAddedViaReferral represents a ValidatorAddedViaReferral event raised by the PermissionlessNodeRegistry contract. -type PermissionlessNodeRegistryValidatorAddedViaReferral struct { - Amount *big.Int - ReferralId string - Raw types.Log // Blockchain specific contextual infos -} - -// FilterValidatorAddedViaReferral is a free log retrieval operation binding the contract event 0xf1d3fcd20d6cf75aba4ee663e1e3bd6eb614be29d5d9d2b5b1c58238a2da26dd. -// -// Solidity: event ValidatorAddedViaReferral(uint256 amount, string referralId) -func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryFilterer) FilterValidatorAddedViaReferral(opts *bind.FilterOpts) (*PermissionlessNodeRegistryValidatorAddedViaReferralIterator, error) { - - logs, sub, err := _PermissionlessNodeRegistry.contract.FilterLogs(opts, "ValidatorAddedViaReferral") - if err != nil { - return nil, err - } - return &PermissionlessNodeRegistryValidatorAddedViaReferralIterator{contract: _PermissionlessNodeRegistry.contract, event: "ValidatorAddedViaReferral", logs: logs, sub: sub}, nil -} - -// WatchValidatorAddedViaReferral is a free log subscription operation binding the contract event 0xf1d3fcd20d6cf75aba4ee663e1e3bd6eb614be29d5d9d2b5b1c58238a2da26dd. -// -// Solidity: event ValidatorAddedViaReferral(uint256 amount, string referralId) -func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryFilterer) WatchValidatorAddedViaReferral(opts *bind.WatchOpts, sink chan<- *PermissionlessNodeRegistryValidatorAddedViaReferral) (event.Subscription, error) { - - logs, sub, err := _PermissionlessNodeRegistry.contract.WatchLogs(opts, "ValidatorAddedViaReferral") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(PermissionlessNodeRegistryValidatorAddedViaReferral) - if err := _PermissionlessNodeRegistry.contract.UnpackLog(event, "ValidatorAddedViaReferral", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseValidatorAddedViaReferral is a log parse operation binding the contract event 0xf1d3fcd20d6cf75aba4ee663e1e3bd6eb614be29d5d9d2b5b1c58238a2da26dd. -// -// Solidity: event ValidatorAddedViaReferral(uint256 amount, string referralId) -func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryFilterer) ParseValidatorAddedViaReferral(log types.Log) (*PermissionlessNodeRegistryValidatorAddedViaReferral, error) { - event := new(PermissionlessNodeRegistryValidatorAddedViaReferral) - if err := _PermissionlessNodeRegistry.contract.UnpackLog(event, "ValidatorAddedViaReferral", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - // PermissionlessNodeRegistryValidatorMarkedAsFrontRunnedIterator is returned from FilterValidatorMarkedAsFrontRunned and is used to iterate over the raw logs and unpacked data for ValidatorMarkedAsFrontRunned events raised by the PermissionlessNodeRegistry contract. type PermissionlessNodeRegistryValidatorMarkedAsFrontRunnedIterator struct { Event *PermissionlessNodeRegistryValidatorMarkedAsFrontRunned // Event containing the contract specifics and raw log diff --git a/stader-lib/node/validator.go b/stader-lib/node/validator.go index 416ca9dcc..45990548c 100644 --- a/stader-lib/node/validator.go +++ b/stader-lib/node/validator.go @@ -15,7 +15,6 @@ import ( func EstimateAddValidatorKeys( pnr *stader.PermissionlessNodeRegistryContractManager, - referralID string, utilityAmount *big.Int, pubKeys [][]byte, preDepositSignatures [][]byte, @@ -25,7 +24,6 @@ func EstimateAddValidatorKeys( return pnr.PermissionlessNodeRegistryContract.GetTransactionGasInfo( opts, "addValidatorKeysWithUtilizeSD", - referralID, utilityAmount, pubKeys, preDepositSignatures, @@ -35,13 +33,12 @@ func EstimateAddValidatorKeys( func AddValidatorKeysWithAmount( pnr *stader.PermissionlessNodeRegistryContractManager, - referralID string, pubKeys [][]byte, preDepositSignatures [][]byte, depositSignatures [][]byte, utilityAmount *big.Int, opts *bind.TransactOpts) (*types.Transaction, error) { - tx, err := pnr.PermissionlessNodeRegistry.AddValidatorKeysWithUtilizeSD(opts, referralID, utilityAmount, pubKeys, preDepositSignatures, depositSignatures) + tx, err := pnr.PermissionlessNodeRegistry.AddValidatorKeysWithUtilizeSD(opts, utilityAmount, pubKeys, preDepositSignatures, depositSignatures) if err != nil { return nil, fmt.Errorf("could not add validator keys with utilize: %w", err) } diff --git a/stader-lib/sdutility/sd-utility.go b/stader-lib/sdutility/sd-utility.go index 80cbb62f7..fe751205d 100644 --- a/stader-lib/sdutility/sd-utility.go +++ b/stader-lib/sdutility/sd-utility.go @@ -6,7 +6,6 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" - "github.com/stader-labs/stader-node/stader-lib/contracts" "github.com/stader-labs/stader-node/stader-lib/stader" ) @@ -97,12 +96,3 @@ func GetUtilizationRate(sp *stader.SDUtilityPoolContractManager, opts *bind.Call return utilizationRateInPercent, nil } - -func GetUserData(sp *stader.SDUtilityPoolContractManager, address common.Address, opts *bind.CallOpts) (*contracts.UserData, error) { - userData, err := sp.SDUtilityPool.GetUserData(opts, address) - if err != nil { - return nil, err - } - - return &userData, nil -} diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index c94cf7dcf..0a01fad18 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -37,11 +37,6 @@ func GetSDStatus( return nil, err } - userData, err := sdutility.GetUserData(sdu, operatorAddress, nil) - if err != nil { - return nil, err - } - poolAvailableSDBalance, err := sdutility.GetPoolAvailableSDBalance(sdu, nil) if err != nil { return nil, err @@ -99,7 +94,6 @@ func GetSDStatus( SdUtilizedBalance: sdUtilizedBalance, PoolAvailableSDBalance: poolAvailableSDBalance, SdRewardEligible: rewardEligibleSD, - HealthFactor: userData.HealthFactor, }, nil } @@ -271,7 +265,6 @@ func canNodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidato gasInfo, err := node.EstimateAddValidatorKeys( prn, - "referralID", utilityAmountWei, pubKeys, preDepositSignatures, @@ -428,9 +421,7 @@ func nodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidators return nil, fmt.Errorf("error checking for nonce override: %w", err) } - tx, err := node.AddValidatorKeysWithAmount( - prn, - "han_local", + tx, err := node.AddValidatorKeysWithAmount(prn, pubKeys, preDepositSignatures, depositSignatures, From b9719e9e839f586d774090959273f8b163d43279 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Wed, 27 Dec 2023 11:09:36 +0530 Subject: [PATCH 088/159] referral id integration --- abis/PermissionlessNodeRegistry.abi.json | 556 +++++++++++++++--- shared/services/stader/node.go | 8 +- stader-cli/validator/commands.go | 4 + stader-cli/validator/deposit.go | 10 +- .../contracts/permissionless-node-registry.go | 161 ++++- stader-lib/node/validator.go | 5 +- stader/api/validator/commands.go | 14 +- stader/api/validator/deposit.go | 10 +- 8 files changed, 655 insertions(+), 113 deletions(-) diff --git a/abis/PermissionlessNodeRegistry.abi.json b/abis/PermissionlessNodeRegistry.abi.json index bd36bf44f..30962b83f 100644 --- a/abis/PermissionlessNodeRegistry.abi.json +++ b/abis/PermissionlessNodeRegistry.abi.json @@ -1,34 +1,134 @@ [ - { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, - { "inputs": [], "name": "CallerNotExistingRewardAddress", "type": "error" }, - { "inputs": [], "name": "CallerNotManager", "type": "error" }, - { "inputs": [], "name": "CallerNotNewRewardAddress", "type": "error" }, - { "inputs": [], "name": "CallerNotOperator", "type": "error" }, - { "inputs": [], "name": "CallerNotStaderContract", "type": "error" }, - { "inputs": [], "name": "CooldownNotComplete", "type": "error" }, - { "inputs": [], "name": "DuplicatePoolIDOrPoolNotAdded", "type": "error" }, - { "inputs": [], "name": "InSufficientBalance", "type": "error" }, - { "inputs": [], "name": "InvalidBondEthValue", "type": "error" }, - { "inputs": [], "name": "InvalidKeyCount", "type": "error" }, - { "inputs": [], "name": "InvalidStartAndEndIndex", "type": "error" }, - { "inputs": [], "name": "MisMatchingInputKeysSize", "type": "error" }, - { "inputs": [], "name": "NoChangeInState", "type": "error" }, - { "inputs": [], "name": "NotEnoughSDCollateral", "type": "error" }, + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "CallerNotExistingRewardAddress", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotManager", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotNewRewardAddress", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotOperator", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotStaderContract", + "type": "error" + }, + { + "inputs": [], + "name": "CooldownNotComplete", + "type": "error" + }, + { + "inputs": [], + "name": "DuplicatePoolIDOrPoolNotAdded", + "type": "error" + }, + { + "inputs": [], + "name": "InSufficientBalance", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidBondEthValue", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidKeyCount", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidStartAndEndIndex", + "type": "error" + }, + { + "inputs": [], + "name": "MisMatchingInputKeysSize", + "type": "error" + }, + { + "inputs": [], + "name": "NoChangeInState", + "type": "error" + }, + { + "inputs": [], + "name": "NotEnoughSDCollateral", + "type": "error" + }, { "inputs": [], "name": "OperatorAlreadyOnBoardedInProtocol", "type": "error" }, - { "inputs": [], "name": "OperatorIsDeactivate", "type": "error" }, - { "inputs": [], "name": "OperatorNotOnBoarded", "type": "error" }, - { "inputs": [], "name": "PageNumberIsZero", "type": "error" }, - { "inputs": [], "name": "PubkeyAlreadyExist", "type": "error" }, - { "inputs": [], "name": "TooManyVerifiedKeysReported", "type": "error" }, - { "inputs": [], "name": "TooManyWithdrawnKeysReported", "type": "error" }, - { "inputs": [], "name": "TransferFailed", "type": "error" }, - { "inputs": [], "name": "UNEXPECTED_STATUS", "type": "error" }, - { "inputs": [], "name": "ZeroAddress", "type": "error" }, - { "inputs": [], "name": "maxKeyLimitReached", "type": "error" }, + { + "inputs": [], + "name": "OperatorIsDeactivate", + "type": "error" + }, + { + "inputs": [], + "name": "OperatorNotOnBoarded", + "type": "error" + }, + { + "inputs": [], + "name": "PageNumberIsZero", + "type": "error" + }, + { + "inputs": [], + "name": "PubkeyAlreadyExist", + "type": "error" + }, + { + "inputs": [], + "name": "TooManyVerifiedKeysReported", + "type": "error" + }, + { + "inputs": [], + "name": "TooManyWithdrawnKeysReported", + "type": "error" + }, + { + "inputs": [], + "name": "TransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "UNEXPECTED_STATUS", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "maxKeyLimitReached", + "type": "error" + }, { "anonymous": false, "inputs": [ @@ -417,6 +517,25 @@ "name": "UpdatedWithdrawnKeyBatchSize", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "string", + "name": "referralId", + "type": "string" + } + ], + "name": "ValidatorAddedViaReferral", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -497,7 +616,11 @@ "inputs": [], "name": "COLLATERAL_ETH", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" @@ -506,7 +629,11 @@ "inputs": [], "name": "DEFAULT_ADMIN_ROLE", "outputs": [ - { "internalType": "bytes32", "name": "", "type": "bytes32" } + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } ], "stateMutability": "view", "type": "function" @@ -515,7 +642,11 @@ "inputs": [], "name": "FRONT_RUN_PENALTY", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" @@ -523,13 +654,23 @@ { "inputs": [], "name": "POOL_ID", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "bytes[]", "name": "_pubkey", "type": "bytes[]" }, + { + "internalType": "bytes[]", + "name": "_pubkey", + "type": "bytes[]" + }, { "internalType": "bytes[]", "name": "_preDepositSignature", @@ -548,12 +689,21 @@ }, { "inputs": [ + { + "internalType": "string", + "name": "_referralId", + "type": "string" + }, { "internalType": "uint256", "name": "_amountOfSDToUtilize", "type": "uint256" }, - { "internalType": "bytes[]", "name": "_pubkey", "type": "bytes[]" }, + { + "internalType": "bytes[]", + "name": "_pubkey", + "type": "bytes[]" + }, { "internalType": "bytes[]", "name": "_preDepositSignature", @@ -683,7 +833,11 @@ ], "name": "getAllNodeELVaultAddress", "outputs": [ - { "internalType": "address[]", "name": "", "type": "address[]" } + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } ], "stateMutability": "view", "type": "function" @@ -692,7 +846,11 @@ "inputs": [], "name": "getCollateralETH", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "pure", "type": "function" @@ -707,7 +865,11 @@ ], "name": "getOperatorRewardAddress", "outputs": [ - { "internalType": "address payable", "name": "", "type": "address" } + { + "internalType": "address payable", + "name": "", + "type": "address" + } ], "stateMutability": "view", "type": "function" @@ -750,17 +912,31 @@ } ], "name": "getOperatorTotalNonTerminalKeys", - "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" } + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } ], "name": "getRoleAdmin", "outputs": [ - { "internalType": "bytes32", "name": "", "type": "bytes32" } + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } ], "stateMutability": "view", "type": "function" @@ -775,7 +951,11 @@ ], "name": "getSocializingPoolStateChangeBlock", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" @@ -784,7 +964,11 @@ "inputs": [], "name": "getTotalActiveValidatorCount", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" @@ -793,7 +977,11 @@ "inputs": [], "name": "getTotalQueuedValidatorCount", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" @@ -871,8 +1059,16 @@ }, { "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "grantRole", "outputs": [], @@ -881,17 +1077,35 @@ }, { "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "hasRole", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "_count", "type": "uint256" } + { + "internalType": "uint256", + "name": "_count", + "type": "uint256" + } ], "name": "increaseTotalActiveValidatorCount", "outputs": [], @@ -900,7 +1114,11 @@ }, { "inputs": [ - { "internalType": "address", "name": "_admin", "type": "address" }, + { + "internalType": "address", + "name": "_admin", + "type": "address" + }, { "internalType": "address", "name": "_staderConfig", @@ -915,7 +1133,13 @@ { "inputs": [], "name": "inputKeyCountLimit", - "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], "stateMutability": "view", "type": "function" }, @@ -928,16 +1152,32 @@ } ], "name": "isExistingOperator", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "bytes", "name": "_pubkey", "type": "bytes" } + { + "internalType": "bytes", + "name": "_pubkey", + "type": "bytes" + } ], "name": "isExistingPubkey", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, @@ -967,7 +1207,13 @@ { "inputs": [], "name": "maxNonTerminalKeyPerOperator", - "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], "stateMutability": "view", "type": "function" }, @@ -975,7 +1221,11 @@ "inputs": [], "name": "nextOperatorId", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" @@ -984,7 +1234,11 @@ "inputs": [], "name": "nextQueuedValidatorIndex", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" @@ -993,18 +1247,30 @@ "inputs": [], "name": "nextValidatorId", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "name": "nodeELRewardVaultByOperatorId", "outputs": [ - { "internalType": "address", "name": "", "type": "address" } + { + "internalType": "address", + "name": "", + "type": "address" + } ], "stateMutability": "view", "type": "function" @@ -1040,22 +1306,38 @@ }, { "inputs": [ - { "internalType": "address", "name": "", "type": "address" } + { + "internalType": "address", + "name": "", + "type": "address" + } ], "name": "operatorIDByAddress", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "name": "operatorStructById", "outputs": [ - { "internalType": "bool", "name": "active", "type": "bool" }, + { + "internalType": "bool", + "name": "active", + "type": "bool" + }, { "internalType": "bool", "name": "optedForSocializingPool", @@ -1090,7 +1372,13 @@ { "inputs": [], "name": "paused", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, @@ -1114,30 +1402,54 @@ }, { "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "name": "proposedRewardAddressByOperatorId", "outputs": [ - { "internalType": "address", "name": "", "type": "address" } + { + "internalType": "address", + "name": "", + "type": "address" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "name": "queuedValidators", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "renounceRole", "outputs": [], @@ -1146,8 +1458,16 @@ }, { "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "revokeRole", "outputs": [], @@ -1156,11 +1476,19 @@ }, { "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "name": "socializingPoolStateChangeBlock", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" @@ -1187,7 +1515,13 @@ } ], "name": "supportsInterface", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, @@ -1195,14 +1529,22 @@ "inputs": [], "name": "totalActiveValidatorCount", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "_amount", "type": "uint256" } + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } ], "name": "transferCollateralToPool", "outputs": [], @@ -1308,22 +1650,44 @@ "type": "function" }, { - "inputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], "name": "validatorIdByPubkey", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "name": "validatorIdsByOperatorId", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" @@ -1332,14 +1696,22 @@ "inputs": [], "name": "validatorQueueSize", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "name": "validatorRegistry", "outputs": [ @@ -1348,7 +1720,11 @@ "name": "status", "type": "uint8" }, - { "internalType": "bytes", "name": "pubkey", "type": "bytes" }, + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, { "internalType": "bytes", "name": "preDepositSignature", @@ -1387,18 +1763,26 @@ "inputs": [], "name": "verifiedKeyBatchSize", "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "bytes[]", "name": "_pubkeys", "type": "bytes[]" } + { + "internalType": "bytes[]", + "name": "_pubkeys", + "type": "bytes[]" + } ], "name": "withdrawnValidators", "outputs": [], "stateMutability": "nonpayable", "type": "function" } -] +] \ No newline at end of file diff --git a/shared/services/stader/node.go b/shared/services/stader/node.go index 10ae5d51b..3d027b8f8 100644 --- a/shared/services/stader/node.go +++ b/shared/services/stader/node.go @@ -207,8 +207,8 @@ func (c *Client) GetNodeSdAllowance(contractAddress common.Address) (api.SdAllow } // Check whether the node can make a deposit -func (c *Client) CanNodeDeposit(amountBasedWei, amountUtilityWei, numValidators *big.Int, reloadKeys bool) (api.CanNodeDepositResponse, error) { - responseBytes, err := c.callAPI(fmt.Sprintf("validator can-deposit %s %s %s %t", amountBasedWei.String(), amountUtilityWei.String(), numValidators, reloadKeys)) +func (c *Client) CanNodeDeposit(amountBasedWei, amountUtilityWei, numValidators *big.Int, referralId string, reloadKeys bool) (api.CanNodeDepositResponse, error) { + responseBytes, err := c.callAPI(fmt.Sprintf("validator can-deposit %s %s %s %s %t", amountBasedWei.String(), amountUtilityWei.String(), numValidators, referralId, reloadKeys)) if err != nil { return api.CanNodeDepositResponse{}, fmt.Errorf("could not get can validator deposit status: %w", err) } @@ -268,8 +268,8 @@ func (c *Client) GetContractsInfo() (api.ContractsInfoResponse, error) { } // Make a node deposit -func (c *Client) NodeDeposit(amountWei, numValidators, utilitySDAmount *big.Int, reloadKeys bool) (api.NodeDepositResponse, error) { - responseBytes, err := c.callAPI(fmt.Sprintf("validator deposit %s %s %s %t", amountWei.String(), utilitySDAmount.String(), numValidators, reloadKeys)) +func (c *Client) NodeDeposit(amountWei, numValidators, utilitySDAmount *big.Int, referralId string, reloadKeys bool) (api.NodeDepositResponse, error) { + responseBytes, err := c.callAPI(fmt.Sprintf("validator deposit %s %s %s %s %t", amountWei.String(), utilitySDAmount.String(), numValidators, referralId, reloadKeys)) if err != nil { return api.NodeDepositResponse{}, fmt.Errorf("could not make validator deposit as er: %w", err) } diff --git a/stader-cli/validator/commands.go b/stader-cli/validator/commands.go index ce01224d8..a5aea5447 100644 --- a/stader-cli/validator/commands.go +++ b/stader-cli/validator/commands.go @@ -48,6 +48,10 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { Name: "num-validators, nv", Usage: "Number of validators you want to create (Required)", }, + cli.StringFlag{ + Name: "referral-id, ri", + Usage: "A string to identify the source where the validator was created (Optional)", + }, }, Action: func(c *cli.Context) error { diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 61ce9a132..8c34e1752 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -132,7 +132,13 @@ func nodeDeposit(c *cli.Context) error { fmt.Println("Continue with create validator...") } - canNodeDepositResponse, err := staderClient.CanNodeDeposit(baseAmount, utilityAmount, big.NewInt(int64(numValidators)), true) + referralId := c.String("referral-id") + // default referral id is VANILLA which means its a regular stader-node setup unlike an avado or dappnodes + if referralId == "" { + referralId = "VANILLA" + } + + canNodeDepositResponse, err := staderClient.CanNodeDeposit(baseAmount, utilityAmount, big.NewInt(int64(numValidators)), referralId, true) if err != nil { return err } @@ -158,7 +164,7 @@ func nodeDeposit(c *cli.Context) error { } // Make deposit - response, err := staderClient.NodeDeposit(baseAmount, big.NewInt(int64(numValidators)), utilityAmount, false) + response, err := staderClient.NodeDeposit(baseAmount, big.NewInt(int64(numValidators)), utilityAmount, referralId, false) if err != nil { return err } diff --git a/stader-lib/contracts/permissionless-node-registry.go b/stader-lib/contracts/permissionless-node-registry.go index 68169e67f..05464ec9e 100644 --- a/stader-lib/contracts/permissionless-node-registry.go +++ b/stader-lib/contracts/permissionless-node-registry.go @@ -43,7 +43,7 @@ type Validator struct { // PermissionlessNodeRegistryMetaData contains all meta data concerning the PermissionlessNodeRegistry contract. var PermissionlessNodeRegistryMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CallerNotExistingRewardAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotManager\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotNewRewardAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotOperator\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotStaderContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CooldownNotComplete\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DuplicatePoolIDOrPoolNotAdded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InSufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidBondEthValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidKeyCount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidStartAndEndIndex\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MisMatchingInputKeysSize\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoChangeInState\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotEnoughSDCollateral\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorAlreadyOnBoardedInProtocol\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorIsDeactivate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorNotOnBoarded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PageNumberIsZero\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PubkeyAlreadyExist\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooManyVerifiedKeysReported\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooManyWithdrawnKeysReported\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UNEXPECTED_STATUS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"maxKeyLimitReached\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"AddedValidatorKey\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalActiveValidatorCount\",\"type\":\"uint256\"}],\"name\":\"DecreasedTotalActiveValidatorCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalActiveValidatorCount\",\"type\":\"uint256\"}],\"name\":\"IncreasedTotalActiveValidatorCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"nodeRewardAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"optInForSocializingPool\",\"type\":\"bool\"}],\"name\":\"OnboardedOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardAddress\",\"type\":\"address\"}],\"name\":\"OperatorRewardAddressUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardAddress\",\"type\":\"address\"}],\"name\":\"RewardAddressProposed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferredCollateralToPool\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"batchKeyDepositLimit\",\"type\":\"uint256\"}],\"name\":\"UpdatedInputKeyCountLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"maxNonTerminalKeyPerOperator\",\"type\":\"uint64\"}],\"name\":\"UpdatedMaxNonTerminalKeyPerOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextQueuedValidatorIndex\",\"type\":\"uint256\"}],\"name\":\"UpdatedNextQueuedValidatorIndex\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"operatorName\",\"type\":\"string\"}],\"name\":\"UpdatedOperatorName\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"optedForSocializingPool\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"block\",\"type\":\"uint256\"}],\"name\":\"UpdatedSocializingPoolState\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"}],\"name\":\"UpdatedValidatorDepositBlock\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"verifiedKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"UpdatedVerifiedKeyBatchSize\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"withdrawnKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"UpdatedWithdrawnKeyBatchSize\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorMarkedAsFrontRunned\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorMarkedReadyToDeposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorStatusMarkedAsInvalidSignature\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorWithdrawn\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"COLLATERAL_ETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FRONT_RUN_PENALTY\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"POOL_ID\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_pubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_preDepositSignature\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_depositSignature\",\"type\":\"bytes[]\"}],\"name\":\"addValidatorKeys\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amountOfSDToUtilize\",\"type\":\"uint256\"},{\"internalType\":\"bytes[]\",\"name\":\"_pubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_preDepositSignature\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_depositSignature\",\"type\":\"bytes[]\"}],\"name\":\"addValidatorKeysWithUtilizeSD\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_optInForSocializingPool\",\"type\":\"bool\"}],\"name\":\"changeSocializingPoolState\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"feeRecipientAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operatorAddress\",\"type\":\"address\"}],\"name\":\"confirmRewardAddressChange\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_pageNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pageSize\",\"type\":\"uint256\"}],\"name\":\"getAllActiveValidators\",\"outputs\":[{\"components\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"preDepositSignature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"depositSignature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"withdrawVaultAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawnBlock\",\"type\":\"uint256\"}],\"internalType\":\"structValidator[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_pageNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pageSize\",\"type\":\"uint256\"}],\"name\":\"getAllNodeELVaultAddress\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCollateralETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"}],\"name\":\"getOperatorRewardAddress\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"}],\"name\":\"getOperatorTotalKeys\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_totalKeys\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_nodeOperator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_startIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_endIndex\",\"type\":\"uint256\"}],\"name\":\"getOperatorTotalNonTerminalKeys\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"}],\"name\":\"getSocializingPoolStateChangeBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalActiveValidatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalQueuedValidatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_pageNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pageSize\",\"type\":\"uint256\"}],\"name\":\"getValidatorsByOperator\",\"outputs\":[{\"components\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"preDepositSignature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"depositSignature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"withdrawVaultAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawnBlock\",\"type\":\"uint256\"}],\"internalType\":\"structValidator[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"name\":\"increaseTotalActiveValidatorCount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"inputKeyCountLimit\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operAddr\",\"type\":\"address\"}],\"name\":\"isExistingOperator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_pubkey\",\"type\":\"bytes\"}],\"name\":\"isExistingPubkey\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_readyToDepositPubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_frontRunPubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_invalidSignaturePubkey\",\"type\":\"bytes[]\"}],\"name\":\"markValidatorReadyToDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxNonTerminalKeyPerOperator\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextOperatorId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextQueuedValidatorIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextValidatorId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"nodeELRewardVaultByOperatorId\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_optInForSocializingPool\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"_operatorName\",\"type\":\"string\"},{\"internalType\":\"addresspayable\",\"name\":\"_operatorRewardAddress\",\"type\":\"address\"}],\"name\":\"onboardNodeOperator\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"feeRecipientAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"operatorIDByAddress\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"operatorStructById\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"optedForSocializingPool\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"operatorName\",\"type\":\"string\"},{\"internalType\":\"addresspayable\",\"name\":\"operatorRewardAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operatorAddress\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operatorAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newRewardAddress\",\"type\":\"address\"}],\"name\":\"proposeRewardAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"proposedRewardAddressByOperatorId\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"queuedValidators\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"socializingPoolStateChangeBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"staderConfig\",\"outputs\":[{\"internalType\":\"contractIStaderConfig\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalActiveValidatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"transferCollateralToPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_validatorId\",\"type\":\"uint256\"}],\"name\":\"updateDepositStatusAndBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_inputKeyCountLimit\",\"type\":\"uint16\"}],\"name\":\"updateInputKeyCountLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"_maxNonTerminalKeyPerOperator\",\"type\":\"uint64\"}],\"name\":\"updateMaxNonTerminalKeyPerOperator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_nextQueuedValidatorIndex\",\"type\":\"uint256\"}],\"name\":\"updateNextQueuedValidatorIndex\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_operatorName\",\"type\":\"string\"}],\"name\":\"updateOperatorName\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_verifiedKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"updateVerifiedKeysBatchSize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"validatorIdByPubkey\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"validatorIdsByOperatorId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorQueueSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"validatorRegistry\",\"outputs\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"preDepositSignature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"depositSignature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"withdrawVaultAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawnBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"verifiedKeyBatchSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_pubkeys\",\"type\":\"bytes[]\"}],\"name\":\"withdrawnValidators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CallerNotExistingRewardAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotManager\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotNewRewardAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotOperator\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotStaderContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CooldownNotComplete\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DuplicatePoolIDOrPoolNotAdded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InSufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidBondEthValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidKeyCount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidStartAndEndIndex\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MisMatchingInputKeysSize\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoChangeInState\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotEnoughSDCollateral\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorAlreadyOnBoardedInProtocol\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorIsDeactivate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorNotOnBoarded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PageNumberIsZero\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PubkeyAlreadyExist\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooManyVerifiedKeysReported\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooManyWithdrawnKeysReported\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UNEXPECTED_STATUS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"maxKeyLimitReached\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"AddedValidatorKey\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalActiveValidatorCount\",\"type\":\"uint256\"}],\"name\":\"DecreasedTotalActiveValidatorCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalActiveValidatorCount\",\"type\":\"uint256\"}],\"name\":\"IncreasedTotalActiveValidatorCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"nodeRewardAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"optInForSocializingPool\",\"type\":\"bool\"}],\"name\":\"OnboardedOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardAddress\",\"type\":\"address\"}],\"name\":\"OperatorRewardAddressUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardAddress\",\"type\":\"address\"}],\"name\":\"RewardAddressProposed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferredCollateralToPool\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"batchKeyDepositLimit\",\"type\":\"uint256\"}],\"name\":\"UpdatedInputKeyCountLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"maxNonTerminalKeyPerOperator\",\"type\":\"uint64\"}],\"name\":\"UpdatedMaxNonTerminalKeyPerOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextQueuedValidatorIndex\",\"type\":\"uint256\"}],\"name\":\"UpdatedNextQueuedValidatorIndex\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeOperator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"operatorName\",\"type\":\"string\"}],\"name\":\"UpdatedOperatorName\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"optedForSocializingPool\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"block\",\"type\":\"uint256\"}],\"name\":\"UpdatedSocializingPoolState\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"}],\"name\":\"UpdatedValidatorDepositBlock\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"verifiedKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"UpdatedVerifiedKeyBatchSize\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"withdrawnKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"UpdatedWithdrawnKeyBatchSize\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"referralId\",\"type\":\"string\"}],\"name\":\"ValidatorAddedViaReferral\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorMarkedAsFrontRunned\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorMarkedReadyToDeposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorStatusMarkedAsInvalidSignature\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"validatorId\",\"type\":\"uint256\"}],\"name\":\"ValidatorWithdrawn\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"COLLATERAL_ETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FRONT_RUN_PENALTY\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"POOL_ID\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_pubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_preDepositSignature\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_depositSignature\",\"type\":\"bytes[]\"}],\"name\":\"addValidatorKeys\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_referralId\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_amountOfSDToUtilize\",\"type\":\"uint256\"},{\"internalType\":\"bytes[]\",\"name\":\"_pubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_preDepositSignature\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_depositSignature\",\"type\":\"bytes[]\"}],\"name\":\"addValidatorKeysWithUtilizeSD\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_optInForSocializingPool\",\"type\":\"bool\"}],\"name\":\"changeSocializingPoolState\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"feeRecipientAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operatorAddress\",\"type\":\"address\"}],\"name\":\"confirmRewardAddressChange\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_pageNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pageSize\",\"type\":\"uint256\"}],\"name\":\"getAllActiveValidators\",\"outputs\":[{\"components\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"preDepositSignature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"depositSignature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"withdrawVaultAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawnBlock\",\"type\":\"uint256\"}],\"internalType\":\"structValidator[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_pageNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pageSize\",\"type\":\"uint256\"}],\"name\":\"getAllNodeELVaultAddress\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCollateralETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"}],\"name\":\"getOperatorRewardAddress\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"}],\"name\":\"getOperatorTotalKeys\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_totalKeys\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_nodeOperator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_startIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_endIndex\",\"type\":\"uint256\"}],\"name\":\"getOperatorTotalNonTerminalKeys\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"}],\"name\":\"getSocializingPoolStateChangeBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalActiveValidatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalQueuedValidatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_pageNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pageSize\",\"type\":\"uint256\"}],\"name\":\"getValidatorsByOperator\",\"outputs\":[{\"components\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"preDepositSignature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"depositSignature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"withdrawVaultAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawnBlock\",\"type\":\"uint256\"}],\"internalType\":\"structValidator[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"name\":\"increaseTotalActiveValidatorCount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"inputKeyCountLimit\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operAddr\",\"type\":\"address\"}],\"name\":\"isExistingOperator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_pubkey\",\"type\":\"bytes\"}],\"name\":\"isExistingPubkey\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_readyToDepositPubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_frontRunPubkey\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_invalidSignaturePubkey\",\"type\":\"bytes[]\"}],\"name\":\"markValidatorReadyToDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxNonTerminalKeyPerOperator\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextOperatorId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextQueuedValidatorIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextValidatorId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"nodeELRewardVaultByOperatorId\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_optInForSocializingPool\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"_operatorName\",\"type\":\"string\"},{\"internalType\":\"addresspayable\",\"name\":\"_operatorRewardAddress\",\"type\":\"address\"}],\"name\":\"onboardNodeOperator\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"feeRecipientAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"operatorIDByAddress\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"operatorStructById\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"optedForSocializingPool\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"operatorName\",\"type\":\"string\"},{\"internalType\":\"addresspayable\",\"name\":\"operatorRewardAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operatorAddress\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operatorAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newRewardAddress\",\"type\":\"address\"}],\"name\":\"proposeRewardAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"proposedRewardAddressByOperatorId\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"queuedValidators\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"socializingPoolStateChangeBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"staderConfig\",\"outputs\":[{\"internalType\":\"contractIStaderConfig\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalActiveValidatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"transferCollateralToPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_validatorId\",\"type\":\"uint256\"}],\"name\":\"updateDepositStatusAndBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_inputKeyCountLimit\",\"type\":\"uint16\"}],\"name\":\"updateInputKeyCountLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"_maxNonTerminalKeyPerOperator\",\"type\":\"uint64\"}],\"name\":\"updateMaxNonTerminalKeyPerOperator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_nextQueuedValidatorIndex\",\"type\":\"uint256\"}],\"name\":\"updateNextQueuedValidatorIndex\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_operatorName\",\"type\":\"string\"}],\"name\":\"updateOperatorName\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_verifiedKeysBatchSize\",\"type\":\"uint256\"}],\"name\":\"updateVerifiedKeysBatchSize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"validatorIdByPubkey\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"validatorIdsByOperatorId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorQueueSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"validatorRegistry\",\"outputs\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"preDepositSignature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"depositSignature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"withdrawVaultAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawnBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"verifiedKeyBatchSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_pubkeys\",\"type\":\"bytes[]\"}],\"name\":\"withdrawnValidators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // PermissionlessNodeRegistryABI is the input ABI used to generate the binding from. @@ -1464,25 +1464,25 @@ func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryTransactorSession) return _PermissionlessNodeRegistry.Contract.AddValidatorKeys(&_PermissionlessNodeRegistry.TransactOpts, _pubkey, _preDepositSignature, _depositSignature) } -// AddValidatorKeysWithUtilizeSD is a paid mutator transaction binding the contract method 0x60cb299d. +// AddValidatorKeysWithUtilizeSD is a paid mutator transaction binding the contract method 0x7da55a1e. // -// Solidity: function addValidatorKeysWithUtilizeSD(uint256 _amountOfSDToUtilize, bytes[] _pubkey, bytes[] _preDepositSignature, bytes[] _depositSignature) payable returns() -func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryTransactor) AddValidatorKeysWithUtilizeSD(opts *bind.TransactOpts, _amountOfSDToUtilize *big.Int, _pubkey [][]byte, _preDepositSignature [][]byte, _depositSignature [][]byte) (*types.Transaction, error) { - return _PermissionlessNodeRegistry.contract.Transact(opts, "addValidatorKeysWithUtilizeSD", _amountOfSDToUtilize, _pubkey, _preDepositSignature, _depositSignature) +// Solidity: function addValidatorKeysWithUtilizeSD(string _referralId, uint256 _amountOfSDToUtilize, bytes[] _pubkey, bytes[] _preDepositSignature, bytes[] _depositSignature) payable returns() +func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryTransactor) AddValidatorKeysWithUtilizeSD(opts *bind.TransactOpts, _referralId string, _amountOfSDToUtilize *big.Int, _pubkey [][]byte, _preDepositSignature [][]byte, _depositSignature [][]byte) (*types.Transaction, error) { + return _PermissionlessNodeRegistry.contract.Transact(opts, "addValidatorKeysWithUtilizeSD", _referralId, _amountOfSDToUtilize, _pubkey, _preDepositSignature, _depositSignature) } -// AddValidatorKeysWithUtilizeSD is a paid mutator transaction binding the contract method 0x60cb299d. +// AddValidatorKeysWithUtilizeSD is a paid mutator transaction binding the contract method 0x7da55a1e. // -// Solidity: function addValidatorKeysWithUtilizeSD(uint256 _amountOfSDToUtilize, bytes[] _pubkey, bytes[] _preDepositSignature, bytes[] _depositSignature) payable returns() -func (_PermissionlessNodeRegistry *PermissionlessNodeRegistrySession) AddValidatorKeysWithUtilizeSD(_amountOfSDToUtilize *big.Int, _pubkey [][]byte, _preDepositSignature [][]byte, _depositSignature [][]byte) (*types.Transaction, error) { - return _PermissionlessNodeRegistry.Contract.AddValidatorKeysWithUtilizeSD(&_PermissionlessNodeRegistry.TransactOpts, _amountOfSDToUtilize, _pubkey, _preDepositSignature, _depositSignature) +// Solidity: function addValidatorKeysWithUtilizeSD(string _referralId, uint256 _amountOfSDToUtilize, bytes[] _pubkey, bytes[] _preDepositSignature, bytes[] _depositSignature) payable returns() +func (_PermissionlessNodeRegistry *PermissionlessNodeRegistrySession) AddValidatorKeysWithUtilizeSD(_referralId string, _amountOfSDToUtilize *big.Int, _pubkey [][]byte, _preDepositSignature [][]byte, _depositSignature [][]byte) (*types.Transaction, error) { + return _PermissionlessNodeRegistry.Contract.AddValidatorKeysWithUtilizeSD(&_PermissionlessNodeRegistry.TransactOpts, _referralId, _amountOfSDToUtilize, _pubkey, _preDepositSignature, _depositSignature) } -// AddValidatorKeysWithUtilizeSD is a paid mutator transaction binding the contract method 0x60cb299d. +// AddValidatorKeysWithUtilizeSD is a paid mutator transaction binding the contract method 0x7da55a1e. // -// Solidity: function addValidatorKeysWithUtilizeSD(uint256 _amountOfSDToUtilize, bytes[] _pubkey, bytes[] _preDepositSignature, bytes[] _depositSignature) payable returns() -func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryTransactorSession) AddValidatorKeysWithUtilizeSD(_amountOfSDToUtilize *big.Int, _pubkey [][]byte, _preDepositSignature [][]byte, _depositSignature [][]byte) (*types.Transaction, error) { - return _PermissionlessNodeRegistry.Contract.AddValidatorKeysWithUtilizeSD(&_PermissionlessNodeRegistry.TransactOpts, _amountOfSDToUtilize, _pubkey, _preDepositSignature, _depositSignature) +// Solidity: function addValidatorKeysWithUtilizeSD(string _referralId, uint256 _amountOfSDToUtilize, bytes[] _pubkey, bytes[] _preDepositSignature, bytes[] _depositSignature) payable returns() +func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryTransactorSession) AddValidatorKeysWithUtilizeSD(_referralId string, _amountOfSDToUtilize *big.Int, _pubkey [][]byte, _preDepositSignature [][]byte, _depositSignature [][]byte) (*types.Transaction, error) { + return _PermissionlessNodeRegistry.Contract.AddValidatorKeysWithUtilizeSD(&_PermissionlessNodeRegistry.TransactOpts, _referralId, _amountOfSDToUtilize, _pubkey, _preDepositSignature, _depositSignature) } // ChangeSocializingPoolState is a paid mutator transaction binding the contract method 0xf90b0838. @@ -5035,6 +5035,141 @@ func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryFilterer) ParseUpda return event, nil } +// PermissionlessNodeRegistryValidatorAddedViaReferralIterator is returned from FilterValidatorAddedViaReferral and is used to iterate over the raw logs and unpacked data for ValidatorAddedViaReferral events raised by the PermissionlessNodeRegistry contract. +type PermissionlessNodeRegistryValidatorAddedViaReferralIterator struct { + Event *PermissionlessNodeRegistryValidatorAddedViaReferral // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *PermissionlessNodeRegistryValidatorAddedViaReferralIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(PermissionlessNodeRegistryValidatorAddedViaReferral) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(PermissionlessNodeRegistryValidatorAddedViaReferral) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *PermissionlessNodeRegistryValidatorAddedViaReferralIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *PermissionlessNodeRegistryValidatorAddedViaReferralIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// PermissionlessNodeRegistryValidatorAddedViaReferral represents a ValidatorAddedViaReferral event raised by the PermissionlessNodeRegistry contract. +type PermissionlessNodeRegistryValidatorAddedViaReferral struct { + Amount *big.Int + ReferralId string + Raw types.Log // Blockchain specific contextual infos +} + +// FilterValidatorAddedViaReferral is a free log retrieval operation binding the contract event 0xf1d3fcd20d6cf75aba4ee663e1e3bd6eb614be29d5d9d2b5b1c58238a2da26dd. +// +// Solidity: event ValidatorAddedViaReferral(uint256 amount, string referralId) +func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryFilterer) FilterValidatorAddedViaReferral(opts *bind.FilterOpts) (*PermissionlessNodeRegistryValidatorAddedViaReferralIterator, error) { + + logs, sub, err := _PermissionlessNodeRegistry.contract.FilterLogs(opts, "ValidatorAddedViaReferral") + if err != nil { + return nil, err + } + return &PermissionlessNodeRegistryValidatorAddedViaReferralIterator{contract: _PermissionlessNodeRegistry.contract, event: "ValidatorAddedViaReferral", logs: logs, sub: sub}, nil +} + +// WatchValidatorAddedViaReferral is a free log subscription operation binding the contract event 0xf1d3fcd20d6cf75aba4ee663e1e3bd6eb614be29d5d9d2b5b1c58238a2da26dd. +// +// Solidity: event ValidatorAddedViaReferral(uint256 amount, string referralId) +func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryFilterer) WatchValidatorAddedViaReferral(opts *bind.WatchOpts, sink chan<- *PermissionlessNodeRegistryValidatorAddedViaReferral) (event.Subscription, error) { + + logs, sub, err := _PermissionlessNodeRegistry.contract.WatchLogs(opts, "ValidatorAddedViaReferral") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(PermissionlessNodeRegistryValidatorAddedViaReferral) + if err := _PermissionlessNodeRegistry.contract.UnpackLog(event, "ValidatorAddedViaReferral", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseValidatorAddedViaReferral is a log parse operation binding the contract event 0xf1d3fcd20d6cf75aba4ee663e1e3bd6eb614be29d5d9d2b5b1c58238a2da26dd. +// +// Solidity: event ValidatorAddedViaReferral(uint256 amount, string referralId) +func (_PermissionlessNodeRegistry *PermissionlessNodeRegistryFilterer) ParseValidatorAddedViaReferral(log types.Log) (*PermissionlessNodeRegistryValidatorAddedViaReferral, error) { + event := new(PermissionlessNodeRegistryValidatorAddedViaReferral) + if err := _PermissionlessNodeRegistry.contract.UnpackLog(event, "ValidatorAddedViaReferral", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + // PermissionlessNodeRegistryValidatorMarkedAsFrontRunnedIterator is returned from FilterValidatorMarkedAsFrontRunned and is used to iterate over the raw logs and unpacked data for ValidatorMarkedAsFrontRunned events raised by the PermissionlessNodeRegistry contract. type PermissionlessNodeRegistryValidatorMarkedAsFrontRunnedIterator struct { Event *PermissionlessNodeRegistryValidatorMarkedAsFrontRunned // Event containing the contract specifics and raw log diff --git a/stader-lib/node/validator.go b/stader-lib/node/validator.go index 45990548c..0d7c21d03 100644 --- a/stader-lib/node/validator.go +++ b/stader-lib/node/validator.go @@ -19,11 +19,13 @@ func EstimateAddValidatorKeys( pubKeys [][]byte, preDepositSignatures [][]byte, depositSignatures [][]byte, + referralId string, opts *bind.TransactOpts, ) (stader.GasInfo, error) { return pnr.PermissionlessNodeRegistryContract.GetTransactionGasInfo( opts, "addValidatorKeysWithUtilizeSD", + referralId, utilityAmount, pubKeys, preDepositSignatures, @@ -37,8 +39,9 @@ func AddValidatorKeysWithAmount( preDepositSignatures [][]byte, depositSignatures [][]byte, utilityAmount *big.Int, + referralId string, opts *bind.TransactOpts) (*types.Transaction, error) { - tx, err := pnr.PermissionlessNodeRegistry.AddValidatorKeysWithUtilizeSD(opts, utilityAmount, pubKeys, preDepositSignatures, depositSignatures) + tx, err := pnr.PermissionlessNodeRegistry.AddValidatorKeysWithUtilizeSD(opts, referralId, utilityAmount, pubKeys, preDepositSignatures, depositSignatures) if err != nil { return nil, fmt.Errorf("could not add validator keys with utilize: %w", err) } diff --git a/stader/api/validator/commands.go b/stader/api/validator/commands.go index 0c16d9655..349ca4dc7 100644 --- a/stader/api/validator/commands.go +++ b/stader/api/validator/commands.go @@ -37,7 +37,7 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { { Name: "can-deposit", Usage: "Check whether the node can make a deposit to create a validator", - UsageText: "stader-cli api validator can-deposit amount salt num-validators reload-keys", + UsageText: "stader-cli api validator can-deposit amount num-validators referral-id reload-keys", Action: func(c *cli.Context) error { // Validate args @@ -59,12 +59,14 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { return err } + referralId := c.String("referral-id") + reloadKeys, err := cliutils.ValidateBool("reload-keys", c.Args().Get(3)) if err != nil { return err } - api.PrintResponse(canNodeDeposit(c, baseAmountWei, utilityAmountWei, numValidators, reloadKeys)) + api.PrintResponse(canNodeDeposit(c, baseAmountWei, utilityAmountWei, numValidators, referralId, reloadKeys)) return nil @@ -74,7 +76,7 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { Name: "deposit", Aliases: []string{"d"}, Usage: "Make a deposit and create a validator", - UsageText: "stader-cli api validator deposit-amount utility-amount num-validators reload-keys", + UsageText: "stader-cli api validator deposit-amount utility-amount num-validators referral-id reload-keys", Action: func(c *cli.Context) error { // Validate args @@ -96,13 +98,15 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { return err } - reloadKeys, err := cliutils.ValidateBool("reload-keys", c.Args().Get(3)) + referralId := c.String("referral-id") + + reloadKeys, err := cliutils.ValidateBool("reload-keys", c.Args().Get(4)) if err != nil { return err } // Run - response, err := nodeDeposit(c, baseAmountWei, utilityAmountWei, numValidators, reloadKeys) + response, err := nodeDeposit(c, baseAmountWei, utilityAmountWei, numValidators, referralId, reloadKeys) api.PrintResponse(response, err) return nil diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index 0a01fad18..bf65e486e 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -5,6 +5,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/common" + "github.com/stader-labs/stader-node/shared/utils/crypto" "github.com/stader-labs/stader-node/stader-lib/node" sd_collateral "github.com/stader-labs/stader-node/stader-lib/sd-collateral" "github.com/stader-labs/stader-node/stader-lib/sdutility" @@ -97,7 +98,7 @@ func GetSDStatus( }, nil } -func canNodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidators *big.Int, reloadKeys bool) (*api.CanNodeDepositResponse, error) { +func canNodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidators *big.Int, referralId string, reloadKeys bool) (*api.CanNodeDepositResponse, error) { if err := services.RequireNodeWallet(c); err != nil { return nil, err } @@ -257,6 +258,7 @@ func canNodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidato newValidatorKey = operatorKeyCount.Add(operatorKeyCount, big.NewInt(1)) } + encodedReferralId := crypto.EncodeBase64([]byte(referralId)) // Override the provided pending TX if requested err = eth1.CheckForNonceOverride(c, opts) if err != nil { @@ -269,6 +271,7 @@ func canNodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidato pubKeys, preDepositSignatures, depositSignatures, + encodedReferralId, opts, ) if err != nil { @@ -281,7 +284,7 @@ func canNodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidato return &canNodeDepositResponse, nil } -func nodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidators *big.Int, reloadKeys bool) (*api.NodeDepositResponse, error) { +func nodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidators *big.Int, referralId string, reloadKeys bool) (*api.NodeDepositResponse, error) { cfg, err := services.GetConfig(c) if err != nil { return nil, err @@ -421,11 +424,14 @@ func nodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidators return nil, fmt.Errorf("error checking for nonce override: %w", err) } + encodedReferralId := crypto.EncodeBase64([]byte(referralId)) + tx, err := node.AddValidatorKeysWithAmount(prn, pubKeys, preDepositSignatures, depositSignatures, utilityAmountWei, + encodedReferralId, opts) if err != nil { return nil, err From 31af3853cd5ef95f7233da5472859059fd72824e Mon Sep 17 00:00:00 2001 From: batphonghan Date: Wed, 27 Dec 2023 17:31:53 +0700 Subject: [PATCH 089/159] Update status --- shared/types/api/node.go | 1 + stader-cli/node/status.go | 151 +++++++++++------------------ stader-lib/sdutility/sd-utility.go | 10 ++ stader/api/validator/deposit.go | 6 ++ 4 files changed, 72 insertions(+), 96 deletions(-) diff --git a/shared/types/api/node.go b/shared/types/api/node.go index 6c335b23f..b1966384a 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -454,6 +454,7 @@ type SdStatusResponse struct { SdBalance *big.Int `json:"sdBalance"` PoolAvailableSDBalance *big.Int `json:"poolAvailableSDBalance"` SdRewardEligible *big.Int `json:"sdRewardEligible"` + HealthFactor *big.Int `json:"healthFactor"` NotEnoughSdCollateral bool `json:"notEnoughSdCollateral"` } diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index ef3a06610..4e2076caf 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -71,42 +71,6 @@ func getNodeStatus(c *cli.Context) error { noOfValidatorsWeCanRegister = noOfValidatorsWeCanRegisterBasedOnEthBalance } - // Account address & balances - fmt.Printf("%s=== Account and Balances ===%s\n", log.ColorGreen, log.ColorReset) - fmt.Printf( - "The node %s%s%s has a balance of %.6f ETH.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - math.RoundDown(eth.WeiToEth(status.AccountBalances.ETH), 6)) - fmt.Printf( - "The node %s%s%s has a balance of %.6f SD.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - math.RoundDown(eth.WeiToEth(status.AccountBalances.Sd), 18)) - - fmt.Printf( - "The node %s%s%s has a deposited %d Eth as collateral.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - totalEthCollateral) - - fmt.Printf( - "The node %s%s%s has a deposited %.6f SD as collateral.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - math.RoundDown(eth.WeiToEth(status.DepositedSdCollateral), 18)) - - fmt.Printf( - "The node %s%s%s can register %d more validators based on the ETH balance and the SD collateral provided.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - noOfValidatorsWeCanRegister) - fmt.Printf("%s=== Operator Registration Details ===%s\n", log.ColorGreen, log.ColorReset) if !status.Registered { @@ -114,7 +78,6 @@ func getNodeStatus(c *cli.Context) error { return nil } - fmt.Printf("The operator is registered with Stader. Below are operator details:\n") fmt.Printf("Operator Id: %d\n\n", status.OperatorId) fmt.Printf("Operator Name: %s\n\n", status.OperatorName) fmt.Printf("Operator Address: %s\n\n", status.OperatorAddress.String()) @@ -124,12 +87,13 @@ func getNodeStatus(c *cli.Context) error { } else { fmt.Printf("Operator Status: Not Active\n\n") } - fmt.Printf("The Operator has registered a total of %d validators\n\n", len(status.ValidatorInfos)) + + fmt.Printf("The Operator has registered a total of %d validators (To view details of each validator, please use the `stader-cli validator status` command)\n\n", len(status.ValidatorInfos)) if !status.OptedInForSocializingPool { - fmt.Printf("Operator has Opted Out for Socializing Pool\n\n") + fmt.Printf("The Operator has Opted Out for Socializing Pool\n\n") } else { - fmt.Printf("Operator has Opted In for Socializing Pool\n\n") + fmt.Printf("The Operator has Opted In for Socializing Pool\n\n") } if totalUnclaimedSocializingPoolSd.Cmp(big.NewInt(0)) > 0 { @@ -157,93 +121,88 @@ func getNodeStatus(c *cli.Context) error { fmt.Printf("To transfer the claims to your operator reward address use the %sstader-cli node claim-rewards%s command\n\n", log.ColorGreen, log.ColorReset) } - fmt.Printf("%s=== Registered Validator Details ===%s\n", log.ColorGreen, log.ColorReset) - - fmt.Printf("To view details of each validator, please use the %sstader-cli validator status%s command\n\n", log.ColorGreen, log.ColorReset) - - // Get node SD status - sdStatusResp, err := staderClient.GetSDStatus(big.NewInt(0)) - if err != nil { - return err - } - - fmt.Printf("%s=== SD utilization Details ===%s\n", log.ColorGreen, log.ColorReset) + fmt.Printf( + "The Operator can register %d more validators considering the ETH balance and SD availability in the Operator Address and Utility Pool.\n\n", + noOfValidatorsWeCanRegister) - sdStatus := sdStatusResp.SDStatus + // Account address & balances + fmt.Printf("%s=== Account and Balances ===%s\n", log.ColorGreen, log.ColorReset) fmt.Printf( - "The node %s%s%s currently utilizes %.6f SD.\n\n", + "The Operator %s%s%s has a balance of %.6f ETH.\n\n", log.ColorBlue, status.AccountAddress, log.ColorReset, - math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizedBalance), eth.Decimal)) - + math.RoundDown(eth.WeiToEth(status.AccountBalances.ETH), 6)) fmt.Printf( - "The node %s%s%s has SD Utilization Position (including the fee) %.6f SD.\n\n", + "The Operator %s%s%s has a balance of %.6f SD.\n\n", log.ColorBlue, status.AccountAddress, log.ColorReset, - math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizerLatestBalance), eth.Decimal)) + math.RoundDown(eth.WeiToEth(status.AccountBalances.Sd), 18)) fmt.Printf( - "The node %s%s%s requires %.6f SD in collateral.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralRequireAmount), eth.Decimal)) + "The Operator has a deposited %d ETH as collateral.\n\n", + totalEthCollateral) + // Get node SD status + sdStatusResp, err := staderClient.GetSDStatus(big.NewInt(0)) + if err != nil { + return err + } + collateralPct := 0.0 + sdStatus := sdStatusResp.SDStatus totalCollateral := new(big.Int).Add(sdStatus.SdCollateralCurrentAmount, sdStatus.SdUtilizerLatestBalance) + + current := eth.WeiToEth(totalCollateral) + require := eth.WeiToEth(sdStatus.SdCollateralRequireAmount) + + if require > 0 { + collateralPct = current / require * 10 + } + fmt.Printf( - "The node %s%s%s current has %.6f SD in collateral.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - math.RoundDown(eth.WeiToEth(totalCollateral), eth.Decimal)) + "The Operator has a deposited %.6f SD (%.6f%s) as collateral. Below is the break-up: \n\n", + math.RoundDown(eth.WeiToEth(status.DepositedSdCollateral), 18), collateralPct, "%") fmt.Printf( - "The node %s%s%s current had %.6f SD in self bond.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, + "Self-bonded: %.6f SD \n\n", math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralCurrentAmount), eth.Decimal)) - maxUtilizable := new(big.Int).Sub(sdStatus.SdMaxUtilizableAmount, sdStatus.SdUtilizerLatestBalance) - if maxUtilizable.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { - maxUtilizable = sdStatus.PoolAvailableSDBalance - } - fmt.Printf( - "The node %s%s%s can utilize max of %.6f SD.\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - eth.WeiToEth(maxUtilizable)) + "Utilized from the Utility Pool: %.6f SD.\n\n", + math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizedBalance), eth.Decimal)) fmt.Printf( - "The SD utility can provide max of %.6f SD.\n\n", - math.RoundDown(eth.WeiToEth(sdStatus.PoolAvailableSDBalance), eth.Decimal)) + "Noted: For the %d validator, the minimum SD collateral should be %.6f SD (%s) to be eligible for the SD rewards. Please ensure that the SD collateral percentage is greater than %s. The SD collateral snapshots are taken daily at a random block, and if the SD collateral value falls below the %s limit, the node operator will not earn SD rewards for that day.\n\n", + len(status.ValidatorInfos), + math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralRequireAmount), eth.Decimal), + "10%", "10%", "10%") - collateralPct := 0.0 + fmt.Printf("%s=== SD utilization Details ===%s\n", log.ColorGreen, log.ColorReset) - current := eth.WeiToEth(totalCollateral) - require := eth.WeiToEth(sdStatus.SdCollateralRequireAmount) + fmt.Printf("The Operator has utilized %.6f SD from the Utility Pool.\n\n", + math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizedBalance), eth.Decimal)) - if require > 0 { - collateralPct = current / require * 10 + fmt.Printf("The Operator has a current Utilization Position of %.6f SD. (including the utilization fee) Note: For repayment of your utilized SD, please use the `stader-cli node repay-sd ` command.\n\n", + math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizerLatestBalance), eth.Decimal)) + + maxUtilizable := new(big.Int).Sub(sdStatus.SdMaxUtilizableAmount, sdStatus.SdUtilizerLatestBalance) + if maxUtilizable.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { + maxUtilizable = sdStatus.PoolAvailableSDBalance } fmt.Printf( - "The node %s%s%s current had %.6f%s Collateral.\nPlease ensure that the SD collateral percentage is greater than %s. The SD collateral snapshots are taken daily at a random block, and if the SD collateral value falls below the %s limit, the node operator will not earn SD rewards for that day\n\n", - log.ColorBlue, - status.AccountAddress, - log.ColorReset, - collateralPct, "%", "10%", "10%") + "The Operator can utilize upto %.6f SD more.\nNote: The Operator can utilize a maximum of 1 ETH worth SD per validator.\n\n", + eth.WeiToEth(maxUtilizable)) fmt.Printf( - "The SD utility require %.6f SD.\n\n", - math.RoundDown(require, eth.Decimal)) + "The Operator has a Health Factor of %s. \nNote: Please ensure your Health Factor is greater than 1 to avoid liquidations.", + sdStatus.HealthFactor.String()) + fmt.Printf( - "The SD utility can provide max of %.6f SD.\n\n", + "The Utility Pool currently has a balance of %.6f SD.\n\n", math.RoundDown(eth.WeiToEth(sdStatus.PoolAvailableSDBalance), eth.Decimal)) + return nil } diff --git a/stader-lib/sdutility/sd-utility.go b/stader-lib/sdutility/sd-utility.go index fe751205d..80cbb62f7 100644 --- a/stader-lib/sdutility/sd-utility.go +++ b/stader-lib/sdutility/sd-utility.go @@ -6,6 +6,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + "github.com/stader-labs/stader-node/stader-lib/contracts" "github.com/stader-labs/stader-node/stader-lib/stader" ) @@ -96,3 +97,12 @@ func GetUtilizationRate(sp *stader.SDUtilityPoolContractManager, opts *bind.Call return utilizationRateInPercent, nil } + +func GetUserData(sp *stader.SDUtilityPoolContractManager, address common.Address, opts *bind.CallOpts) (*contracts.UserData, error) { + userData, err := sp.SDUtilityPool.GetUserData(opts, address) + if err != nil { + return nil, err + } + + return &userData, nil +} diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index bf65e486e..39156b348 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -38,6 +38,11 @@ func GetSDStatus( return nil, err } + userData, err := sdutility.GetUserData(sdu, operatorAddress, nil) + if err != nil { + return nil, err + } + poolAvailableSDBalance, err := sdutility.GetPoolAvailableSDBalance(sdu, nil) if err != nil { return nil, err @@ -95,6 +100,7 @@ func GetSDStatus( SdUtilizedBalance: sdUtilizedBalance, PoolAvailableSDBalance: poolAvailableSDBalance, SdRewardEligible: rewardEligibleSD, + HealthFactor: userData.HealthFactor, }, nil } From fb16a90b792bba0d69bb4a7e666c521a43b775a4 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Mon, 1 Jan 2024 23:02:11 +0530 Subject: [PATCH 090/159] clamp max utilizable value --- stader-cli/node/status.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 4e2076caf..8ce8e06ea 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -88,7 +88,7 @@ func getNodeStatus(c *cli.Context) error { fmt.Printf("Operator Status: Not Active\n\n") } - fmt.Printf("The Operator has registered a total of %d validators (To view details of each validator, please use the `stader-cli validator status` command)\n\n", len(status.ValidatorInfos)) + fmt.Printf("The Operator has registered a total of %d validators (To view details of each validator, please use the `stader-cli validator status` command)\n\n", totalRegisteredValidators) if !status.OptedInForSocializingPool { fmt.Printf("The Operator has Opted Out for Socializing Pool\n\n") @@ -166,7 +166,7 @@ func getNodeStatus(c *cli.Context) error { math.RoundDown(eth.WeiToEth(status.DepositedSdCollateral), 18), collateralPct, "%") fmt.Printf( - "Self-bonded: %.6f SD \n\n", + "Self-bonded: %.6f SD \n\n", math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralCurrentAmount), eth.Decimal)) fmt.Printf( @@ -174,8 +174,8 @@ func getNodeStatus(c *cli.Context) error { math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizedBalance), eth.Decimal)) fmt.Printf( - "Noted: For the %d validator, the minimum SD collateral should be %.6f SD (%s) to be eligible for the SD rewards. Please ensure that the SD collateral percentage is greater than %s. The SD collateral snapshots are taken daily at a random block, and if the SD collateral value falls below the %s limit, the node operator will not earn SD rewards for that day.\n\n", - len(status.ValidatorInfos), + "Note: For the %d validator, the minimum SD collateral should be %.6f SD (%s) to be eligible for the SD rewards. Please ensure that the SD collateral percentage is greater than %s. The SD collateral snapshots are taken daily at a random block, and if the SD collateral value falls below the %s limit, the node operator will not earn SD rewards for that day.\n\n", + totalRegisteredValidators, math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralRequireAmount), eth.Decimal), "10%", "10%", "10%") @@ -191,6 +191,9 @@ func getNodeStatus(c *cli.Context) error { if maxUtilizable.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { maxUtilizable = sdStatus.PoolAvailableSDBalance } + if maxUtilizable.Sign() < 0 { + maxUtilizable = big.NewInt(0) + } fmt.Printf( "The Operator can utilize upto %.6f SD more.\nNote: The Operator can utilize a maximum of 1 ETH worth SD per validator.\n\n", From 92609e6f39ab1fd7ffc0846437725c637e679519 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Tue, 2 Jan 2024 11:48:04 +0530 Subject: [PATCH 091/159] add a newline --- stader-cli/node/status.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 8ce8e06ea..ca2620a5f 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -184,7 +184,7 @@ func getNodeStatus(c *cli.Context) error { fmt.Printf("The Operator has utilized %.6f SD from the Utility Pool.\n\n", math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizedBalance), eth.Decimal)) - fmt.Printf("The Operator has a current Utilization Position of %.6f SD. (including the utilization fee) Note: For repayment of your utilized SD, please use the `stader-cli node repay-sd ` command.\n\n", + fmt.Printf("The Operator has a current Utilization Position of %.6f SD. (including the utilization fee)\n Note: For repayment of your utilized SD, please use the `stader-cli node repay-sd ` command.\n\n", math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizerLatestBalance), eth.Decimal)) maxUtilizable := new(big.Int).Sub(sdStatus.SdMaxUtilizableAmount, sdStatus.SdUtilizerLatestBalance) From 1b37f8ec1fa3d1a4539ba4f4551a00c5dce8aff6 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Tue, 2 Jan 2024 11:54:33 +0530 Subject: [PATCH 092/159] minor refactoring --- stader-cli/node/status.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index ca2620a5f..840843d3b 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -162,15 +162,15 @@ func getNodeStatus(c *cli.Context) error { } fmt.Printf( - "The Operator has a deposited %.6f SD (%.6f%s) as collateral. Below is the break-up: \n\n", + "The Operator has a deposited %.6f SD (%.6f%s) as collateral. Below is the break-up: \n", math.RoundDown(eth.WeiToEth(status.DepositedSdCollateral), 18), collateralPct, "%") fmt.Printf( - "Self-bonded: %.6f SD \n\n", + "Self-bonded: %.6f SD \n", math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralCurrentAmount), eth.Decimal)) fmt.Printf( - "Utilized from the Utility Pool: %.6f SD.\n\n", + "Utilized from the Utility Pool: %.6f SD.\n", math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizedBalance), eth.Decimal)) fmt.Printf( @@ -200,7 +200,7 @@ func getNodeStatus(c *cli.Context) error { eth.WeiToEth(maxUtilizable)) fmt.Printf( - "The Operator has a Health Factor of %s. \nNote: Please ensure your Health Factor is greater than 1 to avoid liquidations.", + "The Operator has a Health Factor of %s. \nNote: Please ensure your Health Factor is greater than 1 to avoid liquidations.", sdStatus.HealthFactor.String()) fmt.Printf( From 273c3ea6ff901210daee21a352f5bfa8c0febc3d Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Tue, 2 Jan 2024 14:25:42 +0530 Subject: [PATCH 093/159] fix total collateral amount --- stader-cli/node/status.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 840843d3b..e288ebf94 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -163,7 +163,7 @@ func getNodeStatus(c *cli.Context) error { fmt.Printf( "The Operator has a deposited %.6f SD (%.6f%s) as collateral. Below is the break-up: \n", - math.RoundDown(eth.WeiToEth(status.DepositedSdCollateral), 18), collateralPct, "%") + math.RoundDown(eth.WeiToEth(totalCollateral), 18), collateralPct, "%") fmt.Printf( "Self-bonded: %.6f SD \n", From 836100d6554cad7f4295380d2331fafd25d8825f Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Tue, 2 Jan 2024 14:31:34 +0530 Subject: [PATCH 094/159] sd utility pool contract to get-contracts-info --- stader-cli/node/get-contracts-info.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stader-cli/node/get-contracts-info.go b/stader-cli/node/get-contracts-info.go index 6d4e3480d..ae27c5e34 100644 --- a/stader-cli/node/get-contracts-info.go +++ b/stader-cli/node/get-contracts-info.go @@ -2,6 +2,7 @@ package node import ( "fmt" + "github.com/stader-labs/stader-node/shared/services/stader" cliutils "github.com/stader-labs/stader-node/shared/utils/cli" "github.com/stader-labs/stader-node/shared/utils/log" @@ -42,6 +43,7 @@ func getContractsInfo(c *cli.Context) error { fmt.Printf("Socializing Pool: %s\n\n", response.SocializingPoolContract) fmt.Printf("Permissionless Pool: %s\n\n", response.PermisionlessPool) fmt.Printf("Stader Oracle: %s\n\n", response.StaderOracle) + fmt.Printf("Sd Utility Pool: %s\n\n", response.SdUtilityContract) fmt.Printf("Pre-sign encryption key is %s\n\n", response.EncryptionKey) return nil From 8794f713fa05a5fb911b58d6afe810a4bfdf98dd Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Tue, 2 Jan 2024 14:54:48 +0530 Subject: [PATCH 095/159] add a newline --- stader-cli/node/status.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index e288ebf94..d1a9c2089 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -200,7 +200,7 @@ func getNodeStatus(c *cli.Context) error { eth.WeiToEth(maxUtilizable)) fmt.Printf( - "The Operator has a Health Factor of %s. \nNote: Please ensure your Health Factor is greater than 1 to avoid liquidations.", + "The Operator has a Health Factor of %s. \nNote: Please ensure your Health Factor is greater than 1 to avoid liquidations.\n\n", sdStatus.HealthFactor.String()) fmt.Printf( From d9d2661b4b401ed22c2051213e7aa43df9ed91c1 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 2 Jan 2024 18:08:09 +0700 Subject: [PATCH 096/159] Update metrics --- shared/services/state/network-state.go | 36 +++++++++++++++---- stader/guardian/collector/constants.go | 3 ++ .../guardian/collector/operator-collector.go | 15 ++++++++ stader/guardian/collector/state-locker.go | 3 ++ 4 files changed, 51 insertions(+), 6 deletions(-) diff --git a/shared/services/state/network-state.go b/shared/services/state/network-state.go index 2e3e23273..a82716ab1 100644 --- a/shared/services/state/network-state.go +++ b/shared/services/state/network-state.go @@ -123,6 +123,15 @@ type MetricDetails struct { // done OperatorSDInterest float64 + + // done + SdCollateralPct float64 + + // done + LockedEth float64 + + // done + HealthFactor *big.Int } type MetricsCache struct { @@ -468,17 +477,17 @@ func CreateMetricsCache( return nil, err } - sdUtilizedLatest, err := sdutility.GetUtilizerLatestBalance(sdu, nodeAddress, nil) + sdUtilized, err := sd_collateral.GetOperatorUtilizedSDBalance(sdc, nodeAddress, nil) if err != nil { return nil, err } - sdUtilized, err := sd_collateral.GetOperatorUtilizedSDBalance(sdc, nodeAddress, nil) + utilityPoolBalance, err := sdutility.GetPoolAvailableSDBalance(sdu, nil) if err != nil { return nil, err } - utilityPoolBalance, err := sdutility.GetPoolAvailableSDBalance(sdu, nil) + userData, err := sdutility.GetUserData(sdu, nodeAddress, nil) if err != nil { return nil, err } @@ -489,7 +498,7 @@ func CreateMetricsCache( metricsDetails.SdPrice = sdPriceFormatted metricsDetails.EthPrice = math.RoundDown(eth.WeiToEth(ethPrice), 10) - metricsDetails.OperatorStakedSd = math.RoundDown(eth.WeiToEth(operatorSdColletaral), 10) + metricsDetails.OperatorStakedSdInEth = math.RoundDown(eth.WeiToEth(operatorSdCollateralInEth), 10) metricsDetails.OperatorEthCollateral = operatorEthCollateral metricsDetails.TotalOperators = totalOperators.Sub(totalOperators, big.NewInt(1)) @@ -502,6 +511,7 @@ func CreateMetricsCache( metricsDetails.TotalStakedEthByNos = big.NewInt(0).Mul(totalValidators, big.NewInt(4)) metricsDetails.CollateralRatio = math.RoundDown(eth.WeiToEth(permissionlessPoolThreshold.MinThreshold), 2) metricsDetails.CollateralRatioInSd = collateralRatioInSd + metricsDetails.MinEthThreshold = math.RoundDown(eth.WeiToEth(poolThreshold.MinThreshold), 4) metricsDetails.MaxEthThreshold = math.RoundDown(eth.WeiToEth(poolThreshold.MaxThreshold), 4) @@ -534,10 +544,24 @@ func CreateMetricsCache( // amount NO utilized, not include fee metricsDetails.OperatorSDUtilized = math.RoundDown(eth.WeiToEth(sdUtilized), SixDecimalRound) - fee := new(big.Int).Sub(sdUtilizedLatest, sdUtilized) - metricsDetails.OperatorSDInterest = math.RoundDown(eth.WeiToEth(fee), SixDecimalRound) + metricsDetails.OperatorSDInterest = math.RoundDown(eth.WeiToEth(userData.TotalInterestSD), SixDecimalRound) metricsDetails.SdUtilityPoolBalance = math.RoundDown(eth.WeiToEth(utilityPoolBalance), SixDecimalRound) + // + operatorStakedSd := eth.WeiToEth(operatorSdColletaral) + metricsDetails.OperatorSDUtilized + requireCollateral := collateralRatioInSd * float64(operatorNonTerminalKeys) + + collateralPct := 0.0 + if requireCollateral > 0 { + collateralPct = (operatorStakedSd / requireCollateral) * 10 + } + + metricsDetails.OperatorStakedSd = math.RoundDown(operatorStakedSd, 10) + + metricsDetails.SdCollateralPct = collateralPct + + metricsDetails.LockedEth = math.RoundDown(eth.WeiToEth(userData.LockedEth), SixDecimalRound) + metricsDetails.HealthFactor = userData.HealthFactor state.StaderNetworkDetails = metricsDetails diff --git a/stader/guardian/collector/constants.go b/stader/guardian/collector/constants.go index 75aa48502..dd64691dd 100644 --- a/stader/guardian/collector/constants.go +++ b/stader/guardian/collector/constants.go @@ -31,6 +31,9 @@ const UnclaimedCLRewards = "unclaimed_cl_rewards" const NextRewardCycleTime = "next_reward_cycle_time" const SDUtilized = "sd_utilized" const SDUtilizedInterest = "sd_utilized_interest" +const SdCollateralPct = "sd_collateral_pct" +const LockedEth = "eth_locked" +const HeathFactor = "heath_factor" // Node Health => stader_node_health+ key const NodeSub = "node_health" diff --git a/stader/guardian/collector/operator-collector.go b/stader/guardian/collector/operator-collector.go index 2e52cb3b8..64361d37c 100644 --- a/stader/guardian/collector/operator-collector.go +++ b/stader/guardian/collector/operator-collector.go @@ -35,6 +35,9 @@ type OperatorCollector struct { TotalEthColateral *prometheus.Desc TotalSDUtilized *prometheus.Desc TotalSDUtilizedInterest *prometheus.Desc + SdCollateralPct *prometheus.Desc + LockedEth *prometheus.Desc + HealthFactor *prometheus.Desc // The beacon client bc beacon.Client @@ -118,6 +121,12 @@ func NewOperatorCollector( prometheus.BuildFQName(namespace, OperatorSub, SDUtilized), "", nil, nil), TotalSDUtilizedInterest: prometheus.NewDesc( prometheus.BuildFQName(namespace, OperatorSub, SDUtilizedInterest), "", nil, nil), + SdCollateralPct: prometheus.NewDesc( + prometheus.BuildFQName(namespace, OperatorSub, SdCollateralPct), "", nil, nil), + LockedEth: prometheus.NewDesc( + prometheus.BuildFQName(namespace, OperatorSub, LockedEth), "", nil, nil), + HealthFactor: prometheus.NewDesc( + prometheus.BuildFQName(namespace, OperatorSub, HeathFactor), "", nil, nil), bc: bc, ec: ec, nodeAddress: nodeAddress, @@ -150,6 +159,9 @@ func (collector *OperatorCollector) Describe(channel chan<- *prometheus.Desc) { channel <- collector.TotalEthColateral channel <- collector.TotalSDUtilized channel <- collector.TotalSDUtilizedInterest + channel <- collector.SdCollateralPct + channel <- collector.LockedEth + channel <- collector.HealthFactor } // Collect the latest metric values and pass them to Prometheus @@ -179,6 +191,9 @@ func (collector *OperatorCollector) Collect(channel chan<- prometheus.Metric) { channel <- prometheus.MustNewConstMetric(collector.TotalEthColateral, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorEthCollateral) channel <- prometheus.MustNewConstMetric(collector.TotalSDUtilized, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorSDUtilized) channel <- prometheus.MustNewConstMetric(collector.TotalSDUtilizedInterest, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorSDInterest) + channel <- prometheus.MustNewConstMetric(collector.SdCollateralPct, prometheus.GaugeValue, state.StaderNetworkDetails.SdCollateralPct) + channel <- prometheus.MustNewConstMetric(collector.LockedEth, prometheus.GaugeValue, state.StaderNetworkDetails.LockedEth) + channel <- prometheus.MustNewConstMetric(collector.HealthFactor, prometheus.GaugeValue, float64(state.StaderNetworkDetails.HealthFactor.Int64())) } // Log error messages diff --git a/stader/guardian/collector/state-locker.go b/stader/guardian/collector/state-locker.go index eb6b8c8f0..6e79df23f 100644 --- a/stader/guardian/collector/state-locker.go +++ b/stader/guardian/collector/state-locker.go @@ -60,6 +60,9 @@ func NewMetricsCacheContainer() *MetricsCacheContainer { CollateralRatioInSd: 0, OperatorSDUtilized: 0, OperatorSDInterest: 0, + SdCollateralPct: 0, + LockedEth: 0, + HealthFactor: big.NewInt(0), StaderQueuedValidators: big.NewInt(0), }, }, From 26d8bfa081247225b4b2e91ba56cd6cc5f9d6620 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Tue, 2 Jan 2024 17:40:54 +0530 Subject: [PATCH 097/159] make sd float equality threshold 0.1 --- stader-lib/utils/sd/sd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stader-lib/utils/sd/sd.go b/stader-lib/utils/sd/sd.go index 8064e26e1..1a10f7a30 100644 --- a/stader-lib/utils/sd/sd.go +++ b/stader-lib/utils/sd/sd.go @@ -11,7 +11,7 @@ import ( ) const ( - SDFloatStringEqualityThreshold = 1e-5 // 0.00001 + SDFloatStringEqualityThreshold = 0.1 ) var SDWeiEqualityThreshold = eth.EthToWei(SDFloatStringEqualityThreshold) From 9ee8c19335af3ce0d01b1a336980b8805cc60e80 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Wed, 3 Jan 2024 15:59:43 +0530 Subject: [PATCH 098/159] use claimFor --- stader-lib/node/operator.go | 13 +++++++++ stader/api/node/claim-rewards.go | 47 +++++++++++++++++++++++++------- 2 files changed, 50 insertions(+), 10 deletions(-) diff --git a/stader-lib/node/operator.go b/stader-lib/node/operator.go index 46850ea0f..fe7a73925 100644 --- a/stader-lib/node/operator.go +++ b/stader-lib/node/operator.go @@ -38,6 +38,19 @@ func ClaimOperatorRewards(orc *stader.OperatorRewardsCollectorContractManager, o return tx, nil } +func ClaimOperatorRewardsWithAmount(orc *stader.OperatorRewardsCollectorContractManager, operatorAddress common.Address, amount *big.Int, opts *bind.TransactOpts) (*types.Transaction, error) { + tx, err := orc.OperatorRewardsCollector.ClaimFor(opts, operatorAddress, amount) + if err != nil { + return nil, fmt.Errorf("Could not claim operator rewards: %w", err) + } + + return tx, nil +} + +func EstimateClaimOperatorRewardsWithAmount(orc *stader.OperatorRewardsCollectorContractManager, operatorAddress common.Address, amount *big.Int, opts *bind.TransactOpts) (stader.GasInfo, error) { + return orc.OperatorRewardsCollectorContract.GetTransactionGasInfo(opts, "claimFor", operatorAddress, amount) +} + func EstimateChangeSocializingPoolState(pnr *stader.PermissionlessNodeRegistryContractManager, socializeEl bool, opts *bind.TransactOpts) (stader.GasInfo, error) { return pnr.PermissionlessNodeRegistryContract.GetTransactionGasInfo(opts, "changeSocializingPoolState", socializeEl) } diff --git a/stader/api/node/claim-rewards.go b/stader/api/node/claim-rewards.go index b91c371b7..c43f1ccfb 100644 --- a/stader/api/node/claim-rewards.go +++ b/stader/api/node/claim-rewards.go @@ -3,9 +3,11 @@ package node import ( "math/big" + "github.com/ethereum/go-ethereum/core/types" "github.com/stader-labs/stader-node/shared/services" "github.com/stader-labs/stader-node/shared/types/api" "github.com/stader-labs/stader-node/stader-lib/node" + "github.com/stader-labs/stader-node/stader-lib/stader" "github.com/urfave/cli" ) @@ -59,10 +61,18 @@ func CanClaimRewards(c *cli.Context) (*api.CanClaimRewards, error) { return nil, err } - // estimate gas - gasInfo, err := node.EstimateClaimOperatorRewards(orc, opts) - if err != nil { - return nil, err + var gasInfo stader.GasInfo + if operatorClaimVaultBalance.Cmp(withdrawableInEth) != 0 { + gasInfo, err = node.EstimateClaimOperatorRewardsWithAmount(orc, nodeAccount.Address, totalWithdrawableEth, opts) + if err != nil { + return nil, err + } + } else { + // estimate gas + gasInfo, err = node.EstimateClaimOperatorRewards(orc, opts) + if err != nil { + return nil, err + } } response.GasInfo = gasInfo @@ -92,12 +102,12 @@ func ClaimRewards(c *cli.Context) (*api.ClaimRewards, error) { response := api.ClaimRewards{} - nodeAddress, err := w.GetNodeAccount() + nodeAccount, err := w.GetNodeAccount() if err != nil { return nil, err } - operatorId, err := node.GetOperatorId(pnr, nodeAddress.Address, nil) + operatorId, err := node.GetOperatorId(pnr, nodeAccount.Address, nil) if err != nil { return nil, err } @@ -106,7 +116,12 @@ func ClaimRewards(c *cli.Context) (*api.ClaimRewards, error) { return nil, err } - operatorRewardsBalance, err := node.GetOperatorRewardsCollectorBalance(orc, nodeAddress.Address, nil) + operatorRewardsBalance, err := node.GetOperatorRewardsCollectorBalance(orc, nodeAccount.Address, nil) + if err != nil { + return nil, err + } + + withdrawableInEth, err := node.WithdrawableInEth(orc, nodeAccount.Address, nil) if err != nil { return nil, err } @@ -120,9 +135,21 @@ func ClaimRewards(c *cli.Context) (*api.ClaimRewards, error) { } // estimate gas - tx, err := node.ClaimOperatorRewards(orc, opts) - if err != nil { - return nil, err + var tx *types.Transaction + if operatorRewardsBalance.Cmp(withdrawableInEth) == 0 { + tx, err = node.ClaimOperatorRewards(orc, opts) + if err != nil { + return nil, err + } + } else { + totalWithdrawableEth := operatorRewardsBalance + if operatorRewardsBalance.Cmp(withdrawableInEth) > 0 { + totalWithdrawableEth = withdrawableInEth + } + tx, err = node.ClaimOperatorRewardsWithAmount(orc, nodeAccount.Address, totalWithdrawableEth, opts) + if err != nil { + return nil, err + } } response.TxHash = tx.Hash() From 198d3b21bc8f17ccf316df17490456a3e49258db Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Wed, 3 Jan 2024 16:25:40 +0530 Subject: [PATCH 099/159] fetch fee from userdata --- shared/types/api/node.go | 1 + stader-cli/node/claim-rewards.go | 2 +- stader/api/validator/deposit.go | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/shared/types/api/node.go b/shared/types/api/node.go index b1966384a..7477aeb78 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -455,6 +455,7 @@ type SdStatusResponse struct { PoolAvailableSDBalance *big.Int `json:"poolAvailableSDBalance"` SdRewardEligible *big.Int `json:"sdRewardEligible"` HealthFactor *big.Int `json:"healthFactor"` + AccumulatedInterest *big.Int `json:"accumulatedInterest"` NotEnoughSdCollateral bool `json:"notEnoughSdCollateral"` } diff --git a/stader-cli/node/claim-rewards.go b/stader-cli/node/claim-rewards.go index 89fcc7561..683edcf05 100644 --- a/stader-cli/node/claim-rewards.go +++ b/stader-cli/node/claim-rewards.go @@ -48,7 +48,7 @@ func ClaimRewards(c *cli.Context) error { // if withdrawableInEth < claimsBalance, then there is an existing utilization position if canClaimRewardsResponse.ClaimsBalance.Cmp(canClaimRewardsResponse.WithdrawableInEth) != 0 { if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { - totalFee := new(big.Int).Sub(sdStatus.SdUtilizerLatestBalance, sdStatus.SdUtilizedBalance) + totalFee := sdStatus.AccumulatedInterest fmt.Printf("You need to first pay %f and close the utilization position to get back your funds. Execute the following command to repay your utilized SD stader-cli repay-sd --amount \n", eth.WeiToEth(totalFee)) diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index 39156b348..ef20490b0 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -101,6 +101,7 @@ func GetSDStatus( PoolAvailableSDBalance: poolAvailableSDBalance, SdRewardEligible: rewardEligibleSD, HealthFactor: userData.HealthFactor, + AccumulatedInterest: userData.TotalInterestSD, }, nil } From 27c79e2b44b1bbae456cd365ba35c88db9040316 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Wed, 3 Jan 2024 16:25:40 +0530 Subject: [PATCH 100/159] fetch fee from userdata From 8cfbaf518296ab33a7482ba0399c93bc95d8dc32 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Wed, 3 Jan 2024 16:47:24 +0530 Subject: [PATCH 101/159] dont show collateral info if there are no registered validators --- stader-cli/node/claim-rewards.go | 2 +- stader-cli/node/status.go | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/stader-cli/node/claim-rewards.go b/stader-cli/node/claim-rewards.go index 683edcf05..3c243b2a7 100644 --- a/stader-cli/node/claim-rewards.go +++ b/stader-cli/node/claim-rewards.go @@ -54,7 +54,7 @@ func ClaimRewards(c *cli.Context) error { fmt.Printf("Based on the current Health Factor, you can claim upto %.6f ETH.\n", eth.WeiToEth(canClaimRewardsResponse.WithdrawableInEth)) - fmt.Printf("Note: Please repay your utilized SD by using the following command to claim the remaining ETH: stader-cli sd repay --amount .\n") + fmt.Printf("Note: Please repay your utilized SD by using the following command to claim the remaining ETH: stader-cli sd repay --amount .\n\n") } } diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index d1a9c2089..183140c51 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -173,11 +173,13 @@ func getNodeStatus(c *cli.Context) error { "Utilized from the Utility Pool: %.6f SD.\n", math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizedBalance), eth.Decimal)) - fmt.Printf( - "Note: For the %d validator, the minimum SD collateral should be %.6f SD (%s) to be eligible for the SD rewards. Please ensure that the SD collateral percentage is greater than %s. The SD collateral snapshots are taken daily at a random block, and if the SD collateral value falls below the %s limit, the node operator will not earn SD rewards for that day.\n\n", - totalRegisteredValidators, - math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralRequireAmount), eth.Decimal), - "10%", "10%", "10%") + if totalRegisteredValidators.Cmp(big.NewInt(0)) != 0 { + fmt.Printf( + "Note: For the %d validator, the minimum SD collateral should be %.6f SD (%s) to be eligible for the SD rewards. Please ensure that the SD collateral percentage is greater than %s. The SD collateral snapshots are taken daily at a random block, and if the SD collateral value falls below the %s limit, the node operator will not earn SD rewards for that day.\n\n", + totalRegisteredValidators, + math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralRequireAmount), eth.Decimal), + "10%", "10%", "10%") + } fmt.Printf("%s=== SD utilization Details ===%s\n", log.ColorGreen, log.ColorReset) From 982cd260f2b7ebd5530a3efd81638d8cfb19a8a9 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Wed, 3 Jan 2024 16:50:37 +0530 Subject: [PATCH 102/159] don't show claim amount below 0.00001 eth --- stader-cli/node/status.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 183140c51..307198401 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -12,6 +12,10 @@ import ( "github.com/urfave/cli" ) +const ( + minEthBalanceForClaim = 100000000000000 // 0.0001 ETH +) + func getNodeStatus(c *cli.Context) error { staderClient, err := stader.NewClientFromCtx(c) @@ -114,7 +118,7 @@ func getNodeStatus(c *cli.Context) error { fmt.Printf("2. Use the %sstader-cli node claim-rewards%s command to claim the EL rewards from the claim vault to your operator reward address\n\n", log.ColorGreen, log.ColorReset) } - if status.OperatorRewardCollectorBalance.Cmp(big.NewInt(0)) > 0 { + if status.OperatorRewardCollectorBalance.Cmp(big.NewInt(minEthBalanceForClaim)) > 0 { fmt.Printf( "The Operator has aggregated total claims of %.6f ETH in the claim vault\n", math.RoundDown(eth.WeiToEth(status.OperatorRewardCollectorBalance), 6)) From 464047359a992fb62be3c7064955218d30051644 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Wed, 3 Jan 2024 16:53:02 +0530 Subject: [PATCH 103/159] add a newline --- stader-cli/node/status.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 307198401..23e26cfa0 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -183,6 +183,8 @@ func getNodeStatus(c *cli.Context) error { totalRegisteredValidators, math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralRequireAmount), eth.Decimal), "10%", "10%", "10%") + } else { + fmt.Println("") } fmt.Printf("%s=== SD utilization Details ===%s\n", log.ColorGreen, log.ColorReset) From c26734ca465dfafe16e8437217ebaab50422d380 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Wed, 3 Jan 2024 17:18:52 +0530 Subject: [PATCH 104/159] use close approximations when converting wei to eth --- stader-cli/node/status.go | 8 ++++---- stader-lib/utils/eth/units.go | 11 +++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 23e26cfa0..f8d5727d7 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -121,7 +121,7 @@ func getNodeStatus(c *cli.Context) error { if status.OperatorRewardCollectorBalance.Cmp(big.NewInt(minEthBalanceForClaim)) > 0 { fmt.Printf( "The Operator has aggregated total claims of %.6f ETH in the claim vault\n", - math.RoundDown(eth.WeiToEth(status.OperatorRewardCollectorBalance), 6)) + math.RoundDown(eth.WeiToEthWithValCheck(status.OperatorRewardCollectorBalance), 6)) fmt.Printf("To transfer the claims to your operator reward address use the %sstader-cli node claim-rewards%s command\n\n", log.ColorGreen, log.ColorReset) } @@ -181,7 +181,7 @@ func getNodeStatus(c *cli.Context) error { fmt.Printf( "Note: For the %d validator, the minimum SD collateral should be %.6f SD (%s) to be eligible for the SD rewards. Please ensure that the SD collateral percentage is greater than %s. The SD collateral snapshots are taken daily at a random block, and if the SD collateral value falls below the %s limit, the node operator will not earn SD rewards for that day.\n\n", totalRegisteredValidators, - math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralRequireAmount), eth.Decimal), + math.RoundDown(eth.WeiToEthWithValCheck(sdStatus.SdCollateralRequireAmount), eth.Decimal), "10%", "10%", "10%") } else { fmt.Println("") @@ -190,10 +190,10 @@ func getNodeStatus(c *cli.Context) error { fmt.Printf("%s=== SD utilization Details ===%s\n", log.ColorGreen, log.ColorReset) fmt.Printf("The Operator has utilized %.6f SD from the Utility Pool.\n\n", - math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizedBalance), eth.Decimal)) + math.RoundDown(eth.WeiToEthWithValCheck(sdStatus.SdUtilizedBalance), eth.Decimal)) fmt.Printf("The Operator has a current Utilization Position of %.6f SD. (including the utilization fee)\n Note: For repayment of your utilized SD, please use the `stader-cli node repay-sd ` command.\n\n", - math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizerLatestBalance), eth.Decimal)) + math.RoundDown(eth.WeiToEthWithValCheck(sdStatus.SdUtilizerLatestBalance), eth.Decimal)) maxUtilizable := new(big.Int).Sub(sdStatus.SdMaxUtilizableAmount, sdStatus.SdUtilizerLatestBalance) if maxUtilizable.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { diff --git a/stader-lib/utils/eth/units.go b/stader-lib/utils/eth/units.go index bacd82807..888414b6d 100644 --- a/stader-lib/utils/eth/units.go +++ b/stader-lib/utils/eth/units.go @@ -30,8 +30,19 @@ const ( WeiPerGwei float64 = 1e9 Decimal = 18 BaseAmountInEth = 4 + Threshold = 1e6 ) +func WeiToEthWithValCheck(wei *big.Int) float64 { + if wei == nil { + return 0 + } + if wei.Cmp(big.NewInt(Threshold)) < 0 { + return float64(wei.Int64()) + } + return WeiToEth(wei) +} + // Convert wei to eth func WeiToEth(wei *big.Int) float64 { var weiFloat big.Float From d4cf25c6534d1e6d772c212bf04e6c0a10dcd037 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Wed, 3 Jan 2024 17:35:53 +0530 Subject: [PATCH 105/159] minor fixes --- stader-cli/node/status.go | 54 ++++++++++++++++++++++++++--------- stader-lib/utils/eth/units.go | 10 +++---- 2 files changed, 46 insertions(+), 18 deletions(-) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index f8d5727d7..93125f082 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -119,10 +119,18 @@ func getNodeStatus(c *cli.Context) error { } if status.OperatorRewardCollectorBalance.Cmp(big.NewInt(minEthBalanceForClaim)) > 0 { - fmt.Printf( - "The Operator has aggregated total claims of %.6f ETH in the claim vault\n", - math.RoundDown(eth.WeiToEthWithValCheck(status.OperatorRewardCollectorBalance), 6)) - fmt.Printf("To transfer the claims to your operator reward address use the %sstader-cli node claim-rewards%s command\n\n", log.ColorGreen, log.ColorReset) + val, denom := eth.WeiToEthWithValCheck(status.OperatorRewardCollectorBalance) + if denom == "eth" { + fmt.Printf( + "The Operator has aggregated total claims of %.6f ETH in the claim vault\n", + math.RoundDown(val, 6)) + fmt.Printf("To transfer the claims to your operator reward address use the %sstader-cli node claim-rewards%s command\n\n", log.ColorGreen, log.ColorReset) + } else { + fmt.Printf( + "The Operator has aggregated total claims of %.6f wei in the claim vault\n", + math.RoundDown(val, 6)) + fmt.Printf("To transfer the claims to your operator reward address use the %sstader-cli node claim-rewards%s command\n\n", log.ColorGreen, log.ColorReset) + } } fmt.Printf( @@ -178,22 +186,42 @@ func getNodeStatus(c *cli.Context) error { math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizedBalance), eth.Decimal)) if totalRegisteredValidators.Cmp(big.NewInt(0)) != 0 { - fmt.Printf( - "Note: For the %d validator, the minimum SD collateral should be %.6f SD (%s) to be eligible for the SD rewards. Please ensure that the SD collateral percentage is greater than %s. The SD collateral snapshots are taken daily at a random block, and if the SD collateral value falls below the %s limit, the node operator will not earn SD rewards for that day.\n\n", - totalRegisteredValidators, - math.RoundDown(eth.WeiToEthWithValCheck(sdStatus.SdCollateralRequireAmount), eth.Decimal), - "10%", "10%", "10%") + val, denom := eth.WeiToEthWithValCheck(sdStatus.SdCollateralRequireAmount) + if denom == "eth" { + fmt.Printf( + "Note: For the %d validator, the minimum SD collateral should be %.6f SD (%s) to be eligible for the SD rewards. Please ensure that the SD collateral percentage is greater than %s. The SD collateral snapshots are taken daily at a random block, and if the SD collateral value falls below the %s limit, the node operator will not earn SD rewards for that day.\n\n", + totalRegisteredValidators, + math.RoundDown(val, eth.Decimal), + "10%", "10%", "10%") + } else { + fmt.Printf( + "Note: For the %d validator, the minimum (wei) SD collateral should be %.6f SD (%s) to be eligible for the SD rewards. Please ensure that the SD collateral percentage is greater than %s. The SD collateral snapshots are taken daily at a random block, and if the SD collateral value falls below the %s limit, the node operator will not earn SD rewards for that day.\n\n", + totalRegisteredValidators, + math.RoundDown(val, eth.Decimal), + "10%", "10%", "10%") + } } else { fmt.Println("") } fmt.Printf("%s=== SD utilization Details ===%s\n", log.ColorGreen, log.ColorReset) - fmt.Printf("The Operator has utilized %.6f SD from the Utility Pool.\n\n", - math.RoundDown(eth.WeiToEthWithValCheck(sdStatus.SdUtilizedBalance), eth.Decimal)) + val, denom := eth.WeiToEthWithValCheck(sdStatus.SdUtilizedBalance) + if denom == "eth" { + fmt.Printf("The Operator has utilized %.6f SD from the Utility Pool.\n\n", + math.RoundDown(val, eth.Decimal)) + } else { + fmt.Printf("The Operator has utilized %.6f wei SD from the Utility Pool.\n\n", math.RoundDown(val, eth.Decimal)) + } - fmt.Printf("The Operator has a current Utilization Position of %.6f SD. (including the utilization fee)\n Note: For repayment of your utilized SD, please use the `stader-cli node repay-sd ` command.\n\n", - math.RoundDown(eth.WeiToEthWithValCheck(sdStatus.SdUtilizerLatestBalance), eth.Decimal)) + val, denom = eth.WeiToEthWithValCheck(sdStatus.SdUtilizedBalance) + if denom == "eth" { + fmt.Printf("The Operator has a current Utilization Position of %.6f SD. (including the utilization fee)\n Note: For repayment of your utilized SD, please use the `stader-cli node repay-sd ` command.\n\n", + math.RoundDown(val, eth.Decimal)) + } else { + fmt.Printf("The Operator has a current Utilization Position of %.6f wei SD. (including the utilization fee)\n Note: For repayment of your utilized SD, please use the `stader-cli node repay-sd ` command.\n\n", + math.RoundDown(val, eth.Decimal)) + } maxUtilizable := new(big.Int).Sub(sdStatus.SdMaxUtilizableAmount, sdStatus.SdUtilizerLatestBalance) if maxUtilizable.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { diff --git a/stader-lib/utils/eth/units.go b/stader-lib/utils/eth/units.go index 888414b6d..1afd35631 100644 --- a/stader-lib/utils/eth/units.go +++ b/stader-lib/utils/eth/units.go @@ -30,17 +30,17 @@ const ( WeiPerGwei float64 = 1e9 Decimal = 18 BaseAmountInEth = 4 - Threshold = 1e6 + Threshold = 1e12 ) -func WeiToEthWithValCheck(wei *big.Int) float64 { +func WeiToEthWithValCheck(wei *big.Int) (float64, string) { if wei == nil { - return 0 + return 0, "" } if wei.Cmp(big.NewInt(Threshold)) < 0 { - return float64(wei.Int64()) + return float64(wei.Int64()), "wei" } - return WeiToEth(wei) + return WeiToEth(wei), "eth" } // Convert wei to eth From 95de273ef582af263ca243f0ca904a042c5bde4d Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Wed, 3 Jan 2024 17:46:23 +0530 Subject: [PATCH 106/159] convert wei to gwei --- stader-cli/node/status.go | 8 ++++---- stader-lib/utils/eth/units.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 93125f082..b20081f22 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -127,7 +127,7 @@ func getNodeStatus(c *cli.Context) error { fmt.Printf("To transfer the claims to your operator reward address use the %sstader-cli node claim-rewards%s command\n\n", log.ColorGreen, log.ColorReset) } else { fmt.Printf( - "The Operator has aggregated total claims of %.6f wei in the claim vault\n", + "The Operator has aggregated total claims of %.6f gwei in the claim vault\n", math.RoundDown(val, 6)) fmt.Printf("To transfer the claims to your operator reward address use the %sstader-cli node claim-rewards%s command\n\n", log.ColorGreen, log.ColorReset) } @@ -195,7 +195,7 @@ func getNodeStatus(c *cli.Context) error { "10%", "10%", "10%") } else { fmt.Printf( - "Note: For the %d validator, the minimum (wei) SD collateral should be %.6f SD (%s) to be eligible for the SD rewards. Please ensure that the SD collateral percentage is greater than %s. The SD collateral snapshots are taken daily at a random block, and if the SD collateral value falls below the %s limit, the node operator will not earn SD rewards for that day.\n\n", + "Note: For the %d validator, the minimum (gwei) SD collateral should be %.6f SD (%s) to be eligible for the SD rewards. Please ensure that the SD collateral percentage is greater than %s. The SD collateral snapshots are taken daily at a random block, and if the SD collateral value falls below the %s limit, the node operator will not earn SD rewards for that day.\n\n", totalRegisteredValidators, math.RoundDown(val, eth.Decimal), "10%", "10%", "10%") @@ -211,7 +211,7 @@ func getNodeStatus(c *cli.Context) error { fmt.Printf("The Operator has utilized %.6f SD from the Utility Pool.\n\n", math.RoundDown(val, eth.Decimal)) } else { - fmt.Printf("The Operator has utilized %.6f wei SD from the Utility Pool.\n\n", math.RoundDown(val, eth.Decimal)) + fmt.Printf("The Operator has utilized %.6f gwei SD from the Utility Pool.\n\n", math.RoundDown(val, eth.Decimal)) } val, denom = eth.WeiToEthWithValCheck(sdStatus.SdUtilizedBalance) @@ -219,7 +219,7 @@ func getNodeStatus(c *cli.Context) error { fmt.Printf("The Operator has a current Utilization Position of %.6f SD. (including the utilization fee)\n Note: For repayment of your utilized SD, please use the `stader-cli node repay-sd ` command.\n\n", math.RoundDown(val, eth.Decimal)) } else { - fmt.Printf("The Operator has a current Utilization Position of %.6f wei SD. (including the utilization fee)\n Note: For repayment of your utilized SD, please use the `stader-cli node repay-sd ` command.\n\n", + fmt.Printf("The Operator has a current Utilization Position of %.6f gwei SD. (including the utilization fee)\n Note: For repayment of your utilized SD, please use the `stader-cli node repay-sd ` command.\n\n", math.RoundDown(val, eth.Decimal)) } diff --git a/stader-lib/utils/eth/units.go b/stader-lib/utils/eth/units.go index 1afd35631..2593051a0 100644 --- a/stader-lib/utils/eth/units.go +++ b/stader-lib/utils/eth/units.go @@ -38,7 +38,7 @@ func WeiToEthWithValCheck(wei *big.Int) (float64, string) { return 0, "" } if wei.Cmp(big.NewInt(Threshold)) < 0 { - return float64(wei.Int64()), "wei" + return WeiToGwei(wei), "gwei" } return WeiToEth(wei), "eth" } From 8d8e9fc104ff66a8242e3370f6b84ddccecca394 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Wed, 3 Jan 2024 18:05:00 +0530 Subject: [PATCH 107/159] minor fix --- stader-cli/node/status.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index b20081f22..a713f1a9e 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -12,10 +12,6 @@ import ( "github.com/urfave/cli" ) -const ( - minEthBalanceForClaim = 100000000000000 // 0.0001 ETH -) - func getNodeStatus(c *cli.Context) error { staderClient, err := stader.NewClientFromCtx(c) @@ -118,7 +114,7 @@ func getNodeStatus(c *cli.Context) error { fmt.Printf("2. Use the %sstader-cli node claim-rewards%s command to claim the EL rewards from the claim vault to your operator reward address\n\n", log.ColorGreen, log.ColorReset) } - if status.OperatorRewardCollectorBalance.Cmp(big.NewInt(minEthBalanceForClaim)) > 0 { + if status.OperatorRewardCollectorBalance.Cmp(big.NewInt(0)) > 0 { val, denom := eth.WeiToEthWithValCheck(status.OperatorRewardCollectorBalance) if denom == "eth" { fmt.Printf( From a7ee242609a877661b8ec73ab65bba0995436c65 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Wed, 3 Jan 2024 21:30:49 +0530 Subject: [PATCH 108/159] hard code the referral id --- shared/services/stader/node.go | 8 ++++---- stader-cli/validator/commands.go | 4 ---- stader-cli/validator/deposit.go | 10 ++-------- stader/api/validator/commands.go | 10 +++------- stader/api/validator/deposit.go | 13 +++++-------- 5 files changed, 14 insertions(+), 31 deletions(-) diff --git a/shared/services/stader/node.go b/shared/services/stader/node.go index e7b333063..81ada73ed 100644 --- a/shared/services/stader/node.go +++ b/shared/services/stader/node.go @@ -207,8 +207,8 @@ func (c *Client) GetNodeSdAllowance(contractAddress common.Address) (api.SdAllow } // Check whether the node can make a deposit -func (c *Client) CanNodeDeposit(amountBasedWei, amountUtilityWei, numValidators *big.Int, referralId string, reloadKeys bool) (api.CanNodeDepositResponse, error) { - responseBytes, err := c.callAPI(fmt.Sprintf("validator can-deposit %s %s %s %s %t", amountBasedWei.String(), amountUtilityWei.String(), numValidators, referralId, reloadKeys)) +func (c *Client) CanNodeDeposit(amountBasedWei, amountUtilityWei, numValidators *big.Int, reloadKeys bool) (api.CanNodeDepositResponse, error) { + responseBytes, err := c.callAPI(fmt.Sprintf("validator can-deposit %s %s %s %t", amountBasedWei.String(), amountUtilityWei.String(), numValidators, reloadKeys)) if err != nil { return api.CanNodeDepositResponse{}, fmt.Errorf("could not get can validator deposit status: %w", err) } @@ -268,8 +268,8 @@ func (c *Client) GetContractsInfo() (api.ContractsInfoResponse, error) { } // Make a node deposit -func (c *Client) NodeDeposit(amountWei, numValidators, utilitySDAmount *big.Int, referralId string, reloadKeys bool) (api.NodeDepositResponse, error) { - responseBytes, err := c.callAPI(fmt.Sprintf("validator deposit %s %s %s %s %t", amountWei.String(), utilitySDAmount.String(), numValidators, referralId, reloadKeys)) +func (c *Client) NodeDeposit(amountWei, numValidators, utilitySDAmount *big.Int, reloadKeys bool) (api.NodeDepositResponse, error) { + responseBytes, err := c.callAPI(fmt.Sprintf("validator deposit %s %s %s %t", amountWei.String(), utilitySDAmount.String(), numValidators, reloadKeys)) if err != nil { return api.NodeDepositResponse{}, fmt.Errorf("could not make validator deposit as er: %w", err) } diff --git a/stader-cli/validator/commands.go b/stader-cli/validator/commands.go index 15e672bbf..e9917f0df 100644 --- a/stader-cli/validator/commands.go +++ b/stader-cli/validator/commands.go @@ -48,10 +48,6 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { Name: "num-validators, nv", Usage: "Number of validators you want to create (Required)", }, - cli.StringFlag{ - Name: "referral-id, ri", - Usage: "A string to identify the source where the validator was created (Optional)", - }, }, Action: func(c *cli.Context) error { diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 8c34e1752..61ce9a132 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -132,13 +132,7 @@ func nodeDeposit(c *cli.Context) error { fmt.Println("Continue with create validator...") } - referralId := c.String("referral-id") - // default referral id is VANILLA which means its a regular stader-node setup unlike an avado or dappnodes - if referralId == "" { - referralId = "VANILLA" - } - - canNodeDepositResponse, err := staderClient.CanNodeDeposit(baseAmount, utilityAmount, big.NewInt(int64(numValidators)), referralId, true) + canNodeDepositResponse, err := staderClient.CanNodeDeposit(baseAmount, utilityAmount, big.NewInt(int64(numValidators)), true) if err != nil { return err } @@ -164,7 +158,7 @@ func nodeDeposit(c *cli.Context) error { } // Make deposit - response, err := staderClient.NodeDeposit(baseAmount, big.NewInt(int64(numValidators)), utilityAmount, referralId, false) + response, err := staderClient.NodeDeposit(baseAmount, big.NewInt(int64(numValidators)), utilityAmount, false) if err != nil { return err } diff --git a/stader/api/validator/commands.go b/stader/api/validator/commands.go index d1c821d7c..a103923fd 100644 --- a/stader/api/validator/commands.go +++ b/stader/api/validator/commands.go @@ -59,14 +59,12 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { return err } - referralId := c.String("referral-id") - reloadKeys, err := cliutils.ValidateBool("reload-keys", c.Args().Get(3)) if err != nil { return err } - api.PrintResponse(canNodeDeposit(c, baseAmountWei, utilityAmountWei, numValidators, referralId, reloadKeys)) + api.PrintResponse(canNodeDeposit(c, baseAmountWei, utilityAmountWei, numValidators, reloadKeys)) return nil @@ -98,15 +96,13 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { return err } - referralId := c.String("referral-id") - - reloadKeys, err := cliutils.ValidateBool("reload-keys", c.Args().Get(4)) + reloadKeys, err := cliutils.ValidateBool("reload-keys", c.Args().Get(3)) if err != nil { return err } // Run - response, err := nodeDeposit(c, baseAmountWei, utilityAmountWei, numValidators, referralId, reloadKeys) + response, err := nodeDeposit(c, baseAmountWei, utilityAmountWei, numValidators, reloadKeys) api.PrintResponse(response, err) return nil diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index ef20490b0..b3d705a42 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -5,7 +5,6 @@ import ( "math/big" "github.com/ethereum/go-ethereum/common" - "github.com/stader-labs/stader-node/shared/utils/crypto" "github.com/stader-labs/stader-node/stader-lib/node" sd_collateral "github.com/stader-labs/stader-node/stader-lib/sd-collateral" "github.com/stader-labs/stader-node/stader-lib/sdutility" @@ -105,7 +104,7 @@ func GetSDStatus( }, nil } -func canNodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidators *big.Int, referralId string, reloadKeys bool) (*api.CanNodeDepositResponse, error) { +func canNodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidators *big.Int, reloadKeys bool) (*api.CanNodeDepositResponse, error) { if err := services.RequireNodeWallet(c); err != nil { return nil, err } @@ -265,7 +264,6 @@ func canNodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidato newValidatorKey = operatorKeyCount.Add(operatorKeyCount, big.NewInt(1)) } - encodedReferralId := crypto.EncodeBase64([]byte(referralId)) // Override the provided pending TX if requested err = eth1.CheckForNonceOverride(c, opts) if err != nil { @@ -278,7 +276,7 @@ func canNodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidato pubKeys, preDepositSignatures, depositSignatures, - encodedReferralId, + "stader_labs", opts, ) if err != nil { @@ -291,7 +289,7 @@ func canNodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidato return &canNodeDepositResponse, nil } -func nodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidators *big.Int, referralId string, reloadKeys bool) (*api.NodeDepositResponse, error) { +func nodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidators *big.Int, reloadKeys bool) (*api.NodeDepositResponse, error) { cfg, err := services.GetConfig(c) if err != nil { return nil, err @@ -431,14 +429,13 @@ func nodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidators return nil, fmt.Errorf("error checking for nonce override: %w", err) } - encodedReferralId := crypto.EncodeBase64([]byte(referralId)) - tx, err := node.AddValidatorKeysWithAmount(prn, pubKeys, preDepositSignatures, depositSignatures, utilityAmountWei, - encodedReferralId, + // TODO - this is a placeholder for now + "stader_labs", opts) if err != nil { return nil, err From 386f0ff3d1600cb763f5c20d3a91d2b2723f8be9 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Thu, 4 Jan 2024 11:44:11 +0530 Subject: [PATCH 109/159] fix arg counts --- stader/api/validator/commands.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stader/api/validator/commands.go b/stader/api/validator/commands.go index a103923fd..7d3d2cc60 100644 --- a/stader/api/validator/commands.go +++ b/stader/api/validator/commands.go @@ -37,11 +37,11 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { { Name: "can-deposit", Usage: "Check whether the node can make a deposit to create a validator", - UsageText: "stader-cli api validator can-deposit amount num-validators referral-id reload-keys", + UsageText: "stader-cli api validator can-deposit amount num-validators reload-keys", Action: func(c *cli.Context) error { // Validate args - if err := cliutils.ValidateArgCount(c, 4); err != nil { + if err := cliutils.ValidateArgCount(c, 3); err != nil { return err } baseAmountWei, err := cliutils.ValidateWeiAmount("deposit amount", c.Args().Get(0)) @@ -74,11 +74,11 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { Name: "deposit", Aliases: []string{"d"}, Usage: "Make a deposit and create a validator", - UsageText: "stader-cli api validator deposit-amount utility-amount num-validators referral-id reload-keys", + UsageText: "stader-cli api validator deposit-amount utility-amount num-validators reload-keys", Action: func(c *cli.Context) error { // Validate args - if err := cliutils.ValidateArgCount(c, 4); err != nil { + if err := cliutils.ValidateArgCount(c, 3); err != nil { return err } baseAmountWei, err := cliutils.ValidateWeiAmount("deposit amount", c.Args().Get(0)) From 98d8412306c7c987dfce6d655b40a0a3b251e003 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Thu, 4 Jan 2024 12:03:03 +0530 Subject: [PATCH 110/159] fix arg count --- stader/api/validator/commands.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stader/api/validator/commands.go b/stader/api/validator/commands.go index 7d3d2cc60..09d8f449c 100644 --- a/stader/api/validator/commands.go +++ b/stader/api/validator/commands.go @@ -41,7 +41,7 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { Action: func(c *cli.Context) error { // Validate args - if err := cliutils.ValidateArgCount(c, 3); err != nil { + if err := cliutils.ValidateArgCount(c, 4); err != nil { return err } baseAmountWei, err := cliutils.ValidateWeiAmount("deposit amount", c.Args().Get(0)) @@ -78,7 +78,7 @@ func RegisterSubcommands(command *cli.Command, name string, aliases []string) { Action: func(c *cli.Context) error { // Validate args - if err := cliutils.ValidateArgCount(c, 3); err != nil { + if err := cliutils.ValidateArgCount(c, 4); err != nil { return err } baseAmountWei, err := cliutils.ValidateWeiAmount("deposit amount", c.Args().Get(0)) From 82e6492d75717c5ac43ea19b2d5932d1c6e46c16 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Thu, 4 Jan 2024 19:36:07 +0530 Subject: [PATCH 111/159] add ethToWeiWithValCheck when repaying sd collateral --- stader-cli/node/withdraw-sd.go | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index 69e26fcd7..d408cdf3d 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -54,19 +54,18 @@ func WithdrawSd(c *cli.Context) error { hasUtilizePosition := sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) != 0 if hasUtilizePosition { - if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(amountWei) > 0 { - confirm := cliutils.Confirm(fmt.Sprintf("You have an existing Utilization Position of %.6f SD. The excess SD collateral you are trying to withdraw will be used to repay the utilized SD.\n Do you wish to proceed?", math.RoundDown(eth.WeiToEth(sdStatusResponse.SDStatus.SdUtilizerLatestBalance), 6))) - if !confirm { - fmt.Println("Cancelled.") - return nil - } + val, denom := eth.WeiToEthWithValCheck(sdStatusResponse.SDStatus.SdUtilizerLatestBalance) + confirm := false + if denom == "gwei" { + confirm = cliutils.Confirm(fmt.Sprintf("You have an existing Utilization Position of %.6f gwei SD. The excess SD collateral you are trying to withdraw will be used to repay the utilized SD.\n Do you wish to proceed?", math.RoundDown(val, 6))) } else { - confirm := cliutils.Confirm(fmt.Sprintf("You have an existing Utilization Position of %.6f SD. The excess SD collateral you are trying to withdraw will be used to repay the utilized SD and the remaining SD will be sent to your Reward Address.\n Do you wish to proceed?", math.RoundDown(eth.WeiToEth(sdStatusResponse.SDStatus.SdUtilizerLatestBalance), 6))) - if !confirm { - fmt.Println("Cancelled.") - return nil - } + confirm = cliutils.Confirm(fmt.Sprintf("You have an existing Utilization Position of %.6f SD. The excess SD collateral you are trying to withdraw will be used to repay the utilized SD.\n Do you wish to proceed?", math.RoundDown(val, 6))) } + if !confirm { + fmt.Println("Cancelled.") + return nil + } + } // Assign max fees err = gas.AssignMaxFeeAndLimit(canWithdrawSdResponse.GasInfo, staderClient, c.Bool("yes")) From f006bcff375aa75b0bcfdfe340391b98d64a5f9c Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Thu, 4 Jan 2024 20:05:11 +0530 Subject: [PATCH 112/159] refactor display --- build-release.sh | 4 +-- shared/types/api/node.go | 1 + shared/version.go | 4 +-- stader-cli/node/claim-rewards.go | 9 +++--- stader-cli/node/status.go | 55 ++++++++------------------------ stader-lib/utils/eth/units.go | 19 +++++++++++ stader/api/node/claim-rewards.go | 2 ++ 7 files changed, 44 insertions(+), 50 deletions(-) diff --git a/build-release.sh b/build-release.sh index 8606a2ed2..048369316 100755 --- a/build-release.sh +++ b/build-release.sh @@ -27,8 +27,8 @@ # === Functions === # ================= -DOCKER_ACCOUNT=staderlabs -S3_BUCKET=stader-cli-permissionless/eth/releases/stader-node-build/permissionless +DOCKER_ACCOUNT=staderdev +S3_BUCKET=stader-cli-beta # Print a failure message to stderr and exit fail() { diff --git a/shared/types/api/node.go b/shared/types/api/node.go index 7477aeb78..0021356f3 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -410,6 +410,7 @@ type ClaimRewards struct { Error string `json:"error"` OperatorRewardsBalance *big.Int `json:"operatorRewardsBalance"` OperatorRewardAddress common.Address `json:"operatorRewardAddress"` + RewardsClaimed *big.Int `json:"rewardsClaimed"` TxHash common.Hash `json:"txHash"` } diff --git a/shared/version.go b/shared/version.go index 3e99892f2..2f4f82103 100644 --- a/shared/version.go +++ b/shared/version.go @@ -20,8 +20,8 @@ along with this program. If not, see . package shared const BinaryBucket string = "/stader-node-build/permissionless" -const DockerAccount string = "staderlabs" -const StaderVersion string = "1.4.4" +const DockerAccount string = "staderdev" +const StaderVersion string = "1.5.7-up-test" const Logo string = ` _____ _ _ _ _ 𝅺 diff --git a/stader-cli/node/claim-rewards.go b/stader-cli/node/claim-rewards.go index 3c243b2a7..95a1b240f 100644 --- a/stader-cli/node/claim-rewards.go +++ b/stader-cli/node/claim-rewards.go @@ -7,7 +7,6 @@ import ( "github.com/stader-labs/stader-node/shared/services/gas" "github.com/stader-labs/stader-node/shared/services/stader" cliutils "github.com/stader-labs/stader-node/shared/utils/cli" - "github.com/stader-labs/stader-node/shared/utils/math" "github.com/stader-labs/stader-node/stader-lib/utils/eth" "github.com/urfave/cli" ) @@ -50,9 +49,9 @@ func ClaimRewards(c *cli.Context) error { if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { totalFee := sdStatus.AccumulatedInterest - fmt.Printf("You need to first pay %f and close the utilization position to get back your funds. Execute the following command to repay your utilized SD stader-cli repay-sd --amount \n", eth.WeiToEth(totalFee)) + fmt.Printf("You need to first pay %s and close the utilization position to get back your funds. Execute the following command to repay your utilized SD stader-cli repay-sd --amount \n", eth.DisplayAmountInUnits(totalFee, "sd")) - fmt.Printf("Based on the current Health Factor, you can claim upto %.6f ETH.\n", eth.WeiToEth(canClaimRewardsResponse.WithdrawableInEth)) + fmt.Printf("Based on the current Health Factor, you can claim upto %s.\n", eth.DisplayAmountInUnits(canClaimRewardsResponse.WithdrawableInEth, "eth")) fmt.Printf("Note: Please repay your utilized SD by using the following command to claim the remaining ETH: stader-cli sd repay --amount .\n\n") } @@ -75,13 +74,13 @@ func ClaimRewards(c *cli.Context) error { if err != nil { return err } - fmt.Printf("Withdrawing %.6f ETH Rewards to Operator Reward Address: %s\n\n", math.RoundDown(eth.WeiToEth(res.OperatorRewardsBalance), 6), res.OperatorRewardAddress) + fmt.Printf("Withdrawing %s Rewards to Operator Reward Address: %s\n\n", eth.DisplayAmountInUnits(res.RewardsClaimed, "eth"), res.OperatorRewardAddress) cliutils.PrintTransactionHash(staderClient, res.TxHash) if _, err = staderClient.WaitForTransaction(res.TxHash); err != nil { return err } // Log & return - fmt.Printf("Successful withdrawal of %.6f ETH to Operator Reward Address: %s\n\n", math.RoundDown(eth.WeiToEth(res.OperatorRewardsBalance), 6), res.OperatorRewardAddress) + fmt.Printf("Successful withdrawal of %s to Operator Reward Address: %s\n\n", eth.DisplayAmountInUnits(res.RewardsClaimed, "eth"), res.OperatorRewardAddress) return nil } diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index a713f1a9e..904a9f94e 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -115,18 +115,11 @@ func getNodeStatus(c *cli.Context) error { } if status.OperatorRewardCollectorBalance.Cmp(big.NewInt(0)) > 0 { - val, denom := eth.WeiToEthWithValCheck(status.OperatorRewardCollectorBalance) - if denom == "eth" { - fmt.Printf( - "The Operator has aggregated total claims of %.6f ETH in the claim vault\n", - math.RoundDown(val, 6)) - fmt.Printf("To transfer the claims to your operator reward address use the %sstader-cli node claim-rewards%s command\n\n", log.ColorGreen, log.ColorReset) - } else { - fmt.Printf( - "The Operator has aggregated total claims of %.6f gwei in the claim vault\n", - math.RoundDown(val, 6)) - fmt.Printf("To transfer the claims to your operator reward address use the %sstader-cli node claim-rewards%s command\n\n", log.ColorGreen, log.ColorReset) - } + fmt.Printf( + "The Operator has aggregated total claims of %s in the claim vault\n", + eth.DisplayAmountInUnits(status.OperatorRewardCollectorBalance, "eth")) + fmt.Printf("To transfer the claims to your operator reward address use the %sstader-cli node claim-rewards%s command\n\n", log.ColorGreen, log.ColorReset) + } fmt.Printf( @@ -182,42 +175,22 @@ func getNodeStatus(c *cli.Context) error { math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizedBalance), eth.Decimal)) if totalRegisteredValidators.Cmp(big.NewInt(0)) != 0 { - val, denom := eth.WeiToEthWithValCheck(sdStatus.SdCollateralRequireAmount) - if denom == "eth" { - fmt.Printf( - "Note: For the %d validator, the minimum SD collateral should be %.6f SD (%s) to be eligible for the SD rewards. Please ensure that the SD collateral percentage is greater than %s. The SD collateral snapshots are taken daily at a random block, and if the SD collateral value falls below the %s limit, the node operator will not earn SD rewards for that day.\n\n", - totalRegisteredValidators, - math.RoundDown(val, eth.Decimal), - "10%", "10%", "10%") - } else { - fmt.Printf( - "Note: For the %d validator, the minimum (gwei) SD collateral should be %.6f SD (%s) to be eligible for the SD rewards. Please ensure that the SD collateral percentage is greater than %s. The SD collateral snapshots are taken daily at a random block, and if the SD collateral value falls below the %s limit, the node operator will not earn SD rewards for that day.\n\n", - totalRegisteredValidators, - math.RoundDown(val, eth.Decimal), - "10%", "10%", "10%") - } + fmt.Printf( + "Note: For the %d validator, the minimum SD collateral should be %s (%s) to be eligible for the SD rewards. Please ensure that the SD collateral percentage is greater than %s. The SD collateral snapshots are taken daily at a random block, and if the SD collateral value falls below the %s limit, the node operator will not earn SD rewards for that day.\n\n", + totalRegisteredValidators, + eth.DisplayAmountInUnits(sdStatus.SdCollateralRequireAmount, "sd"), + "10%", "10%", "10%") + } else { fmt.Println("") } fmt.Printf("%s=== SD utilization Details ===%s\n", log.ColorGreen, log.ColorReset) - val, denom := eth.WeiToEthWithValCheck(sdStatus.SdUtilizedBalance) - if denom == "eth" { - fmt.Printf("The Operator has utilized %.6f SD from the Utility Pool.\n\n", - math.RoundDown(val, eth.Decimal)) - } else { - fmt.Printf("The Operator has utilized %.6f gwei SD from the Utility Pool.\n\n", math.RoundDown(val, eth.Decimal)) - } + fmt.Printf("The Operator has utilized %s from the Utility Pool.\n\n", eth.DisplayAmountInUnits(sdStatus.SdUtilizedBalance, "eth")) - val, denom = eth.WeiToEthWithValCheck(sdStatus.SdUtilizedBalance) - if denom == "eth" { - fmt.Printf("The Operator has a current Utilization Position of %.6f SD. (including the utilization fee)\n Note: For repayment of your utilized SD, please use the `stader-cli node repay-sd ` command.\n\n", - math.RoundDown(val, eth.Decimal)) - } else { - fmt.Printf("The Operator has a current Utilization Position of %.6f gwei SD. (including the utilization fee)\n Note: For repayment of your utilized SD, please use the `stader-cli node repay-sd ` command.\n\n", - math.RoundDown(val, eth.Decimal)) - } + fmt.Printf("The Operator has a current Utilization Position of %s. (including the utilization fee)\n Note: For repayment of your utilized SD, please use the `stader-cli node repay-sd ` command.\n\n", + eth.DisplayAmountInUnits(sdStatus.SdUtilizerLatestBalance, "sd")) maxUtilizable := new(big.Int).Sub(sdStatus.SdMaxUtilizableAmount, sdStatus.SdUtilizerLatestBalance) if maxUtilizable.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { diff --git a/stader-lib/utils/eth/units.go b/stader-lib/utils/eth/units.go index 2593051a0..bfaf8b2c0 100644 --- a/stader-lib/utils/eth/units.go +++ b/stader-lib/utils/eth/units.go @@ -43,6 +43,25 @@ func WeiToEthWithValCheck(wei *big.Int) (float64, string) { return WeiToEth(wei), "eth" } +func DisplayAmountInUnits(wei *big.Int, denom string) string { + gweiDenom := " gwei" + if denom == "SD" { + gweiDenom = " gwei SD" + } + regDenom := " ETH" + if denom == "SD" { + regDenom = " SD" + } + + if wei == nil { + return "" + } + if wei.Cmp(big.NewInt(Threshold)) < 0 { + return strconv.FormatFloat(WeiToGwei(wei), 'f', -1, 64) + gweiDenom + } + return strconv.FormatFloat(WeiToEth(wei), 'f', -1, 64) + regDenom +} + // Convert wei to eth func WeiToEth(wei *big.Int) float64 { var weiFloat big.Float diff --git a/stader/api/node/claim-rewards.go b/stader/api/node/claim-rewards.go index c43f1ccfb..bccea548a 100644 --- a/stader/api/node/claim-rewards.go +++ b/stader/api/node/claim-rewards.go @@ -141,6 +141,7 @@ func ClaimRewards(c *cli.Context) (*api.ClaimRewards, error) { if err != nil { return nil, err } + response.RewardsClaimed = operatorRewardsBalance } else { totalWithdrawableEth := operatorRewardsBalance if operatorRewardsBalance.Cmp(withdrawableInEth) > 0 { @@ -150,6 +151,7 @@ func ClaimRewards(c *cli.Context) (*api.ClaimRewards, error) { if err != nil { return nil, err } + response.RewardsClaimed = totalWithdrawableEth } response.TxHash = tx.Hash() From edfaa0fd3c6463b83b31e3a1fa9337dfbfc35018 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Thu, 4 Jan 2024 20:18:02 +0530 Subject: [PATCH 113/159] update precision --- stader-lib/utils/eth/units.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stader-lib/utils/eth/units.go b/stader-lib/utils/eth/units.go index bfaf8b2c0..08a40f7df 100644 --- a/stader-lib/utils/eth/units.go +++ b/stader-lib/utils/eth/units.go @@ -57,9 +57,9 @@ func DisplayAmountInUnits(wei *big.Int, denom string) string { return "" } if wei.Cmp(big.NewInt(Threshold)) < 0 { - return strconv.FormatFloat(WeiToGwei(wei), 'f', -1, 64) + gweiDenom + return strconv.FormatFloat(WeiToGwei(wei), 'f', 2, 64) + gweiDenom } - return strconv.FormatFloat(WeiToEth(wei), 'f', -1, 64) + regDenom + return strconv.FormatFloat(WeiToEth(wei), 'f', 2, 64) + regDenom } // Convert wei to eth From ee3623b4f2fca25338c4aa3d60cde06cbb8cbdaa Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Thu, 4 Jan 2024 20:28:16 +0530 Subject: [PATCH 114/159] revert build info --- build-release.sh | 4 ++-- shared/version.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build-release.sh b/build-release.sh index 048369316..8606a2ed2 100755 --- a/build-release.sh +++ b/build-release.sh @@ -27,8 +27,8 @@ # === Functions === # ================= -DOCKER_ACCOUNT=staderdev -S3_BUCKET=stader-cli-beta +DOCKER_ACCOUNT=staderlabs +S3_BUCKET=stader-cli-permissionless/eth/releases/stader-node-build/permissionless # Print a failure message to stderr and exit fail() { diff --git a/shared/version.go b/shared/version.go index 2f4f82103..3e99892f2 100644 --- a/shared/version.go +++ b/shared/version.go @@ -20,8 +20,8 @@ along with this program. If not, see . package shared const BinaryBucket string = "/stader-node-build/permissionless" -const DockerAccount string = "staderdev" -const StaderVersion string = "1.5.7-up-test" +const DockerAccount string = "staderlabs" +const StaderVersion string = "1.4.4" const Logo string = ` _____ _ _ _ _ 𝅺 From 94641d73200c00f893638dccd8809ebe7eb71d2d Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Thu, 4 Jan 2024 21:13:17 +0530 Subject: [PATCH 115/159] refactor --- stader-cli/node/claim-rewards.go | 7 ++++++- stader-cli/node/utilize-sd.go | 5 ++--- stader-cli/validator/deposit.go | 4 ++-- stader-cli/validator/send-cl-rewards.go | 6 +++--- stader-cli/validator/status.go | 5 +++-- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/stader-cli/node/claim-rewards.go b/stader-cli/node/claim-rewards.go index 95a1b240f..53312b9c9 100644 --- a/stader-cli/node/claim-rewards.go +++ b/stader-cli/node/claim-rewards.go @@ -53,7 +53,12 @@ func ClaimRewards(c *cli.Context) error { fmt.Printf("Based on the current Health Factor, you can claim upto %s.\n", eth.DisplayAmountInUnits(canClaimRewardsResponse.WithdrawableInEth, "eth")) - fmt.Printf("Note: Please repay your utilized SD by using the following command to claim the remaining ETH: stader-cli sd repay --amount .\n\n") + fmt.Printf("Note: Please repay your utilized SD by using the following command to claim the remaining ETH: stader-cli sd repay --amount .\n") + + if !cliutils.Confirm("Are you sure you want to proceed?\n\n") { + fmt.Println("Cancelled.") + return nil + } } } diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index 92add83d2..a4a5c93dd 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -9,7 +9,6 @@ import ( "github.com/stader-labs/stader-node/shared/services/stader" "github.com/stader-labs/stader-node/shared/types/api" cliutils "github.com/stader-labs/stader-node/shared/utils/cli" - "github.com/stader-labs/stader-node/shared/utils/math" "github.com/stader-labs/stader-node/stader-lib/utils/eth" "github.com/stader-labs/stader-node/stader-lib/utils/sd" "github.com/urfave/cli" @@ -61,7 +60,7 @@ func utilizeSD(c *cli.Context) error { // Prompt for confirmation if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( - "Are you sure you want to use %f SD from the utility pool? (y/n). Note: A Utilization fee of %.6f APR will be applied to the utilized SD from the utility pool.\n", eth.WeiToEth(amountWei), 0.5))) { + "Are you sure you want to use %s from the utility pool? (y/n). Note: A Utilization fee of %.6f APR will be applied to the utilized SD from the utility pool.\n", eth.DisplayAmountInUnits(amountWei, "sd"), 0.5))) { fmt.Println("Cancelled.") return nil } @@ -78,7 +77,7 @@ func utilizeSD(c *cli.Context) error { } // Log & return - fmt.Printf("Successfully deposited %.6f SD by utilizing SD from the Utility Pool.\n", math.RoundDown(eth.WeiToEth(amountWei), 6)) + fmt.Printf("Successfully deposited %s to the collateral contract by utilizing SD from the Utility Pool.\n", eth.DisplayAmountInUnits(amountWei, "sd")) return nil } diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 61ce9a132..8acc8646c 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -97,7 +97,7 @@ func nodeDeposit(c *cli.Context) error { return err } - if !cliutils.Confirm(fmt.Sprintf("Are you sure you want to use %f SD from the Utility Pool? [Y/N] \nNote: A Utilization Fee of %s%s APR will be applied to the utilized SD from the Utility Pool. ", eth.WeiToEth(utilityAmount), sdStatus.UtilizationRate.String(), "%")) { + if !cliutils.Confirm(fmt.Sprintf("Are you sure you want to use %s from the Utility Pool? [Y/N] \nNote: A Utilization Fee of %s%s APR will be applied to the utilized SD from the Utility Pool. ", eth.DisplayAmountInUnits(utilityAmount, "sd"), sdStatus.UtilizationRate.String(), "%")) { fmt.Printf("Cancelled\n") return nil } @@ -112,7 +112,7 @@ func nodeDeposit(c *cli.Context) error { return nil } - if !cliutils.Confirm(fmt.Sprintf("Are you sure you want to deposit %f SD as collateral?", eth.WeiToEth(selfBondAmount))) { + if !cliutils.Confirm(fmt.Sprintf("Are you sure you want to deposit %s as collateral?", eth.DisplayAmountInUnits(selfBondAmount, "sd"))) { fmt.Printf("Cancelled\n") return nil } diff --git a/stader-cli/validator/send-cl-rewards.go b/stader-cli/validator/send-cl-rewards.go index 607ad9397..fb61bef2e 100644 --- a/stader-cli/validator/send-cl-rewards.go +++ b/stader-cli/validator/send-cl-rewards.go @@ -2,11 +2,11 @@ package validator import ( "fmt" + "github.com/stader-labs/stader-node/shared/services/gas" "github.com/stader-labs/stader-node/shared/services/stader" cliutils "github.com/stader-labs/stader-node/shared/utils/cli" - "github.com/stader-labs/stader-node/shared/utils/math" "github.com/stader-labs/stader-node/stader-lib/types" "github.com/stader-labs/stader-node/stader-lib/utils/eth" "github.com/urfave/cli" @@ -68,14 +68,14 @@ func SendClRewards(c *cli.Context, validatorPubKey types.ValidatorPubkey) error return err } - fmt.Printf("Sending %.6f CL Rewards to Claim vault\n\n", math.RoundDown(eth.WeiToEth(res.ClRewardsAmount), 6)) + fmt.Printf("Sending %s CL Rewards to Claim vault\n\n", eth.DisplayAmountInUnits(res.ClRewardsAmount, "eth")) cliutils.PrintTransactionHash(staderClient, res.TxHash) if _, err = staderClient.WaitForTransaction(res.TxHash); err != nil { return err } // Log & return - fmt.Printf("Sent %.6f CL Rewards to Claim vault\n\n", math.RoundDown(eth.WeiToEth(res.ClRewardsAmount), 6)) + fmt.Printf("Sent %s CL Rewards to Claim vault\n\n", eth.DisplayAmountInUnits(res.ClRewardsAmount, "eth")) return nil } diff --git a/stader-cli/validator/status.go b/stader-cli/validator/status.go index e93b9ed92..bb39fc9d8 100644 --- a/stader-cli/validator/status.go +++ b/stader-cli/validator/status.go @@ -2,6 +2,8 @@ package validator import ( "fmt" + "math/big" + "github.com/stader-labs/stader-node/shared/services/stader" cliutils "github.com/stader-labs/stader-node/shared/utils/cli" "github.com/stader-labs/stader-node/shared/utils/log" @@ -9,7 +11,6 @@ import ( "github.com/stader-labs/stader-node/stader-lib/types" "github.com/stader-labs/stader-node/stader-lib/utils/eth" "github.com/urfave/cli" - "math/big" ) func getValidatorStatus(c *cli.Context) error { @@ -72,7 +73,7 @@ func getValidatorStatus(c *cli.Context) error { fmt.Printf("-Validator Status: %s\n", validatorInfo.StatusToDisplay) if validatorInfo.WithdrawVaultRewardBalance.Int64() > 0 && !validatorInfo.CrossedRewardsThreshold { fmt.Printf("\n") - fmt.Printf("-Validator Consensus Layer Rewards: %.6f\n\n", math.RoundDown(eth.WeiToEth(validatorInfo.WithdrawVaultRewardBalance), 18)) + fmt.Printf("-Validator Consensus Layer Rewards: %s\n\n", eth.DisplayAmountInUnits(validatorInfo.WithdrawVaultRewardBalance, "eth")) } else if validatorInfo.CrossedRewardsThreshold { fmt.Println("If you have exited the validator, Please wait for Stader Oracles to settle your funds!") fmt.Println("If you have not exited the validator. Please reach out Stader Developers in discord for more information") From b3a835d789e6d502ae5fddac1072099d1336132d Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Thu, 4 Jan 2024 21:20:36 +0530 Subject: [PATCH 116/159] refactor repay-sd --- stader-cli/node/repay-sd.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index ed8f40fcb..1393585c8 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -67,7 +67,7 @@ func repaySD(c *cli.Context) error { // 1. Check if repay more than need if amountWei.Cmp(sdStatus.SdUtilizerLatestBalance) > 0 { - fmt.Printf("Repayment amount greater than the Utilization position. Your current Utilization Position is %0.6f \n", eth.WeiToEth(sdStatus.SdUtilizerLatestBalance)) + fmt.Printf("Repayment amount greater than the Utilization position. Your current Utilization Position is %s \n", eth.DisplayAmountInUnits(sdStatus.SdUtilizerLatestBalance, "sd")) return nil } @@ -84,7 +84,7 @@ func repaySD(c *cli.Context) error { } if allowance.Allowance.Cmp(amountWei) < 0 { - fmt.Printf("Before repaying the SD, you must first give the utility contract approval to interact with your SD. Amount to approve: %.6f\n", eth.WeiToEth(amountWei)) + fmt.Printf("Before repaying the SD, you must first give the utility contract approval to interact with your SD. Amount to approve: %s\n", eth.DisplayAmountInUnits(amountWei, "sd")) err = nodeApproveUtilitySd(c, amountInString) if err != nil { @@ -104,7 +104,7 @@ func repaySD(c *cli.Context) error { // Prompt for confirmation if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( - "Are you sure you want to repay %0.6f SD from your Operator Address and reduce or close your Utilization Position?", eth.WeiToEth(amountWei)))) { + "Are you sure you want to repay %s from your Operator Address and reduce or close your Utilization Position?", eth.DisplayAmountInUnits(amountWei, "sd")))) { fmt.Println("Cancelled.") return nil } @@ -121,7 +121,7 @@ func repaySD(c *cli.Context) error { } remainUtilize := new(big.Int).Sub(sdStatus.SdUtilizerLatestBalance, amountWei) - fmt.Printf("Repayment of %.6f SD successful. Current Utilization Position: %.6f SD.\n", eth.WeiToEth(amountWei), eth.WeiToEth(remainUtilize)) + fmt.Printf("Repayment of %s successful. Current Utilization Position: %s.\n", eth.DisplayAmountInUnits(amountWei, "sd"), eth.DisplayAmountInUnits(remainUtilize, "sd")) return nil } From 59ecb254425d2c32bbc13ed71f9e99f30003349f Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Thu, 4 Jan 2024 21:38:09 +0530 Subject: [PATCH 117/159] refactor withdraw-sd --- stader-cli/node/withdraw-sd.go | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index d408cdf3d..6f1a97a2c 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -8,7 +8,6 @@ import ( "github.com/stader-labs/stader-node/shared/services/gas" "github.com/stader-labs/stader-node/shared/services/stader" cliutils "github.com/stader-labs/stader-node/shared/utils/cli" - "github.com/stader-labs/stader-node/shared/utils/math" "github.com/stader-labs/stader-node/stader-lib/utils/eth" "github.com/urfave/cli" ) @@ -54,14 +53,7 @@ func WithdrawSd(c *cli.Context) error { hasUtilizePosition := sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) != 0 if hasUtilizePosition { - val, denom := eth.WeiToEthWithValCheck(sdStatusResponse.SDStatus.SdUtilizerLatestBalance) - confirm := false - if denom == "gwei" { - confirm = cliutils.Confirm(fmt.Sprintf("You have an existing Utilization Position of %.6f gwei SD. The excess SD collateral you are trying to withdraw will be used to repay the utilized SD.\n Do you wish to proceed?", math.RoundDown(val, 6))) - } else { - confirm = cliutils.Confirm(fmt.Sprintf("You have an existing Utilization Position of %.6f SD. The excess SD collateral you are trying to withdraw will be used to repay the utilized SD.\n Do you wish to proceed?", math.RoundDown(val, 6))) - } - if !confirm { + if !cliutils.Confirm(fmt.Sprintf("You have an existing Utilization Position of %s. The excess SD collateral you are trying to withdraw will be used to repay the utilized SD.\n Do you wish to proceed?", eth.DisplayAmountInUnits(sdStatusResponse.SDStatus.SdUtilizerLatestBalance, "sd"))) { fmt.Println("Cancelled.") return nil } @@ -75,7 +67,7 @@ func WithdrawSd(c *cli.Context) error { // Prompt for confirmation if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( - "Are you sure you want to withdraw %.6f SD from the collateral contract?", math.RoundDown(eth.WeiToEth(amountWei), 6)))) { + "Are you sure you want to withdraw %s from the collateral contract?", eth.DisplayAmountInUnits(amountWei, "sd")))) { fmt.Println("Cancelled.") return nil } @@ -85,7 +77,7 @@ func WithdrawSd(c *cli.Context) error { return err } - fmt.Printf("Withdrawing %s SD from the collateral contract.\n", amountInString) + fmt.Printf("Withdrawing %s from the collateral contract.\n", eth.DisplayAmountInUnits(amountWei, "sd")) cliutils.PrintTransactionHash(staderClient, res.TxHash) if _, err = staderClient.WaitForTransaction(res.TxHash); err != nil { return err @@ -101,18 +93,18 @@ func WithdrawSd(c *cli.Context) error { // withdraw request amount lesser than the Utilization Position if !hasUtilizePosition { - fmt.Printf("Successfully withdrawn %.6f SD Collateral. \n", math.RoundDown(eth.WeiToEth(amountWei), 6)) + fmt.Printf("Successfully withdrawn %s Collateral. \n", eth.DisplayAmountInUnits(amountWei, "sd")) return nil } if remainUtilize.Cmp(big.NewInt(0)) > 0 { - fmt.Printf("Successfully withdrawn %.6f SD Collateral. \n", math.RoundDown(eth.WeiToEth(amountWei), 6)) - fmt.Printf("Current Utilization Position: %.6f SD \nCurrent SD collateral: %.6f SD\n", math.RoundDown(eth.WeiToEth(remainUtilize), 6), math.RoundDown(eth.WeiToEth(remainCollateral), 6)) + fmt.Printf("Successfully withdrawn %s Collateral. \n", eth.DisplayAmountInUnits(amountWei, "sd")) + fmt.Printf("Current Utilization Position: %s\nCurrent SD collateral: %s\n", eth.DisplayAmountInUnits(remainUtilize, "sd"), eth.DisplayAmountInUnits(remainCollateral, "sd")) } else { // withdraw request amount greater than the Utilization Position - fmt.Printf("Repayment of %.6f SD successful using the excess SD Collateral.\n", math.RoundDown(eth.WeiToEth(amountWei), 6)) - fmt.Printf("The remaining %.6f SD has been sent to your Operator Reward Address\n", math.RoundDown(eth.WeiToEth(new(big.Int).Abs(remainUtilize)), 6)) + fmt.Printf("Repayment of %s successful using the excess SD Collateral.\n", eth.DisplayAmountInUnits(amountWei, "sd")) + fmt.Printf("The remaining %s has been sent to your Operator Reward Address\n", eth.DisplayAmountInUnits(new(big.Int).Abs(remainUtilize), "sd")) } return nil From 9e562c2a01cd9b5aba45bcb54476301cf96e67fa Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Fri, 5 Jan 2024 15:21:06 +0530 Subject: [PATCH 118/159] refactor remaining places --- stader-cli/node/claim-sp-rewards.go | 12 ++++----- stader-cli/node/deposit-sd.go | 7 +++--- stader-cli/node/send-el-rewards.go | 5 ++-- stader-cli/node/send.go | 2 +- stader-cli/node/status.go | 38 ++++++++++++++--------------- 5 files changed, 30 insertions(+), 34 deletions(-) diff --git a/stader-cli/node/claim-sp-rewards.go b/stader-cli/node/claim-sp-rewards.go index edf0c61b9..71ee4a401 100644 --- a/stader-cli/node/claim-sp-rewards.go +++ b/stader-cli/node/claim-sp-rewards.go @@ -158,7 +158,7 @@ func ClaimSpRewards(c *cli.Context) error { depositSd := false if totalClaimableSd.Cmp(big.NewInt(0)) > 0 { - fmt.Printf("You will claim %f SD and %f ETH with the following selection - cycles %v\n\n", eth.WeiToEth(totalClaimableSd), eth.WeiToEth(totalClaimableEth), cyclesToClaimArray) + fmt.Printf("You will claim %s and %s with the following selection - cycles %v\n\n", eth.DisplayAmountInUnits(totalClaimableSd, "sd"), eth.DisplayAmountInUnits(totalClaimableEth, "eth"), cyclesToClaimArray) fmt.Printf("Your ETH rewards will be sent to your Reward Address\n") fmt.Printf("For SD rewards, you can claim all the rewards to your Reward Address or redeposit them as SD collateral to earn more rewards\n") @@ -169,13 +169,13 @@ func ClaimSpRewards(c *cli.Context) error { option := cliutils.Prompt("", "^(1|2)$", "Please enter a valid option") if option == "1" { if !cliutils.Confirm(fmt.Sprintf( - "Are you sure you want to claim %f ETH and %f SD for cycles %v to your reward address?", eth.WeiToEth(totalClaimableEth), eth.WeiToEth(totalClaimableSd), cyclesToClaimArray)) { + "Are you sure you want to claim %s and %s for cycles %v to your reward address?", eth.DisplayAmountInUnits(totalClaimableEth, "eth"), eth.DisplayAmountInUnits(totalClaimableSd, "sd"), cyclesToClaimArray)) { fmt.Println("Claim Cancelled.") return nil } } else if option == "2" { if !cliutils.Confirm(fmt.Sprintf( - "Your %f ETH rewards will be sent to your Reward Address.\nFor your %f SD rewards, are you sure you want to re-deposit it as SD collateral for additional earnings?", eth.WeiToEth(totalClaimableEth), eth.WeiToEth(totalClaimableSd))) { + "Your %s rewards will be sent to your Reward Address.\nFor your %s rewards, are you sure you want to re-deposit it as SD collateral for additional earnings?", eth.DisplayAmountInUnits(totalClaimableEth, "eth"), eth.DisplayAmountInUnits(totalClaimableSd, "sd"))) { fmt.Println("Claim Cancelled.") return nil } @@ -216,12 +216,12 @@ func ClaimSpRewards(c *cli.Context) error { fmt.Printf("Transaction Successful\n") if depositSd { - fmt.Printf("%f ETH rewards have been sent to your Reward Address and %f SD rewards have been re-deposited as SD collateral\n", eth.WeiToEth(totalClaimableEth), eth.WeiToEth(totalClaimableSd)) + fmt.Printf("%s rewards have been sent to your Reward Address and %s rewards have been re-deposited as SD collateral\n", eth.DisplayAmountInUnits(totalClaimableEth, "eth"), eth.DisplayAmountInUnits(totalClaimableSd, "sd")) } else { if totalClaimableSd.Cmp(big.NewInt(0)) <= 0 { - fmt.Printf("%f ETH rewards have been sent to your Reward Address\n", eth.WeiToEth(totalClaimableEth)) + fmt.Printf("%s rewards have been sent to your Reward Address\n", eth.DisplayAmountInUnits(totalClaimableEth, "eth")) } else { - fmt.Printf("%f SD rewards and %f ETH rewards have been sent to your Reward Address\n", eth.WeiToEth(totalClaimableSd), eth.WeiToEth(totalClaimableEth)) + fmt.Printf("%s rewards and %s rewards have been sent to your Reward Address\n", eth.DisplayAmountInUnits(totalClaimableSd, "sd"), eth.DisplayAmountInUnits(totalClaimableEth, "eth")) } } diff --git a/stader-cli/node/deposit-sd.go b/stader-cli/node/deposit-sd.go index c1fd4f787..d985ffec0 100644 --- a/stader-cli/node/deposit-sd.go +++ b/stader-cli/node/deposit-sd.go @@ -11,7 +11,6 @@ import ( "github.com/stader-labs/stader-node/shared/services/gas" "github.com/stader-labs/stader-node/shared/services/stader" cliutils "github.com/stader-labs/stader-node/shared/utils/cli" - "github.com/stader-labs/stader-node/shared/utils/math" ) func nodeDepositSd(c *cli.Context) error { @@ -61,7 +60,7 @@ func DepositSdWithAmount(staderClient *stader.Client, amountWei *big.Int, autoCo } if allowance.Allowance.Cmp(amountWei) < 0 { - fmt.Println("Before depositing SD, you must first give the collateral contract approval to interact with your SD. Amount to approve: ", eth.WeiToEth(amountWei)) + fmt.Println("Before depositing SD, you must first give the collateral contract approval to interact with your SD. Amount to approve: ", eth.DisplayAmountInUnits(amountWei, "sd")) err = nodeApproveSdWithAmountAndAddress(staderClient, amountWei, contracts.SdCollateralContract, autoConfirm, nonce) if err != nil { return err @@ -90,7 +89,7 @@ func DepositSdWithAmount(staderClient *stader.Client, amountWei *big.Int, autoCo } // Prompt for confirmation - if !(autoConfirm || cliutils.Confirm(fmt.Sprintf("Are you sure you want to deposit %f SD as collateral?", math.RoundDown(eth.WeiToEth(amountWei), 6)))) { + if !(autoConfirm || cliutils.Confirm(fmt.Sprintf("Are you sure you want to deposit %s as collateral?", eth.DisplayAmountInUnits(amountWei, "sd")))) { fmt.Println("Cancelled.") return nil } @@ -108,7 +107,7 @@ func DepositSdWithAmount(staderClient *stader.Client, amountWei *big.Int, autoCo } // Log & return - fmt.Printf("Successfully deposited %.6f SD.\n", math.RoundDown(eth.WeiToEth(amountWei), 6)) + fmt.Printf("Successfully deposited %s.\n", eth.DisplayAmountInUnits(amountWei, "sd")) return nil } diff --git a/stader-cli/node/send-el-rewards.go b/stader-cli/node/send-el-rewards.go index fe3cebe76..ef83edbef 100644 --- a/stader-cli/node/send-el-rewards.go +++ b/stader-cli/node/send-el-rewards.go @@ -6,7 +6,6 @@ import ( "github.com/stader-labs/stader-node/shared/services/gas" "github.com/stader-labs/stader-node/shared/services/stader" cliutils "github.com/stader-labs/stader-node/shared/utils/cli" - "github.com/stader-labs/stader-node/shared/utils/math" "github.com/stader-labs/stader-node/stader-lib/utils/eth" "github.com/urfave/cli" ) @@ -53,13 +52,13 @@ func SendElRewards(c *cli.Context) error { if err != nil { return err } - fmt.Printf("Sending %.6f EL Rewards to Claim Vault\n\n", math.RoundDown(eth.WeiToEth(res.ElRewardsAmount), 6)) + fmt.Printf("Sending %s EL Rewards to Claim Vault\n\n", eth.DisplayAmountInUnits(res.ElRewardsAmount, "eth")) cliutils.PrintTransactionHash(staderClient, res.TxHash) if _, err = staderClient.WaitForTransaction(res.TxHash); err != nil { return err } // Log & return - fmt.Printf("Sent %.6f EL Rewards to Claim Vault\n\n", math.RoundDown(eth.WeiToEth(res.ElRewardsAmount), 6)) + fmt.Printf("Sent %s EL Rewards to Claim Vault\n\n", eth.DisplayAmountInUnits(res.ElRewardsAmount, "eth")) return nil } diff --git a/stader-cli/node/send.go b/stader-cli/node/send.go index 3763bd492..24ad6753e 100644 --- a/stader-cli/node/send.go +++ b/stader-cli/node/send.go @@ -78,7 +78,7 @@ func nodeSend(c *cli.Context, amount float64, token string, toAddressOrENS strin } // Prompt for confirmation - if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf("Are you sure you want to send %.6f %s to %s? This action cannot be undone!", math.RoundDown(eth.WeiToEth(amountWei), 6), token, toAddressString))) { + if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf("Are you sure you want to send %.6f %s to %s? This action cannot be undone!", eth.WeiToEth(amountWei), token, toAddressString))) { fmt.Println("Cancelled.") return nil } diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 904a9f94e..48249e202 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -7,7 +7,6 @@ import ( "github.com/stader-labs/stader-node/shared/services/stader" cliutils "github.com/stader-labs/stader-node/shared/utils/cli" "github.com/stader-labs/stader-node/shared/utils/log" - "github.com/stader-labs/stader-node/shared/utils/math" "github.com/stader-labs/stader-node/stader-lib/utils/eth" "github.com/urfave/cli" ) @@ -97,18 +96,18 @@ func getNodeStatus(c *cli.Context) error { } if totalUnclaimedSocializingPoolSd.Cmp(big.NewInt(0)) > 0 { - fmt.Printf("The Operator has %.6f SD as unclaimed SD rewards. To claim SD rewards using the %sstader-cli node claim-sp-rewards%s command\n\n", math.RoundDown(eth.WeiToEth(totalUnclaimedSocializingPoolSd), 18), log.ColorGreen, log.ColorReset) + fmt.Printf("The Operator has %s as unclaimed SD rewards. To claim SD rewards using the %sstader-cli node claim-sp-rewards%s command\n\n", eth.DisplayAmountInUnits(totalUnclaimedSocializingPoolSd, "sd"), log.ColorGreen, log.ColorReset) } if totalUnclaimedSocializingPoolEth.Cmp(big.NewInt(0)) > 0 { - fmt.Printf("The Operator has %.6f ETH as unclaimed Socializing Pool EL rewards. To claim Socialized EL rewards using the %sstader-cli node claim-sp-rewards%s command\n\n", math.RoundDown(eth.WeiToEth(totalUnclaimedSocializingPoolEth), 18), log.ColorGreen, log.ColorReset) + fmt.Printf("The Operator has %s as unclaimed Socializing Pool EL rewards. To claim Socialized EL rewards using the %sstader-cli node claim-sp-rewards%s command\n\n", eth.DisplayAmountInUnits(totalUnclaimedSocializingPoolEth, "eth"), log.ColorGreen, log.ColorReset) } if status.OperatorELRewardsAddressBalance.Cmp(big.NewInt(0)) > 0 { fmt.Printf( - "The Operator has a total of %.6f ETH as EL rewards for all validators.\n"+ + "The Operator has a total of %s as EL rewards for all validators.\n"+ "These rewards are sent to the claim vault periodically by Stader.\n"+ - "Once it is sent to the claim vault, the operator can use the %sstader-cli node claim-rewards%s command to claim EL rewards to their operator reward address\n", math.RoundDown(eth.WeiToEth(status.OperatorELRewardsAddressBalance), 6), log.ColorGreen, log.ColorReset) + "Once it is sent to the claim vault, the operator can use the %sstader-cli node claim-rewards%s command to claim EL rewards to their operator reward address\n", eth.DisplayAmountInUnits(status.OperatorELRewardsAddressBalance, "eth"), log.ColorGreen, log.ColorReset) fmt.Println("If the operator wishes to claim EL rewards by themselves, follow these steps:") fmt.Printf("1. Use the %sstader-cli node send-el-rewards%s command to claim the EL rewards\n", log.ColorGreen, log.ColorReset) fmt.Printf("2. Use the %sstader-cli node claim-rewards%s command to claim the EL rewards from the claim vault to your operator reward address\n\n", log.ColorGreen, log.ColorReset) @@ -119,7 +118,6 @@ func getNodeStatus(c *cli.Context) error { "The Operator has aggregated total claims of %s in the claim vault\n", eth.DisplayAmountInUnits(status.OperatorRewardCollectorBalance, "eth")) fmt.Printf("To transfer the claims to your operator reward address use the %sstader-cli node claim-rewards%s command\n\n", log.ColorGreen, log.ColorReset) - } fmt.Printf( @@ -130,17 +128,17 @@ func getNodeStatus(c *cli.Context) error { fmt.Printf("%s=== Account and Balances ===%s\n", log.ColorGreen, log.ColorReset) fmt.Printf( - "The Operator %s%s%s has a balance of %.6f ETH.\n\n", + "The Operator %s%s%s has a balance of %s.\n\n", log.ColorBlue, status.AccountAddress, log.ColorReset, - math.RoundDown(eth.WeiToEth(status.AccountBalances.ETH), 6)) + eth.DisplayAmountInUnits(status.AccountBalances.ETH, "eth")) fmt.Printf( - "The Operator %s%s%s has a balance of %.6f SD.\n\n", + "The Operator %s%s%s has a balance of %s.\n\n", log.ColorBlue, status.AccountAddress, log.ColorReset, - math.RoundDown(eth.WeiToEth(status.AccountBalances.Sd), 18)) + eth.DisplayAmountInUnits(status.AccountBalances.Sd, "sd")) fmt.Printf( "The Operator has a deposited %d ETH as collateral.\n\n", @@ -163,16 +161,16 @@ func getNodeStatus(c *cli.Context) error { } fmt.Printf( - "The Operator has a deposited %.6f SD (%.6f%s) as collateral. Below is the break-up: \n", - math.RoundDown(eth.WeiToEth(totalCollateral), 18), collateralPct, "%") + "The Operator has a deposited %s (%.6f%s) as collateral. Below is the break-up: \n", + eth.DisplayAmountInUnits(totalCollateral, "sd"), collateralPct, "%") fmt.Printf( - "Self-bonded: %.6f SD \n", - math.RoundDown(eth.WeiToEth(sdStatus.SdCollateralCurrentAmount), eth.Decimal)) + "Self-bonded: %s \n", + eth.DisplayAmountInUnits(sdStatus.SdCollateralCurrentAmount, "sd")) fmt.Printf( - "Utilized from the Utility Pool: %.6f SD.\n", - math.RoundDown(eth.WeiToEth(sdStatus.SdUtilizedBalance), eth.Decimal)) + "Utilized from the Utility Pool: %s.\n", + eth.DisplayAmountInUnits(sdStatus.SdUtilizedBalance, "sd")) if totalRegisteredValidators.Cmp(big.NewInt(0)) != 0 { fmt.Printf( @@ -201,16 +199,16 @@ func getNodeStatus(c *cli.Context) error { } fmt.Printf( - "The Operator can utilize upto %.6f SD more.\nNote: The Operator can utilize a maximum of 1 ETH worth SD per validator.\n\n", - eth.WeiToEth(maxUtilizable)) + "The Operator can utilize upto %s SD more.\nNote: The Operator can utilize a maximum of 1 ETH worth SD per validator.\n\n", + eth.DisplayAmountInUnits(maxUtilizable, "sd")) fmt.Printf( "The Operator has a Health Factor of %s. \nNote: Please ensure your Health Factor is greater than 1 to avoid liquidations.\n\n", sdStatus.HealthFactor.String()) fmt.Printf( - "The Utility Pool currently has a balance of %.6f SD.\n\n", - math.RoundDown(eth.WeiToEth(sdStatus.PoolAvailableSDBalance), eth.Decimal)) + "The Utility Pool currently has a balance of %s.\n\n", + eth.DisplayAmountInUnits(sdStatus.PoolAvailableSDBalance, "sd")) return nil } From 4913520e47cdf8e9f39dc65109ba5cae1036ae28 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Fri, 5 Jan 2024 16:01:56 +0530 Subject: [PATCH 119/159] only display health factor if there is some utilized balance --- stader-cli/node/status.go | 12 +++++++----- stader-lib/utils/eth/units.go | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 48249e202..1f8bb544d 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -185,7 +185,7 @@ func getNodeStatus(c *cli.Context) error { fmt.Printf("%s=== SD utilization Details ===%s\n", log.ColorGreen, log.ColorReset) - fmt.Printf("The Operator has utilized %s from the Utility Pool.\n\n", eth.DisplayAmountInUnits(sdStatus.SdUtilizedBalance, "eth")) + fmt.Printf("The Operator has utilized %s from the Utility Pool.\n\n", eth.DisplayAmountInUnits(sdStatus.SdUtilizedBalance, "sd")) fmt.Printf("The Operator has a current Utilization Position of %s. (including the utilization fee)\n Note: For repayment of your utilized SD, please use the `stader-cli node repay-sd ` command.\n\n", eth.DisplayAmountInUnits(sdStatus.SdUtilizerLatestBalance, "sd")) @@ -199,12 +199,14 @@ func getNodeStatus(c *cli.Context) error { } fmt.Printf( - "The Operator can utilize upto %s SD more.\nNote: The Operator can utilize a maximum of 1 ETH worth SD per validator.\n\n", + "The Operator can utilize upto %s more.\nNote: The Operator can utilize a maximum of 1 ETH worth SD per validator.\n\n", eth.DisplayAmountInUnits(maxUtilizable, "sd")) - fmt.Printf( - "The Operator has a Health Factor of %s. \nNote: Please ensure your Health Factor is greater than 1 to avoid liquidations.\n\n", - sdStatus.HealthFactor.String()) + if sdStatus.SdUtilizedBalance.Cmp(big.NewInt(0)) == 0 { + fmt.Printf( + "The Operator has a Health Factor of %s. \nNote: Please ensure your Health Factor is greater than 1 to avoid liquidations.\n\n", + sdStatus.HealthFactor.String()) + } fmt.Printf( "The Utility Pool currently has a balance of %s.\n\n", diff --git a/stader-lib/utils/eth/units.go b/stader-lib/utils/eth/units.go index 08a40f7df..4815ad025 100644 --- a/stader-lib/utils/eth/units.go +++ b/stader-lib/utils/eth/units.go @@ -45,11 +45,11 @@ func WeiToEthWithValCheck(wei *big.Int) (float64, string) { func DisplayAmountInUnits(wei *big.Int, denom string) string { gweiDenom := " gwei" - if denom == "SD" { + if denom == "sd" { gweiDenom = " gwei SD" } regDenom := " ETH" - if denom == "SD" { + if denom == "sd" { regDenom = " SD" } From 290193bcd00baa3da2993d763becb27646fb5449 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Fri, 5 Jan 2024 17:20:32 +0530 Subject: [PATCH 120/159] cap bondable sd to user's balance --- stader-cli/node/utilize-sd.go | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index a4a5c93dd..01d015be7 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -120,20 +120,20 @@ func PromptChooseUtilityAmount(sdStatus *api.SdStatusResponse) (*big.Int, error) return nil, errors.New(msg) } - // Set max to pool available + // Set maxSd to pool available if sdStatus.PoolAvailableSDBalance.Cmp(maxUtility) <= 0 { maxUtility = sdStatus.PoolAvailableSDBalance } - min := eth.WeiToEth(minUtility) - max := eth.WeiToEth(maxUtility) + minSd := eth.DisplayAmountInUnits(minUtility, "sd") + maxSd := eth.DisplayAmountInUnits(maxUtility, "sd") msg := fmt.Sprintf(`Please enter the amount of SD you wish to utilize from the SD Utility Pool: -SD Utility Pool balance: %f SD -Minimum utilization amount: %f SD -Maximum utilization amount: %f SD`, eth.WeiToEth(sdStatus.PoolAvailableSDBalance), min, max) +SD Utility Pool balance: %s +Minimum utilization amount: %s +Maximum utilization amount: %s`, eth.DisplayAmountInUnits(sdStatus.PoolAvailableSDBalance, "sd"), minSd, maxSd) - errMsg := fmt.Sprintf("Invalid input, please specify an amount within %f and %f SD range\n", min, max) + errMsg := fmt.Sprintf("Invalid input, please specify an amount within %f and %f SD range\n", minSd, maxSd) utilityAmount, err := sd.PromptChooseSDWithMaxMin(msg, errMsg, minUtility, maxUtility) if err != nil { @@ -148,15 +148,18 @@ func PromptChooseSelfBondAmount(sdStatus *api.SdStatusResponse) (*big.Int, error amountToCollateralRemain := new(big.Int).Sub(sdStatus.SdCollateralRequireAmount, sdStatus.SdCollateralCurrentAmount) sdRewardEligibleRemain := new(big.Int).Sub(sdStatus.SdRewardEligible, sdStatus.SdCollateralCurrentAmount) + if sdRewardEligibleRemain.Cmp(sdStatus.SdBalance) > 0 { + sdRewardEligibleRemain = sdStatus.SdBalance + } - min := eth.WeiToEth(amountToCollateralRemain) - max := eth.WeiToEth(sdRewardEligibleRemain) + minSd := eth.DisplayAmountInUnits(amountToCollateralRemain, "sd") + maxSd := eth.DisplayAmountInUnits(sdRewardEligibleRemain, "sd") msg := fmt.Sprintf(`Please enter the amount of SD you wish to deposit as collateral. -Minimum bond: %f SD -Maximum bond: %f SD`, min, max) +Minimum bond: %s +Maximum bond: %s`, minSd, maxSd) - errMsg := fmt.Sprintf("Invalid input, please specify an amount within %f and %f SD range\n", min, max) + errMsg := fmt.Sprintf("Invalid input, please specify an amount within %f and %f SD range\n", minSd, maxSd) utilityAmount, err := sd.PromptChooseSDWithMaxMin(msg, errMsg, amountToCollateralRemain, sdRewardEligibleRemain) if err != nil { From 00c96e9a5e132dd03801b46969895557b4774600 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Fri, 5 Jan 2024 18:47:06 +0530 Subject: [PATCH 121/159] minor fixes --- stader-cli/node/utilize-sd.go | 12 ++++++------ stader-lib/utils/eth/units.go | 16 +++------------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index 01d015be7..0c6fc72a3 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -125,13 +125,13 @@ func PromptChooseUtilityAmount(sdStatus *api.SdStatusResponse) (*big.Int, error) maxUtility = sdStatus.PoolAvailableSDBalance } - minSd := eth.DisplayAmountInUnits(minUtility, "sd") - maxSd := eth.DisplayAmountInUnits(maxUtility, "sd") + minSd := eth.WeiToEth(minUtility) + maxSd := eth.WeiToEth(maxUtility) msg := fmt.Sprintf(`Please enter the amount of SD you wish to utilize from the SD Utility Pool: SD Utility Pool balance: %s Minimum utilization amount: %s -Maximum utilization amount: %s`, eth.DisplayAmountInUnits(sdStatus.PoolAvailableSDBalance, "sd"), minSd, maxSd) +Maximum utilization amount: %s`, eth.DisplayAmountInUnits(sdStatus.PoolAvailableSDBalance, "sd"), eth.DisplayAmountInUnits(minUtility, "sd"), eth.DisplayAmountInUnits(maxUtility, "sd")) errMsg := fmt.Sprintf("Invalid input, please specify an amount within %f and %f SD range\n", minSd, maxSd) @@ -152,12 +152,12 @@ func PromptChooseSelfBondAmount(sdStatus *api.SdStatusResponse) (*big.Int, error sdRewardEligibleRemain = sdStatus.SdBalance } - minSd := eth.DisplayAmountInUnits(amountToCollateralRemain, "sd") - maxSd := eth.DisplayAmountInUnits(sdRewardEligibleRemain, "sd") + minSd := eth.WeiToEth(amountToCollateralRemain) + maxSd := eth.WeiToEth(sdRewardEligibleRemain) msg := fmt.Sprintf(`Please enter the amount of SD you wish to deposit as collateral. Minimum bond: %s -Maximum bond: %s`, minSd, maxSd) +Maximum bond: %s`, eth.DisplayAmountInUnits(amountToCollateralRemain, "sd"), eth.DisplayAmountInUnits(sdRewardEligibleRemain, "sd")) errMsg := fmt.Sprintf("Invalid input, please specify an amount within %f and %f SD range\n", minSd, maxSd) diff --git a/stader-lib/utils/eth/units.go b/stader-lib/utils/eth/units.go index 4815ad025..677b4e570 100644 --- a/stader-lib/utils/eth/units.go +++ b/stader-lib/utils/eth/units.go @@ -33,16 +33,6 @@ const ( Threshold = 1e12 ) -func WeiToEthWithValCheck(wei *big.Int) (float64, string) { - if wei == nil { - return 0, "" - } - if wei.Cmp(big.NewInt(Threshold)) < 0 { - return WeiToGwei(wei), "gwei" - } - return WeiToEth(wei), "eth" -} - func DisplayAmountInUnits(wei *big.Int, denom string) string { gweiDenom := " gwei" if denom == "sd" { @@ -56,10 +46,10 @@ func DisplayAmountInUnits(wei *big.Int, denom string) string { if wei == nil { return "" } - if wei.Cmp(big.NewInt(Threshold)) < 0 { - return strconv.FormatFloat(WeiToGwei(wei), 'f', 2, 64) + gweiDenom + if wei.Cmp(big.NewInt(Threshold)) < 0 && wei.Cmp(big.NewInt(0)) != 0 { + return strconv.FormatFloat(WeiToGwei(wei), 'f', 6, 64) + gweiDenom } - return strconv.FormatFloat(WeiToEth(wei), 'f', 2, 64) + regDenom + return strconv.FormatFloat(WeiToEth(wei), 'f', 6, 64) + regDenom } // Convert wei to eth From 29667e9ff1c24b384381473043958c5662fab200 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Fri, 5 Jan 2024 20:51:04 +0530 Subject: [PATCH 122/159] fix copies --- stader-cli/node/status.go | 4 ++-- stader-cli/node/utilize-sd.go | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 1f8bb544d..3cc030e41 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -187,7 +187,7 @@ func getNodeStatus(c *cli.Context) error { fmt.Printf("The Operator has utilized %s from the Utility Pool.\n\n", eth.DisplayAmountInUnits(sdStatus.SdUtilizedBalance, "sd")) - fmt.Printf("The Operator has a current Utilization Position of %s. (including the utilization fee)\n Note: For repayment of your utilized SD, please use the `stader-cli node repay-sd ` command.\n\n", + fmt.Printf("The Operator has a current Utilization Position of %s. (including the utilization fee)\nNote: For repayment of your utilized SD, please use the `stader-cli node repay-sd ` command.\n\n", eth.DisplayAmountInUnits(sdStatus.SdUtilizerLatestBalance, "sd")) maxUtilizable := new(big.Int).Sub(sdStatus.SdMaxUtilizableAmount, sdStatus.SdUtilizerLatestBalance) @@ -199,7 +199,7 @@ func getNodeStatus(c *cli.Context) error { } fmt.Printf( - "The Operator can utilize upto %s more.\nNote: The Operator can utilize a maximum of 1 ETH worth SD per validator.\n\n", + "Each Operator can utilize upto %s more.\nNote: The Operator can utilize a maximum of 1 ETH worth SD per validator.\n\n", eth.DisplayAmountInUnits(maxUtilizable, "sd")) if sdStatus.SdUtilizedBalance.Cmp(big.NewInt(0)) == 0 { diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index 0c6fc72a3..99963679e 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -128,10 +128,11 @@ func PromptChooseUtilityAmount(sdStatus *api.SdStatusResponse) (*big.Int, error) minSd := eth.WeiToEth(minUtility) maxSd := eth.WeiToEth(maxUtility) - msg := fmt.Sprintf(`Please enter the amount of SD you wish to utilize from the SD Utility Pool: -SD Utility Pool balance: %s + msg := fmt.Sprintf(`SD Utility Pool balance: %s Minimum utilization amount: %s -Maximum utilization amount: %s`, eth.DisplayAmountInUnits(sdStatus.PoolAvailableSDBalance, "sd"), eth.DisplayAmountInUnits(minUtility, "sd"), eth.DisplayAmountInUnits(maxUtility, "sd")) +Maximum utilization amount: %s + +Please enter the amount of SD you wish to utilize from the SD Utility Pool:`, eth.DisplayAmountInUnits(sdStatus.PoolAvailableSDBalance, "sd"), eth.DisplayAmountInUnits(minUtility, "sd"), eth.DisplayAmountInUnits(maxUtility, "sd")) errMsg := fmt.Sprintf("Invalid input, please specify an amount within %f and %f SD range\n", minSd, maxSd) @@ -155,9 +156,11 @@ func PromptChooseSelfBondAmount(sdStatus *api.SdStatusResponse) (*big.Int, error minSd := eth.WeiToEth(amountToCollateralRemain) maxSd := eth.WeiToEth(sdRewardEligibleRemain) - msg := fmt.Sprintf(`Please enter the amount of SD you wish to deposit as collateral. + msg := fmt.Sprintf(` Minimum bond: %s -Maximum bond: %s`, eth.DisplayAmountInUnits(amountToCollateralRemain, "sd"), eth.DisplayAmountInUnits(sdRewardEligibleRemain, "sd")) +Maximum bond: %s + +Please enter the amount of SD you wish to deposit as collateral.`, eth.DisplayAmountInUnits(amountToCollateralRemain, "sd"), eth.DisplayAmountInUnits(sdRewardEligibleRemain, "sd")) errMsg := fmt.Sprintf("Invalid input, please specify an amount within %f and %f SD range\n", minSd, maxSd) From 0266932a9a5fadc219891c72731f8919ae81ccd0 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Sat, 6 Jan 2024 12:33:15 +0700 Subject: [PATCH 123/159] Update apr format --- stader-cli/node/utilize-sd.go | 6 ++++-- stader-cli/validator/deposit.go | 2 +- stader-lib/sdutility/sd-utility.go | 2 +- stader-lib/utils/sd/sd.go | 2 +- stader/api/validator/deposit.go | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index 99963679e..eb8a03c6f 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -9,6 +9,7 @@ import ( "github.com/stader-labs/stader-node/shared/services/stader" "github.com/stader-labs/stader-node/shared/types/api" cliutils "github.com/stader-labs/stader-node/shared/utils/cli" + "github.com/stader-labs/stader-node/shared/utils/log" "github.com/stader-labs/stader-node/stader-lib/utils/eth" "github.com/stader-labs/stader-node/stader-lib/utils/sd" "github.com/urfave/cli" @@ -58,9 +59,10 @@ func utilizeSD(c *cli.Context) error { return err } + rate := sdStatusResponse.SDStatus.UtilizationRate // Prompt for confirmation if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( - "Are you sure you want to use %s from the utility pool? (y/n). Note: A Utilization fee of %.6f APR will be applied to the utilized SD from the utility pool.\n", eth.DisplayAmountInUnits(amountWei, "sd"), 0.5))) { + "Are you sure you want to use %s from the utility pool? (y/n). Note: A Utilization fee of %s%s will be applied to the utilized SD from the utility pool.\n", eth.DisplayAmountInUnits(amountWei, "sd"), rate.String(), "%"))) { fmt.Println("Cancelled.") return nil } @@ -132,7 +134,7 @@ func PromptChooseUtilityAmount(sdStatus *api.SdStatusResponse) (*big.Int, error) Minimum utilization amount: %s Maximum utilization amount: %s -Please enter the amount of SD you wish to utilize from the SD Utility Pool:`, eth.DisplayAmountInUnits(sdStatus.PoolAvailableSDBalance, "sd"), eth.DisplayAmountInUnits(minUtility, "sd"), eth.DisplayAmountInUnits(maxUtility, "sd")) +%sPlease enter the amount of SD you wish to utilize from the SD Utility Pool:%s`, eth.DisplayAmountInUnits(sdStatus.PoolAvailableSDBalance, "sd"), eth.DisplayAmountInUnits(minUtility, "sd"), eth.DisplayAmountInUnits(maxUtility, "sd"), log.ColorYellow, log.ColorReset) errMsg := fmt.Sprintf("Invalid input, please specify an amount within %f and %f SD range\n", minSd, maxSd) diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 8acc8646c..4b647cbc1 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -97,7 +97,7 @@ func nodeDeposit(c *cli.Context) error { return err } - if !cliutils.Confirm(fmt.Sprintf("Are you sure you want to use %s from the Utility Pool? [Y/N] \nNote: A Utilization Fee of %s%s APR will be applied to the utilized SD from the Utility Pool. ", eth.DisplayAmountInUnits(utilityAmount, "sd"), sdStatus.UtilizationRate.String(), "%")) { + if !cliutils.Confirm(fmt.Sprintf("Are you sure you want to use %s from the Utility Pool? [Y/N] \nNote: A Utilization Fee of %s%s will be applied to the utilized SD from the Utility Pool. ", eth.DisplayAmountInUnits(utilityAmount, "sd"), sdStatus.UtilizationRate.String(), "%")) { fmt.Printf("Cancelled\n") return nil } diff --git a/stader-lib/sdutility/sd-utility.go b/stader-lib/sdutility/sd-utility.go index 80cbb62f7..7d0ccceaa 100644 --- a/stader-lib/sdutility/sd-utility.go +++ b/stader-lib/sdutility/sd-utility.go @@ -83,7 +83,7 @@ func SDMaxUtilizableAmount(sp *stader.SDUtilityPoolContractManager, return sdAmount, nil } -func GetUtilizationRate(sp *stader.SDUtilityPoolContractManager, opts *bind.CallOpts) (*big.Float, error) { +func GetUtilizationRatePercent(sp *stader.SDUtilityPoolContractManager, opts *bind.CallOpts) (*big.Float, error) { utilizationRatePerBlockInWei, err := sp.SDUtilityPool.UtilizationRatePerBlock(opts) if err != nil { return nil, err diff --git a/stader-lib/utils/sd/sd.go b/stader-lib/utils/sd/sd.go index 1a10f7a30..c43dfcf1a 100644 --- a/stader-lib/utils/sd/sd.go +++ b/stader-lib/utils/sd/sd.go @@ -53,7 +53,7 @@ func PromptChooseSDWithMaxMin(msg, errMsg string, min, max *big.Int) (*big.Int, utilityAmountWei = max } - if utilityAmountWei.Cmp(min) < 0 || utilityAmountWei.Cmp(max) > 0 { + if utilityAmountWei.Cmp(min) < 0 || utilityAmountWei.Cmp(max) > 0 || utilityAmountWei.Cmp(big.NewInt(0)) == 0 { fmt.Println(errMsg) continue } diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index b3d705a42..6c9ff0633 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -47,7 +47,7 @@ func GetSDStatus( return nil, err } - utilizationRate, err := sdutility.GetUtilizationRate(sdu, nil) + utilizationRate, err := sdutility.GetUtilizationRatePercent(sdu, nil) if err != nil { return nil, err } From ca89a11c2f826f0c371055126a0f7e5b25b9fe93 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Sat, 6 Jan 2024 21:32:53 +0700 Subject: [PATCH 124/159] Reload keys --- stader-cli/validator/deposit.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 4b647cbc1..3851b6014 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -158,7 +158,7 @@ func nodeDeposit(c *cli.Context) error { } // Make deposit - response, err := staderClient.NodeDeposit(baseAmount, big.NewInt(int64(numValidators)), utilityAmount, false) + response, err := staderClient.NodeDeposit(baseAmount, big.NewInt(int64(numValidators)), utilityAmount, true) if err != nil { return err } From 315962d4d83bc566f909f4100af6b4e5ac68d30f Mon Sep 17 00:00:00 2001 From: batphonghan Date: Wed, 10 Jan 2024 12:53:16 +0700 Subject: [PATCH 125/159] SD utilize fix phase 2 --- stader-cli/node/approve-sd.go | 9 +++++++++ stader-cli/node/deposit-sd.go | 6 ++++-- stader-cli/node/repay-sd.go | 5 +++-- stader-cli/node/utilize-sd.go | 3 --- stader-cli/validator/deposit.go | 4 ++-- stader-lib/utils/sd/sd.go | 8 -------- 6 files changed, 18 insertions(+), 17 deletions(-) diff --git a/stader-cli/node/approve-sd.go b/stader-cli/node/approve-sd.go index fa23078cc..ce6846741 100644 --- a/stader-cli/node/approve-sd.go +++ b/stader-cli/node/approve-sd.go @@ -144,3 +144,12 @@ func nodeApproveSdWithAmountAndAddress(staderClient *stader.Client, amountWei *b return nil } + +// Calculate max uint256 value +func maxApprovalAmount() *big.Int { + maxApproval := big.NewInt(2) + maxApproval = maxApproval.Exp(maxApproval, big.NewInt(256), nil) + maxApproval = maxApproval.Sub(maxApproval, big.NewInt(1)) + + return maxApproval +} diff --git a/stader-cli/node/deposit-sd.go b/stader-cli/node/deposit-sd.go index d985ffec0..d3acc234f 100644 --- a/stader-cli/node/deposit-sd.go +++ b/stader-cli/node/deposit-sd.go @@ -60,8 +60,10 @@ func DepositSdWithAmount(staderClient *stader.Client, amountWei *big.Int, autoCo } if allowance.Allowance.Cmp(amountWei) < 0 { - fmt.Println("Before depositing SD, you must first give the collateral contract approval to interact with your SD. Amount to approve: ", eth.DisplayAmountInUnits(amountWei, "sd")) - err = nodeApproveSdWithAmountAndAddress(staderClient, amountWei, contracts.SdCollateralContract, autoConfirm, nonce) + maxApproval := maxApprovalAmount() + + fmt.Println("Before depositing SD, you must first give the collateral contract approval to interact with your SD.") + err = nodeApproveSdWithAmountAndAddress(staderClient, maxApproval, contracts.SdCollateralContract, autoConfirm, nonce) if err != nil { return err } diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index 1393585c8..b465074a4 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -84,9 +84,10 @@ func repaySD(c *cli.Context) error { } if allowance.Allowance.Cmp(amountWei) < 0 { - fmt.Printf("Before repaying the SD, you must first give the utility contract approval to interact with your SD. Amount to approve: %s\n", eth.DisplayAmountInUnits(amountWei, "sd")) + fmt.Println("Before repaying the SD, you must first give the utility contract approval to interact with your SD.") + maxApproval := maxApprovalAmount() - err = nodeApproveUtilitySd(c, amountInString) + err = nodeApproveUtilitySd(c, maxApproval.String()) if err != nil { return err } diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index eb8a03c6f..c3677b908 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -151,9 +151,6 @@ func PromptChooseSelfBondAmount(sdStatus *api.SdStatusResponse) (*big.Int, error amountToCollateralRemain := new(big.Int).Sub(sdStatus.SdCollateralRequireAmount, sdStatus.SdCollateralCurrentAmount) sdRewardEligibleRemain := new(big.Int).Sub(sdStatus.SdRewardEligible, sdStatus.SdCollateralCurrentAmount) - if sdRewardEligibleRemain.Cmp(sdStatus.SdBalance) > 0 { - sdRewardEligibleRemain = sdStatus.SdBalance - } minSd := eth.WeiToEth(amountToCollateralRemain) maxSd := eth.WeiToEth(sdRewardEligibleRemain) diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 3851b6014..28995557d 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -177,8 +177,8 @@ func nodeDeposit(c *cli.Context) error { fmt.Printf("The node deposit of %d ETH was made successfully and total %d validators were created by utilizing %.6f from the SD Utility Pool.\n", uint64(eth.BaseAmountInEth)*numValidators, numValidators, eth.WeiToEth(utilityAmount)) } - fmt.Println("Your validators are now in Initialized status. Once the ETH deposits have been matched by the remaining 28ETH, it will move to Deposited status.") - fmt.Println("You can check the status of your validator with `stader-cli validator status`.") + fmt.Println("Your validators are now in an Initialized state. Once the ETH deposits have been matched by the remaining 28 ETH, it will move to the Deposited state.") + fmt.Println("You can check the status of your validator by executing the following command: `~/bin/stader-cli validator status`") return nil diff --git a/stader-lib/utils/sd/sd.go b/stader-lib/utils/sd/sd.go index c43dfcf1a..3980c8be9 100644 --- a/stader-lib/utils/sd/sd.go +++ b/stader-lib/utils/sd/sd.go @@ -45,14 +45,6 @@ func PromptChooseSDWithMaxMin(msg, errMsg string, min, max *big.Int) (*big.Int, utilityAmountWei = eth.EthToWei(utilityAmountFloat) - if WeiAlmostEqual(utilityAmountWei, min) { - utilityAmountWei = min - } - - if WeiAlmostEqual(utilityAmountWei, max) { - utilityAmountWei = max - } - if utilityAmountWei.Cmp(min) < 0 || utilityAmountWei.Cmp(max) > 0 || utilityAmountWei.Cmp(big.NewInt(0)) == 0 { fmt.Println(errMsg) continue From e4f6ba8c23a333f14b41a89daf7b84d3255016de Mon Sep 17 00:00:00 2001 From: batphonghan Date: Wed, 10 Jan 2024 14:31:19 +0700 Subject: [PATCH 126/159] Add full options on repay-sd --- stader-cli/node/commands.go | 10 ++++++++-- stader-cli/node/repay-sd.go | 35 +++++++++++++++++++---------------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/stader-cli/node/commands.go b/stader-cli/node/commands.go index 5196b818b..fb13a97c0 100644 --- a/stader-cli/node/commands.go +++ b/stader-cli/node/commands.go @@ -370,10 +370,16 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { Name: "yes, y", Usage: "Automatically confirm SD repay", }, + cli.BoolFlag{ + Name: "full, f", + Usage: "Automatically repay all SD utilized", + }, }, Action: func(c *cli.Context) error { - if _, err := cliutils.ValidatePositiveEthAmount("sd repay amount", c.String("amount")); err != nil { - return err + if !c.Bool("full") { + if _, err := cliutils.ValidatePositiveEthAmount("sd repay amount", c.String("amount")); err != nil { + return err + } } // Run diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index b465074a4..552233ca9 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -33,15 +33,6 @@ func repaySD(c *cli.Context) error { return err } - amountInString := c.String("amount") - - amount, err := strconv.ParseFloat(amountInString, 64) - if err != nil { - return err - } - - amountWei := eth.EthToWei(amount) - contracts, err := staderClient.GetContractsInfo() if err != nil { return err @@ -53,16 +44,28 @@ func repaySD(c *cli.Context) error { } sdStatus := sdStatusResponse.SDStatus - if sdStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) == 0 { - fmt.Println("You do not have an existing Utilization Position.") - return nil - } + var amountWei *big.Int - // If almost equal repay with all Utilize position to make sure the position is cleared - if sd.WeiAlmostEqual(amountWei, sdStatus.SdUtilizerLatestBalance) { + if c.Bool("full") { amountWei = sdStatus.SdUtilizerLatestBalance + } else { + amountInString := c.String("amount") + amount, err := strconv.ParseFloat(amountInString, 64) + if err != nil { + return err + } + + amountWei = eth.EthToWei(amount) + + // If almost equal repay with all Utilize position to make sure the position is cleared + if sd.WeiAlmostEqual(amountWei, sdStatus.SdUtilizerLatestBalance) { + amountWei = sdStatus.SdUtilizerLatestBalance + } + } - amountInString = fmt.Sprintf("%.18f", eth.WeiToEth(sdStatus.SdUtilizerLatestBalance)) + if sdStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) == 0 { + fmt.Println("You do not have an existing Utilization Position.") + return nil } // 1. Check if repay more than need From 55d457600fde618c913dbb2f1a1519b07fa0bb80 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Wed, 10 Jan 2024 15:01:34 +0530 Subject: [PATCH 127/159] minor updates --- stader-cli/node/utilize-sd.go | 2 +- stader-cli/validator/deposit.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index c3677b908..a0252b411 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -159,7 +159,7 @@ func PromptChooseSelfBondAmount(sdStatus *api.SdStatusResponse) (*big.Int, error Minimum bond: %s Maximum bond: %s -Please enter the amount of SD you wish to deposit as collateral.`, eth.DisplayAmountInUnits(amountToCollateralRemain, "sd"), eth.DisplayAmountInUnits(sdRewardEligibleRemain, "sd")) +%sPlease enter the amount of SD you wish to deposit as collateral:%s`, eth.DisplayAmountInUnits(amountToCollateralRemain, "sd"), eth.DisplayAmountInUnits(sdRewardEligibleRemain, "sd"), log.ColorYellow, log.ColorReset) errMsg := fmt.Sprintf("Invalid input, please specify an amount within %f and %f SD range\n", minSd, maxSd) diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 28995557d..1b25d3482 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -174,7 +174,7 @@ func nodeDeposit(c *cli.Context) error { if utilityAmount.Cmp(big.NewInt(0)) == 0 { fmt.Printf("The node deposit of %d ETH was made successfully and total %d validators were created.\n", uint64(eth.BaseAmountInEth)*numValidators, numValidators) } else { - fmt.Printf("The node deposit of %d ETH was made successfully and total %d validators were created by utilizing %.6f from the SD Utility Pool.\n", uint64(eth.BaseAmountInEth)*numValidators, numValidators, eth.WeiToEth(utilityAmount)) + fmt.Printf("The node deposit of %d ETH was made successfully and total %d validators were created by utilizing %s from the SD Utility Pool.\n", uint64(eth.BaseAmountInEth)*numValidators, numValidators, eth.DisplayAmountInUnits(utilityAmount, "sd")) } fmt.Println("Your validators are now in an Initialized state. Once the ETH deposits have been matched by the remaining 28 ETH, it will move to the Deposited state.") From 94f39533aff2b04a298399ecbe3f74861c9e38b6 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Wed, 10 Jan 2024 16:17:09 +0530 Subject: [PATCH 128/159] minor typo fix --- stader-cli/node/utilize-sd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index a0252b411..b93c5cbef 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -62,7 +62,7 @@ func utilizeSD(c *cli.Context) error { rate := sdStatusResponse.SDStatus.UtilizationRate // Prompt for confirmation if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( - "Are you sure you want to use %s from the utility pool? (y/n). Note: A Utilization fee of %s%s will be applied to the utilized SD from the utility pool.\n", eth.DisplayAmountInUnits(amountWei, "sd"), rate.String(), "%"))) { + "Are you sure you want to use %s from the utility pool? (y/n).\nNote: A Utilization fee of %s%s will be applied to the utilized SD from the utility pool.\n", eth.DisplayAmountInUnits(amountWei, "sd"), rate.String(), "%"))) { fmt.Println("Cancelled.") return nil } From 3a4632c2ed5084bff6790ec7e28e7854a54dc195 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Wed, 10 Jan 2024 17:23:15 +0700 Subject: [PATCH 129/159] Inlcuded SdUtilizerLatestBalance in self bond flow --- stader-cli/node/utilize-sd.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index b93c5cbef..39d4c88ba 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -148,9 +148,15 @@ Maximum utilization amount: %s func PromptChooseSelfBondAmount(sdStatus *api.SdStatusResponse) (*big.Int, error) { - amountToCollateralRemain := new(big.Int).Sub(sdStatus.SdCollateralRequireAmount, sdStatus.SdCollateralCurrentAmount) + totalCollateral := new(big.Int).Add(sdStatus.SdCollateralCurrentAmount, sdStatus.SdUtilizerLatestBalance) - sdRewardEligibleRemain := new(big.Int).Sub(sdStatus.SdRewardEligible, sdStatus.SdCollateralCurrentAmount) + amountToCollateralRemain := new(big.Int).Sub(sdStatus.SdCollateralRequireAmount, totalCollateral) + + sdRewardEligibleRemain := new(big.Int).Sub(sdStatus.SdRewardEligible, totalCollateral) + + if amountToCollateralRemain.Cmp(big.NewInt(0)) < 0 { + amountToCollateralRemain = big.NewInt(0) + } minSd := eth.WeiToEth(amountToCollateralRemain) maxSd := eth.WeiToEth(sdRewardEligibleRemain) From f024f9cc4be73bc2c1487168a06cb45d51d370f7 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Wed, 10 Jan 2024 16:18:41 +0530 Subject: [PATCH 130/159] update the version to a dev version --- shared/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/version.go b/shared/version.go index 3e99892f2..591da74ff 100644 --- a/shared/version.go +++ b/shared/version.go @@ -21,7 +21,7 @@ package shared const BinaryBucket string = "/stader-node-build/permissionless" const DockerAccount string = "staderlabs" -const StaderVersion string = "1.4.4" +const StaderVersion string = "1.5.0-dev" const Logo string = ` _____ _ _ _ _ 𝅺 From fcd99088e7a2db04ee067fbe235dd38d06a66de7 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Wed, 10 Jan 2024 19:57:00 +0530 Subject: [PATCH 131/159] minor fixes --- stader-cli/node/deposit-sd.go | 12 ++++++------ stader-cli/node/repay-sd.go | 10 +++++----- stader-cli/node/utilize-sd.go | 12 ++++++++---- stader-cli/node/withdraw-sd.go | 2 +- stader/api/node/withdraw-sd.go | 11 +++++++++-- 5 files changed, 29 insertions(+), 18 deletions(-) diff --git a/stader-cli/node/deposit-sd.go b/stader-cli/node/deposit-sd.go index d3acc234f..7101b1b47 100644 --- a/stader-cli/node/deposit-sd.go +++ b/stader-cli/node/deposit-sd.go @@ -84,18 +84,18 @@ func DepositSdWithAmount(staderClient *stader.Client, amountWei *big.Int, autoCo return nil } - // Assign max fees - err = gas.AssignMaxFeeAndLimit(canDeposit.GasInfo, staderClient, autoConfirm) - if err != nil { - return err - } - // Prompt for confirmation if !(autoConfirm || cliutils.Confirm(fmt.Sprintf("Are you sure you want to deposit %s as collateral?", eth.DisplayAmountInUnits(amountWei, "sd")))) { fmt.Println("Cancelled.") return nil } + // Assign max fees + err = gas.AssignMaxFeeAndLimit(canDeposit.GasInfo, staderClient, autoConfirm) + if err != nil { + return err + } + depositSdResponse, err := staderClient.NodeDepositSd(amountWei) if err != nil { return err diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index 552233ca9..a660e2bf6 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -101,11 +101,6 @@ func repaySD(c *cli.Context) error { return err } - err = gas.AssignMaxFeeAndLimit(canRepaySdResponse.GasInfo, staderClient, c.Bool("yes")) - if err != nil { - return err - } - // Prompt for confirmation if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( "Are you sure you want to repay %s from your Operator Address and reduce or close your Utilization Position?", eth.DisplayAmountInUnits(amountWei, "sd")))) { @@ -113,6 +108,11 @@ func repaySD(c *cli.Context) error { return nil } + err = gas.AssignMaxFeeAndLimit(canRepaySdResponse.GasInfo, staderClient, c.Bool("yes")) + if err != nil { + return err + } + res, err := staderClient.RepaySd(amountWei) if err != nil { return err diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index 39d4c88ba..1b64ef20e 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -61,10 +61,14 @@ func utilizeSD(c *cli.Context) error { rate := sdStatusResponse.SDStatus.UtilizationRate // Prompt for confirmation - if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( - "Are you sure you want to use %s from the utility pool? (y/n).\nNote: A Utilization fee of %s%s will be applied to the utilized SD from the utility pool.\n", eth.DisplayAmountInUnits(amountWei, "sd"), rate.String(), "%"))) { - fmt.Println("Cancelled.") - return nil + if !(c.Bool("yes")) { + confirm := cliutils.Confirm(fmt.Sprintf( + "Are you sure you want to use %s from the utility pool?", eth.DisplayAmountInUnits(amountWei, "sd"))) + fmt.Printf("Note: A Utilization fee of %s%s will be applied to the utilized SD from the utility pool.", rate.String(), "%") + if !confirm { + fmt.Println("Cancelled.") + return nil + } } res, err := staderClient.NodeUtilizeSd(amountWei) diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index 6f1a97a2c..0082819af 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -41,7 +41,7 @@ func WithdrawSd(c *cli.Context) error { return nil } if canWithdrawSdResponse.InsufficientSdCollateral { - fmt.Println("SD collateral less than 200%") + fmt.Println("Not enough excess SD collateral to withdraw") return nil } diff --git a/stader/api/node/withdraw-sd.go b/stader/api/node/withdraw-sd.go index 61e882926..49edc39bf 100644 --- a/stader/api/node/withdraw-sd.go +++ b/stader/api/node/withdraw-sd.go @@ -73,12 +73,19 @@ func canWithdrawSd(c *cli.Context, amountWei *big.Int) (*api.CanWithdrawSdRespon thresholdSdRequiredToWithdraw := withdrawThresholdInSd.Add(withdrawThresholdInSd, amountWei) - if operatorSdCollateral.Cmp(thresholdSdRequiredToWithdraw) < 0 { + utilizedBalance, err := sd_collateral.GetOperatorUtilizedSDBalance(sdc, nodeAccount.Address, nil) + if err != nil { + return nil, err + } + + totalOperatorSdCollateral := big.NewInt(0).Add(operatorSdCollateral, utilizedBalance) + + if totalOperatorSdCollateral.Cmp(thresholdSdRequiredToWithdraw) < 0 { response.InsufficientSdCollateral = true return &response, nil } - if operatorSdCollateral.Cmp(amountWei) < 0 { + if totalOperatorSdCollateral.Cmp(amountWei) < 0 { response.InsufficientWithdrawableSd = true return &response, nil } From 66fa3abc43e232fe8cd0a7f68c5b5351e5d0a957 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Wed, 10 Jan 2024 20:26:33 +0530 Subject: [PATCH 132/159] minor fix --- stader-cli/node/utilize-sd.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index 1b64ef20e..ef95f5c05 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -61,14 +61,10 @@ func utilizeSD(c *cli.Context) error { rate := sdStatusResponse.SDStatus.UtilizationRate // Prompt for confirmation - if !(c.Bool("yes")) { - confirm := cliutils.Confirm(fmt.Sprintf( - "Are you sure you want to use %s from the utility pool?", eth.DisplayAmountInUnits(amountWei, "sd"))) - fmt.Printf("Note: A Utilization fee of %s%s will be applied to the utilized SD from the utility pool.", rate.String(), "%") - if !confirm { - fmt.Println("Cancelled.") - return nil - } + if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( + "Are you sure you want to use %s from the utility pool?.\nNote: A Utilization fee of %s%s will be applied to the utilized SD from the utility pool.\n", eth.DisplayAmountInUnits(amountWei, "sd"), rate.String(), "%"))) { + fmt.Println("Cancelled.") + return nil } res, err := staderClient.NodeUtilizeSd(amountWei) From d1924f2666fa9bf945d8e8175345e78e01255e05 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Wed, 10 Jan 2024 20:42:45 +0530 Subject: [PATCH 133/159] minor copy changes --- stader-cli/node/withdraw-sd.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index 0082819af..5034ff741 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -40,10 +40,6 @@ func WithdrawSd(c *cli.Context) error { fmt.Println("Insufficient withdrawable SD!") return nil } - if canWithdrawSdResponse.InsufficientSdCollateral { - fmt.Println("Not enough excess SD collateral to withdraw") - return nil - } sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0)) if err != nil { @@ -52,13 +48,19 @@ func WithdrawSd(c *cli.Context) error { hasUtilizePosition := sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) != 0 - if hasUtilizePosition { + // if the paid out amount is > utilizedBalance + if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(amountWei) >= 0 { if !cliutils.Confirm(fmt.Sprintf("You have an existing Utilization Position of %s. The excess SD collateral you are trying to withdraw will be used to repay the utilized SD.\n Do you wish to proceed?", eth.DisplayAmountInUnits(sdStatusResponse.SDStatus.SdUtilizerLatestBalance, "sd"))) { fmt.Println("Cancelled.") return nil } - + } else { + if !cliutils.Confirm(fmt.Sprintf("You have an existing Utilization Position of %s. The excess SD collateral you are trying to withdraw will be used to repay the utilized SD and the remaining SD will be sent to your Reward Address.\n Do you wish to proceed?", eth.DisplayAmountInUnits(sdStatusResponse.SDStatus.SdUtilizerLatestBalance, "sd"))) { + fmt.Println("Cancelled.") + return nil + } } + // Assign max fees err = gas.AssignMaxFeeAndLimit(canWithdrawSdResponse.GasInfo, staderClient, c.Bool("yes")) if err != nil { From 67fac081e55ab00ce45ca4b01fcea5996c59f007 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Wed, 10 Jan 2024 23:49:42 +0700 Subject: [PATCH 134/159] various fixes --- shared/utils/cli/prompt.go | 5 ++++- stader-cli/node/utilize-sd.go | 7 +++---- stader-cli/validator/deposit.go | 3 +-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/shared/utils/cli/prompt.go b/shared/utils/cli/prompt.go index 3d7bb024b..39be0532e 100644 --- a/shared/utils/cli/prompt.go +++ b/shared/utils/cli/prompt.go @@ -58,8 +58,11 @@ func Select(initialPrompt string, options []string) (int, string) { // Get prompt prompt := initialPrompt + errPromptMsg := "Please enter a number corresponding to an option" + for i, option := range options { prompt += fmt.Sprintf("\n%d: %s", (i + 1), option) + errPromptMsg += fmt.Sprintf("\n%d: %s", (i + 1), option) } // Get expected response format @@ -70,7 +73,7 @@ func Select(initialPrompt string, options []string) (int, string) { expectedFormat := fmt.Sprintf("^(%s)$", strings.Join(optionNumbers, "|")) // Prompt user - response := Prompt(prompt, expectedFormat, "Please enter a number corresponding to an option") + response := Prompt(prompt, expectedFormat, errPromptMsg) // Get selected option index, _ := strconv.Atoi(response) diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index ef95f5c05..0b3f53398 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -136,7 +136,7 @@ Maximum utilization amount: %s %sPlease enter the amount of SD you wish to utilize from the SD Utility Pool:%s`, eth.DisplayAmountInUnits(sdStatus.PoolAvailableSDBalance, "sd"), eth.DisplayAmountInUnits(minUtility, "sd"), eth.DisplayAmountInUnits(maxUtility, "sd"), log.ColorYellow, log.ColorReset) - errMsg := fmt.Sprintf("Invalid input, please specify an amount within %f and %f SD range\n", minSd, maxSd) + errMsg := fmt.Sprintf("Invalid input, please specify an amount within %f and %f SD range", minSd, maxSd) utilityAmount, err := sd.PromptChooseSDWithMaxMin(msg, errMsg, minUtility, maxUtility) if err != nil { @@ -161,13 +161,12 @@ func PromptChooseSelfBondAmount(sdStatus *api.SdStatusResponse) (*big.Int, error minSd := eth.WeiToEth(amountToCollateralRemain) maxSd := eth.WeiToEth(sdRewardEligibleRemain) - msg := fmt.Sprintf(` -Minimum bond: %s + msg := fmt.Sprintf(`Minimum bond: %s Maximum bond: %s %sPlease enter the amount of SD you wish to deposit as collateral:%s`, eth.DisplayAmountInUnits(amountToCollateralRemain, "sd"), eth.DisplayAmountInUnits(sdRewardEligibleRemain, "sd"), log.ColorYellow, log.ColorReset) - errMsg := fmt.Sprintf("Invalid input, please specify an amount within %f and %f SD range\n", minSd, maxSd) + errMsg := fmt.Sprintf("Invalid input, please specify an amount within %f and %f SD range", minSd, maxSd) utilityAmount, err := sd.PromptChooseSDWithMaxMin(msg, errMsg, amountToCollateralRemain, sdRewardEligibleRemain) if err != nil { diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 1b25d3482..b8e01571c 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -117,10 +117,9 @@ func nodeDeposit(c *cli.Context) error { return nil } - autoConfirm := c.Bool("yes") nounce := c.GlobalUint64("nonce") + err = node.DepositSdWithAmount(staderClient, selfBondAmount, true, nounce) - err = node.DepositSdWithAmount(staderClient, selfBondAmount, autoConfirm, nounce) if err != nil { return err } From f0dde6c301beb5e237150866c77acfc5c77b159a Mon Sep 17 00:00:00 2001 From: batphonghan Date: Thu, 11 Jan 2024 12:23:59 +0700 Subject: [PATCH 135/159] Put back not enough excess SD collateral check --- stader-cli/node/withdraw-sd.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index 5034ff741..a005c4036 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -36,11 +36,17 @@ func WithdrawSd(c *cli.Context) error { if err != nil { return err } + if canWithdrawSdResponse.InsufficientWithdrawableSd { fmt.Println("Insufficient withdrawable SD!") return nil } + if canWithdrawSdResponse.InsufficientSdCollateral { + fmt.Println("Not enough excess SD collateral to withdraw") + return nil + } + sdStatusResponse, err := staderClient.GetSDStatus(big.NewInt(0)) if err != nil { return err From aec17603c8d9333739c1bd1b3f743622e3944367 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Thu, 11 Jan 2024 13:20:09 +0700 Subject: [PATCH 136/159] Update copy --- stader-cli/node/utilize-sd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index 0b3f53398..2a2afd908 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -62,7 +62,7 @@ func utilizeSD(c *cli.Context) error { rate := sdStatusResponse.SDStatus.UtilizationRate // Prompt for confirmation if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( - "Are you sure you want to use %s from the utility pool?.\nNote: A Utilization fee of %s%s will be applied to the utilized SD from the utility pool.\n", eth.DisplayAmountInUnits(amountWei, "sd"), rate.String(), "%"))) { + "Are you sure you want to use %s from the utility pool?.\nNote: A Utilization fee of %s%s will be applied to the utilized SD from the utility pool.", eth.DisplayAmountInUnits(amountWei, "sd"), rate.String(), "%"))) { fmt.Println("Cancelled.") return nil } From cd07ed11bbf728865f073693593fc6e5d4761b03 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Fri, 12 Jan 2024 10:55:34 +0700 Subject: [PATCH 137/159] Repay SD flow update --- stader-cli/node/approve-sd.go | 10 ++-- stader-cli/node/commands.go | 14 ------ stader-cli/node/deposit-sd.go | 2 +- stader-cli/node/repay-sd.go | 93 +++++++++++++++++++++-------------- 4 files changed, 62 insertions(+), 57 deletions(-) diff --git a/stader-cli/node/approve-sd.go b/stader-cli/node/approve-sd.go index ce6846741..3ead42c11 100644 --- a/stader-cli/node/approve-sd.go +++ b/stader-cli/node/approve-sd.go @@ -146,10 +146,10 @@ func nodeApproveSdWithAmountAndAddress(staderClient *stader.Client, amountWei *b } // Calculate max uint256 value -func maxApprovalAmount() *big.Int { - maxApproval := big.NewInt(2) - maxApproval = maxApproval.Exp(maxApproval, big.NewInt(256), nil) - maxApproval = maxApproval.Sub(maxApproval, big.NewInt(1)) +func maxUint256() *big.Int { + maxUint256 := big.NewInt(2) + maxUint256 = maxUint256.Exp(maxUint256, big.NewInt(256), nil) + maxUint256 = maxUint256.Sub(maxUint256, big.NewInt(1)) - return maxApproval + return maxUint256 } diff --git a/stader-cli/node/commands.go b/stader-cli/node/commands.go index fb13a97c0..aa8f34765 100644 --- a/stader-cli/node/commands.go +++ b/stader-cli/node/commands.go @@ -362,26 +362,12 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { Usage: "Repay the amount to reduce their utilization position", UsageText: "stader-cli node repay-sd [options]", Flags: []cli.Flag{ - cli.StringFlag{ - Name: "amount, a", - Usage: "The amount of SD to repay", - }, cli.BoolFlag{ Name: "yes, y", Usage: "Automatically confirm SD repay", }, - cli.BoolFlag{ - Name: "full, f", - Usage: "Automatically repay all SD utilized", - }, }, Action: func(c *cli.Context) error { - if !c.Bool("full") { - if _, err := cliutils.ValidatePositiveEthAmount("sd repay amount", c.String("amount")); err != nil { - return err - } - } - // Run return repaySD(c) }, diff --git a/stader-cli/node/deposit-sd.go b/stader-cli/node/deposit-sd.go index 7101b1b47..b98d4a704 100644 --- a/stader-cli/node/deposit-sd.go +++ b/stader-cli/node/deposit-sd.go @@ -60,7 +60,7 @@ func DepositSdWithAmount(staderClient *stader.Client, amountWei *big.Int, autoCo } if allowance.Allowance.Cmp(amountWei) < 0 { - maxApproval := maxApprovalAmount() + maxApproval := maxUint256() fmt.Println("Before depositing SD, you must first give the collateral contract approval to interact with your SD.") err = nodeApproveSdWithAmountAndAddress(staderClient, maxApproval, contracts.SdCollateralContract, autoConfirm, nonce) diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index a660e2bf6..197192b5b 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -3,13 +3,14 @@ package node import ( "fmt" "math/big" - "strconv" "github.com/urfave/cli" "github.com/stader-labs/stader-node/shared/services/gas" "github.com/stader-labs/stader-node/shared/services/stader" + "github.com/stader-labs/stader-node/shared/types/api" cliutils "github.com/stader-labs/stader-node/shared/utils/cli" + "github.com/stader-labs/stader-node/shared/utils/log" "github.com/stader-labs/stader-node/stader-lib/utils/eth" "github.com/stader-labs/stader-node/stader-lib/utils/sd" ) @@ -44,51 +45,48 @@ func repaySD(c *cli.Context) error { } sdStatus := sdStatusResponse.SDStatus + + if sdStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) == 0 { + fmt.Println("You do not have an existing Utilization Position.") + return nil + } + + // Check allowance + allowance, err := staderClient.GetNodeSdAllowance(contracts.SdUtilityContract) + if err != nil { + return err + } + + ops := []string{"Repay full amount", "Repay a custom amount"} + i, _ := cliutils.Select("Please choose one of the following options for repayment. Enter 1 or 2:", ops) + + fullRepay := false var amountWei *big.Int - if c.Bool("full") { + switch i { + case 0: + // 1. If user had enough to repay + fullRepay = true amountWei = sdStatus.SdUtilizerLatestBalance - } else { - amountInString := c.String("amount") - amount, err := strconv.ParseFloat(amountInString, 64) + + case 1: + amountWei, err = PromptChooseRepayAmount(sdStatus) if err != nil { return err } - amountWei = eth.EthToWei(amount) - - // If almost equal repay with all Utilize position to make sure the position is cleared - if sd.WeiAlmostEqual(amountWei, sdStatus.SdUtilizerLatestBalance) { - amountWei = sdStatus.SdUtilizerLatestBalance - } - } - - if sdStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) == 0 { - fmt.Println("You do not have an existing Utilization Position.") - return nil - } - - // 1. Check if repay more than need - if amountWei.Cmp(sdStatus.SdUtilizerLatestBalance) > 0 { - fmt.Printf("Repayment amount greater than the Utilization position. Your current Utilization Position is %s \n", eth.DisplayAmountInUnits(sdStatus.SdUtilizerLatestBalance, "sd")) + default: return nil } - // 2. If user had enough to repay if amountWei.Cmp(sdStatus.SdBalance) > 0 { fmt.Printf("You don't have sufficient SD in your Operator Address for the repayment. Please deposit SD into your Operator Address and try again.\n") return nil } - // Check allowance - allowance, err := staderClient.GetNodeSdAllowance(contracts.SdUtilityContract) - if err != nil { - return err - } - - if allowance.Allowance.Cmp(amountWei) < 0 { + if allowance.Allowance.Cmp(sdStatus.SdUtilizerLatestBalance) < 0 { fmt.Println("Before repaying the SD, you must first give the utility contract approval to interact with your SD.") - maxApproval := maxApprovalAmount() + maxApproval := maxUint256() err = nodeApproveUtilitySd(c, maxApproval.String()) if err != nil { @@ -96,18 +94,21 @@ func repaySD(c *cli.Context) error { } } + // Prompt for confirmation + if !cliutils.Confirm(fmt.Sprintf("Are you sure you want to repay %s from your Operator Address and close your Utilization Position? ", eth.DisplayAmountInUnits(amountWei, "sd"))) { + fmt.Printf("Cancelled\n") + return nil + } + + if fullRepay { + amountWei = maxUint256() + } + canRepaySdResponse, err := staderClient.CanRepaySd(amountWei) if err != nil { return err } - // Prompt for confirmation - if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( - "Are you sure you want to repay %s from your Operator Address and reduce or close your Utilization Position?", eth.DisplayAmountInUnits(amountWei, "sd")))) { - fmt.Println("Cancelled.") - return nil - } - err = gas.AssignMaxFeeAndLimit(canRepaySdResponse.GasInfo, staderClient, c.Bool("yes")) if err != nil { return err @@ -129,3 +130,21 @@ func repaySD(c *cli.Context) error { return nil } + +func PromptChooseRepayAmount(sdStatus *api.SdStatusResponse) (*big.Int, error) { + + msg := fmt.Sprintf(`%sPlease enter the amount of SD you wish to repay. Your current Utilization Position is %s%s`, log.ColorYellow, eth.DisplayAmountInUnits(sdStatus.SdUtilizerLatestBalance, "sd"), log.ColorReset) + + errMsg := fmt.Sprintf("%sInvalid input, please specify a valid amount of SD you wish to repay. Your current Utilization Position is %s SD%s", log.ColorRed, eth.DisplayAmountInUnits(sdStatus.SdUtilizerLatestBalance, "sd"), log.ColorReset) + + utilityAmount, err := sd.PromptChooseSDWithMaxMin(msg, errMsg, big.NewInt(0), sdStatus.SdUtilizerLatestBalance) + if err != nil { + return nil, err + } + + if sd.WeiAlmostEqual(utilityAmount, sdStatus.SdUtilizerLatestBalance) { + utilityAmount = sdStatus.SdUtilizerLatestBalance + } + + return utilityAmount, nil +} From de2eb8e2bbb123cda67ebc810b5dca741d49714f Mon Sep 17 00:00:00 2001 From: batphonghan Date: Mon, 15 Jan 2024 22:38:58 +0700 Subject: [PATCH 138/159] Update metrics --- shared/services/state/network-state.go | 24 ++++++++++++++++--- stader-cli/node/status.go | 2 ++ stader/guardian/collector/constants.go | 2 ++ .../guardian/collector/network-collector.go | 19 ++++++++++++++- .../guardian/collector/operator-collector.go | 10 ++++++++ stader/guardian/collector/state-locker.go | 23 ++++++++++-------- 6 files changed, 66 insertions(+), 14 deletions(-) diff --git a/shared/services/state/network-state.go b/shared/services/state/network-state.go index a82716ab1..230155f17 100644 --- a/shared/services/state/network-state.go +++ b/shared/services/state/network-state.go @@ -121,6 +121,12 @@ type MetricDetails struct { // done SdUtilityPoolBalance float64 + // The utilize amount + fee + OperatorSDUtilizationPosition float64 + + // The amount SD self bond + OperatorSDSelfBond float64 + // done OperatorSDInterest float64 @@ -281,10 +287,12 @@ func CreateMetricsCache( if err != nil { return nil, err } - operatorSdColletaral, err := sd_collateral.GetOperatorSdBalance(sdc, nodeAddress, nil) + + operatorSdCollateral, err := sd_collateral.GetOperatorSdBalance(sdc, nodeAddress, nil) if err != nil { return nil, err } + totalValidatorKeys, err := node.GetTotalValidatorKeys(prn, operatorId, nil) if err != nil { return nil, err @@ -293,7 +301,8 @@ func CreateMetricsCache( if err != nil { return nil, err } - operatorSdCollateralInEth, err := sd_collateral.ConvertSdToEth(sdc, operatorSdColletaral, nil) + + operatorSdCollateralInEth, err := sd_collateral.ConvertSdToEth(sdc, operatorSdCollateral, nil) if err != nil { return nil, err } @@ -482,6 +491,11 @@ func CreateMetricsCache( return nil, err } + totalPosition, err := sdutility.GetUtilizerLatestBalance(sdu, nodeAddress, nil) + if err != nil { + return nil, err + } + utilityPoolBalance, err := sdutility.GetPoolAvailableSDBalance(sdu, nil) if err != nil { return nil, err @@ -548,7 +562,7 @@ func CreateMetricsCache( metricsDetails.SdUtilityPoolBalance = math.RoundDown(eth.WeiToEth(utilityPoolBalance), SixDecimalRound) // - operatorStakedSd := eth.WeiToEth(operatorSdColletaral) + metricsDetails.OperatorSDUtilized + operatorStakedSd := eth.WeiToEth(operatorSdCollateral) + metricsDetails.OperatorSDUtilized requireCollateral := collateralRatioInSd * float64(operatorNonTerminalKeys) collateralPct := 0.0 @@ -563,6 +577,10 @@ func CreateMetricsCache( metricsDetails.LockedEth = math.RoundDown(eth.WeiToEth(userData.LockedEth), SixDecimalRound) metricsDetails.HealthFactor = userData.HealthFactor + metricsDetails.OperatorSDUtilizationPosition = math.RoundDown(eth.WeiToEth(totalPosition), SixDecimalRound) + + metricsDetails.OperatorSDSelfBond = math.RoundDown(eth.WeiToEth(operatorSdCollateral), SixDecimalRound) + state.StaderNetworkDetails = metricsDetails state.logLine("Retrieved Stader Network Details (total time: %s)", time.Since(start)) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 3cc030e41..1b5c8aba2 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -212,5 +212,7 @@ func getNodeStatus(c *cli.Context) error { "The Utility Pool currently has a balance of %s.\n\n", eth.DisplayAmountInUnits(sdStatus.PoolAvailableSDBalance, "sd")) + fmt.Printf("Current Utilization Rate %s%s.\n", sdStatus.UtilizationRate.String(), "%") + return nil } diff --git a/stader/guardian/collector/constants.go b/stader/guardian/collector/constants.go index dd64691dd..3a27be0b7 100644 --- a/stader/guardian/collector/constants.go +++ b/stader/guardian/collector/constants.go @@ -34,6 +34,8 @@ const SDUtilizedInterest = "sd_utilized_interest" const SdCollateralPct = "sd_collateral_pct" const LockedEth = "eth_locked" const HeathFactor = "heath_factor" +const TotalSDUtilizationPosition = "sd_utility_position" +const TotalSDSelfBonded = "total_sd_self_bonded" // Node Health => stader_node_health+ key const NodeSub = "node_health" diff --git a/stader/guardian/collector/network-collector.go b/stader/guardian/collector/network-collector.go index 1f82b7d90..b7e6c5713 100644 --- a/stader/guardian/collector/network-collector.go +++ b/stader/guardian/collector/network-collector.go @@ -59,9 +59,14 @@ type NetworkCollector struct { // The min amount of sd value that can be staked to get rewards MinEthThreshold *prometheus.Desc - // The current balance of the SD utility pool + // The utilize amount + fee SdUtilityPoolBalance *prometheus.Desc + // + SDUtilizationPosition *prometheus.Desc + + SDSelfBond *prometheus.Desc + // The beacon client bc beacon.Client @@ -146,6 +151,14 @@ func NewNetworkCollector(bc beacon.Client, ec stader.ExecutionClient, nodeAddres "The current balance of the SD utility pool", nil, nil, ), + SDUtilizationPosition: prometheus.NewDesc(prometheus.BuildFQName(namespace, subsystem, "sd_utility_positon"), + "The current balance of the SD utility pool", + nil, nil, + ), + SDSelfBond: prometheus.NewDesc(prometheus.BuildFQName(namespace, subsystem, "sd_self_bond"), + "The current balance of the SD utility pool", + nil, nil, + ), bc: bc, ec: ec, nodeAddress: nodeAddress, @@ -172,6 +185,8 @@ func (collector *NetworkCollector) Describe(channel chan<- *prometheus.Desc) { channel <- collector.MinEthThreshold channel <- collector.MaxEthThreshold channel <- collector.SdUtilityPoolBalance + channel <- collector.SDUtilizationPosition + channel <- collector.SDSelfBond } // Collect the latest metric values and pass them to Prometheus @@ -212,6 +227,8 @@ func (collector *NetworkCollector) Collect(channel chan<- prometheus.Metric) { channel <- prometheus.MustNewConstMetric( collector.MaxEthThreshold, prometheus.GaugeValue, state.StaderNetworkDetails.MaxEthThreshold) channel <- prometheus.MustNewConstMetric(collector.SdUtilityPoolBalance, prometheus.GaugeValue, state.StaderNetworkDetails.SdUtilityPoolBalance) + channel <- prometheus.MustNewConstMetric(collector.SDUtilizationPosition, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorSDUtilizationPosition) + channel <- prometheus.MustNewConstMetric(collector.SDSelfBond, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorSDSelfBond) } // Log error messages diff --git a/stader/guardian/collector/operator-collector.go b/stader/guardian/collector/operator-collector.go index 64361d37c..4d7ebdf90 100644 --- a/stader/guardian/collector/operator-collector.go +++ b/stader/guardian/collector/operator-collector.go @@ -33,6 +33,8 @@ type OperatorCollector struct { TotalSdCollateral *prometheus.Desc TotalSdCollateralInEth *prometheus.Desc TotalEthColateral *prometheus.Desc + TotalSDUtilizationPosition *prometheus.Desc + TotalSDSelfBond *prometheus.Desc TotalSDUtilized *prometheus.Desc TotalSDUtilizedInterest *prometheus.Desc SdCollateralPct *prometheus.Desc @@ -127,6 +129,10 @@ func NewOperatorCollector( prometheus.BuildFQName(namespace, OperatorSub, LockedEth), "", nil, nil), HealthFactor: prometheus.NewDesc( prometheus.BuildFQName(namespace, OperatorSub, HeathFactor), "", nil, nil), + TotalSDUtilizationPosition: prometheus.NewDesc( + prometheus.BuildFQName(namespace, OperatorSub, TotalSDUtilizationPosition), "", nil, nil), + TotalSDSelfBond: prometheus.NewDesc( + prometheus.BuildFQName(namespace, OperatorSub, TotalSDSelfBonded), "", nil, nil), bc: bc, ec: ec, nodeAddress: nodeAddress, @@ -162,6 +168,8 @@ func (collector *OperatorCollector) Describe(channel chan<- *prometheus.Desc) { channel <- collector.SdCollateralPct channel <- collector.LockedEth channel <- collector.HealthFactor + channel <- collector.TotalSDUtilizationPosition + channel <- collector.TotalSDSelfBond } // Collect the latest metric values and pass them to Prometheus @@ -194,6 +202,8 @@ func (collector *OperatorCollector) Collect(channel chan<- prometheus.Metric) { channel <- prometheus.MustNewConstMetric(collector.SdCollateralPct, prometheus.GaugeValue, state.StaderNetworkDetails.SdCollateralPct) channel <- prometheus.MustNewConstMetric(collector.LockedEth, prometheus.GaugeValue, state.StaderNetworkDetails.LockedEth) channel <- prometheus.MustNewConstMetric(collector.HealthFactor, prometheus.GaugeValue, float64(state.StaderNetworkDetails.HealthFactor.Int64())) + channel <- prometheus.MustNewConstMetric(collector.TotalSDUtilizationPosition, prometheus.GaugeValue, float64(state.StaderNetworkDetails.OperatorSDUtilizationPosition)) + channel <- prometheus.MustNewConstMetric(collector.TotalSDSelfBond, prometheus.GaugeValue, float64(state.StaderNetworkDetails.OperatorSDSelfBond)) } // Log error messages diff --git a/stader/guardian/collector/state-locker.go b/stader/guardian/collector/state-locker.go index 6e79df23f..a332e06ff 100644 --- a/stader/guardian/collector/state-locker.go +++ b/stader/guardian/collector/state-locker.go @@ -54,16 +54,19 @@ func NewMetricsCacheContainer() *MetricsCacheContainer { CurrentStartBlock: big.NewInt(0), CurrentEndBlock: big.NewInt(0), }, - ValidatorStatusMap: make(map[types.ValidatorPubkey]beacon.ValidatorStatus), - ValidatorInfoMap: make(map[types.ValidatorPubkey]contracts.Validator), - CollateralRatio: 0, - CollateralRatioInSd: 0, - OperatorSDUtilized: 0, - OperatorSDInterest: 0, - SdCollateralPct: 0, - LockedEth: 0, - HealthFactor: big.NewInt(0), - StaderQueuedValidators: big.NewInt(0), + ValidatorStatusMap: make(map[types.ValidatorPubkey]beacon.ValidatorStatus), + ValidatorInfoMap: make(map[types.ValidatorPubkey]contracts.Validator), + CollateralRatio: 0, + CollateralRatioInSd: 0, + OperatorSDUtilized: 0, + OperatorSDInterest: 0, + OperatorSDUtilizationPosition: 0, + SdUtilityPoolBalance: 0, + OperatorSDSelfBond: 0, + SdCollateralPct: 0, + LockedEth: 0, + HealthFactor: big.NewInt(0), + StaderQueuedValidators: big.NewInt(0), }, }, } From 26e43764c9825cc76586ff43e974bad397f4117a Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Tue, 16 Jan 2024 12:00:06 +0530 Subject: [PATCH 139/159] minor fixes --- stader-cli/node/repay-sd.go | 9 ++++++--- stader-cli/node/status.go | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index 197192b5b..2143b55a7 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -125,9 +125,12 @@ func repaySD(c *cli.Context) error { return err } - remainUtilize := new(big.Int).Sub(sdStatus.SdUtilizerLatestBalance, amountWei) - fmt.Printf("Repayment of %s successful. Current Utilization Position: %s.\n", eth.DisplayAmountInUnits(amountWei, "sd"), eth.DisplayAmountInUnits(remainUtilize, "sd")) - + if amountWei.Cmp(maxUint256()) == 0 { + fmt.Printf("Repayment of %s successful. Current Utilization Position: 0 SD.\n", eth.DisplayAmountInUnits(sdStatus.SdUtilizerLatestBalance, "sd")) + } else { + remainUtilize := new(big.Int).Sub(sdStatus.SdUtilizerLatestBalance, amountWei) + fmt.Printf("Repayment of %s successful. Current Utilization Position: %s.\n", eth.DisplayAmountInUnits(amountWei, "sd"), eth.DisplayAmountInUnits(remainUtilize, "sd")) + } return nil } diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 1b5c8aba2..abd5bb419 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -202,7 +202,7 @@ func getNodeStatus(c *cli.Context) error { "Each Operator can utilize upto %s more.\nNote: The Operator can utilize a maximum of 1 ETH worth SD per validator.\n\n", eth.DisplayAmountInUnits(maxUtilizable, "sd")) - if sdStatus.SdUtilizedBalance.Cmp(big.NewInt(0)) == 0 { + if sdStatus.SdUtilizedBalance.Cmp(big.NewInt(0)) != 0 { fmt.Printf( "The Operator has a Health Factor of %s. \nNote: Please ensure your Health Factor is greater than 1 to avoid liquidations.\n\n", sdStatus.HealthFactor.String()) From 2a3732ec89205357a24b9f6e527c634a10aec438 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Tue, 16 Jan 2024 15:30:07 +0530 Subject: [PATCH 140/159] do not show repayment instructions if there is no utilized position --- stader-cli/node/status.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index abd5bb419..d6ec1e6a6 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -187,8 +187,13 @@ func getNodeStatus(c *cli.Context) error { fmt.Printf("The Operator has utilized %s from the Utility Pool.\n\n", eth.DisplayAmountInUnits(sdStatus.SdUtilizedBalance, "sd")) - fmt.Printf("The Operator has a current Utilization Position of %s. (including the utilization fee)\nNote: For repayment of your utilized SD, please use the `stader-cli node repay-sd ` command.\n\n", + fmt.Printf("The Operator has a current Utilization Position of %s. (including the utilization fee)\n", eth.DisplayAmountInUnits(sdStatus.SdUtilizerLatestBalance, "sd")) + if sdStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) == 0 { + fmt.Println("") + } else { + fmt.Printf("Note: For repayment of your utilized SD, please use the `stader-cli node repay-sd ` command.\n\n") + } maxUtilizable := new(big.Int).Sub(sdStatus.SdMaxUtilizableAmount, sdStatus.SdUtilizerLatestBalance) if maxUtilizable.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { From 9a5988540f9696ed62e4b6ff356fedf0f6d7032a Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 16 Jan 2024 17:48:36 +0700 Subject: [PATCH 141/159] Remove confirm on withdraw sd --- stader-cli/node/withdraw-sd.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index a005c4036..043b3c3c7 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -60,11 +60,6 @@ func WithdrawSd(c *cli.Context) error { fmt.Println("Cancelled.") return nil } - } else { - if !cliutils.Confirm(fmt.Sprintf("You have an existing Utilization Position of %s. The excess SD collateral you are trying to withdraw will be used to repay the utilized SD and the remaining SD will be sent to your Reward Address.\n Do you wish to proceed?", eth.DisplayAmountInUnits(sdStatusResponse.SDStatus.SdUtilizerLatestBalance, "sd"))) { - fmt.Println("Cancelled.") - return nil - } } // Assign max fees From 4eeecf5c88f62b0fc756d204d8bbc319fd646be1 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 16 Jan 2024 18:28:09 +0700 Subject: [PATCH 142/159] Check if had any validator --- stader-cli/node/utilize-sd.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index 2a2afd908..1a0c317b4 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -39,6 +39,11 @@ func utilizeSD(c *cli.Context) error { return err } + if sdStatusResponse.SDStatus.SdCollateralRequireAmount.Cmp(big.NewInt(0)) == 0 { + fmt.Printf("Please add a validator to your node first before utilizing SD from a Utility Pool. Execute the following command to add a validator to your node: stader-cli validator deposit --num-validators \n") + return nil + } + amountWei, err := PromptChooseUtilityAmount(sdStatusResponse.SDStatus) if err != nil { return err @@ -49,11 +54,6 @@ func utilizeSD(c *cli.Context) error { return err } - if canNodeUtilizeSdResponse.NonTerminalValidators == 0 { - fmt.Printf("Please add a validator to your node first before utilizing SD from a Utility Pool. Execute the following command to add a validator to your node: stader-cli validator deposit --num-validators \n") - return nil - } - err = gas.AssignMaxFeeAndLimit(canNodeUtilizeSdResponse.GasInfo, staderClient, c.Bool("yes")) if err != nil { return err @@ -116,9 +116,8 @@ func PromptChooseUtilityAmount(sdStatus *api.SdStatusResponse) (*big.Int, error) } // 2. If user had enough Eth - if minUtility.Cmp(maxUtility) > 0 { - msg := fmt.Sprintf("Do not had enough ETH bond to utility : %s \n", minUtility.String()) - + if minUtility.Cmp(maxUtility) >= 0 { + msg := fmt.Sprintf("Do not had enough ETH bond to utility\n") return nil, errors.New(msg) } From 04e383448f973e6314b3705dc97b4f9af67ff2a6 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 16 Jan 2024 19:42:27 +0700 Subject: [PATCH 143/159] Various number fixes --- shared/services/state/network-state.go | 4 ++-- stader-cli/node/status.go | 6 +++--- stader-cli/node/utilize-sd.go | 7 +++---- stader/guardian/collector/operator-collector.go | 2 +- stader/guardian/collector/state-locker.go | 2 +- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/shared/services/state/network-state.go b/shared/services/state/network-state.go index 230155f17..3ad016b69 100644 --- a/shared/services/state/network-state.go +++ b/shared/services/state/network-state.go @@ -137,7 +137,7 @@ type MetricDetails struct { LockedEth float64 // done - HealthFactor *big.Int + HealthFactor float64 } type MetricsCache struct { @@ -575,7 +575,7 @@ func CreateMetricsCache( metricsDetails.SdCollateralPct = collateralPct metricsDetails.LockedEth = math.RoundDown(eth.WeiToEth(userData.LockedEth), SixDecimalRound) - metricsDetails.HealthFactor = userData.HealthFactor + metricsDetails.HealthFactor = math.RoundDown(eth.WeiToEth(userData.HealthFactor), SixDecimalRound) metricsDetails.OperatorSDUtilizationPosition = math.RoundDown(eth.WeiToEth(totalPosition), SixDecimalRound) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index d6ec1e6a6..f26290ff5 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -151,7 +151,7 @@ func getNodeStatus(c *cli.Context) error { } collateralPct := 0.0 sdStatus := sdStatusResp.SDStatus - totalCollateral := new(big.Int).Add(sdStatus.SdCollateralCurrentAmount, sdStatus.SdUtilizerLatestBalance) + totalCollateral := new(big.Int).Add(sdStatus.SdCollateralCurrentAmount, sdStatus.SdUtilizedBalance) current := eth.WeiToEth(totalCollateral) require := eth.WeiToEth(sdStatus.SdCollateralRequireAmount) @@ -209,8 +209,8 @@ func getNodeStatus(c *cli.Context) error { if sdStatus.SdUtilizedBalance.Cmp(big.NewInt(0)) != 0 { fmt.Printf( - "The Operator has a Health Factor of %s. \nNote: Please ensure your Health Factor is greater than 1 to avoid liquidations.\n\n", - sdStatus.HealthFactor.String()) + "The Operator has a Health Factor of %.6f. \nNote: Please ensure your Health Factor is greater than 1 to avoid liquidations.\n\n", + eth.WeiToEth(sdStatus.HealthFactor)) } fmt.Printf( diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index 1a0c317b4..6f0798cb5 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -97,7 +97,7 @@ func GetMinUtility(sdStatus *api.SdStatusResponse) *big.Int { } func GetMaxUtility(sdStatus *api.SdStatusResponse) *big.Int { - maxUtility := new(big.Int).Sub(sdStatus.SdMaxUtilizableAmount, sdStatus.SdUtilizerLatestBalance) + maxUtility := new(big.Int).Sub(sdStatus.SdMaxUtilizableAmount, sdStatus.SdUtilizedBalance) if maxUtility.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { maxUtility = sdStatus.PoolAvailableSDBalance @@ -117,8 +117,7 @@ func PromptChooseUtilityAmount(sdStatus *api.SdStatusResponse) (*big.Int, error) // 2. If user had enough Eth if minUtility.Cmp(maxUtility) >= 0 { - msg := fmt.Sprintf("Do not had enough ETH bond to utility\n") - return nil, errors.New(msg) + return nil, errors.New("Do not had enough ETH bond to utility") } // Set maxSd to pool available @@ -147,7 +146,7 @@ Maximum utilization amount: %s func PromptChooseSelfBondAmount(sdStatus *api.SdStatusResponse) (*big.Int, error) { - totalCollateral := new(big.Int).Add(sdStatus.SdCollateralCurrentAmount, sdStatus.SdUtilizerLatestBalance) + totalCollateral := new(big.Int).Add(sdStatus.SdCollateralCurrentAmount, sdStatus.SdUtilizedBalance) amountToCollateralRemain := new(big.Int).Sub(sdStatus.SdCollateralRequireAmount, totalCollateral) diff --git a/stader/guardian/collector/operator-collector.go b/stader/guardian/collector/operator-collector.go index 4d7ebdf90..4269d9265 100644 --- a/stader/guardian/collector/operator-collector.go +++ b/stader/guardian/collector/operator-collector.go @@ -201,7 +201,7 @@ func (collector *OperatorCollector) Collect(channel chan<- prometheus.Metric) { channel <- prometheus.MustNewConstMetric(collector.TotalSDUtilizedInterest, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorSDInterest) channel <- prometheus.MustNewConstMetric(collector.SdCollateralPct, prometheus.GaugeValue, state.StaderNetworkDetails.SdCollateralPct) channel <- prometheus.MustNewConstMetric(collector.LockedEth, prometheus.GaugeValue, state.StaderNetworkDetails.LockedEth) - channel <- prometheus.MustNewConstMetric(collector.HealthFactor, prometheus.GaugeValue, float64(state.StaderNetworkDetails.HealthFactor.Int64())) + channel <- prometheus.MustNewConstMetric(collector.HealthFactor, prometheus.GaugeValue, state.StaderNetworkDetails.HealthFactor) channel <- prometheus.MustNewConstMetric(collector.TotalSDUtilizationPosition, prometheus.GaugeValue, float64(state.StaderNetworkDetails.OperatorSDUtilizationPosition)) channel <- prometheus.MustNewConstMetric(collector.TotalSDSelfBond, prometheus.GaugeValue, float64(state.StaderNetworkDetails.OperatorSDSelfBond)) } diff --git a/stader/guardian/collector/state-locker.go b/stader/guardian/collector/state-locker.go index a332e06ff..3cdc08791 100644 --- a/stader/guardian/collector/state-locker.go +++ b/stader/guardian/collector/state-locker.go @@ -65,7 +65,7 @@ func NewMetricsCacheContainer() *MetricsCacheContainer { OperatorSDSelfBond: 0, SdCollateralPct: 0, LockedEth: 0, - HealthFactor: big.NewInt(0), + HealthFactor: 0, StaderQueuedValidators: big.NewInt(0), }, }, From 7dd973efdfb9a8d8eeb8b86af59eebce4a26e5d1 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 16 Jan 2024 19:47:19 +0700 Subject: [PATCH 144/159] Update copies --- stader-cli/node/status.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index f26290ff5..324f13c89 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -204,7 +204,7 @@ func getNodeStatus(c *cli.Context) error { } fmt.Printf( - "Each Operator can utilize upto %s more.\nNote: The Operator can utilize a maximum of 1 ETH worth SD per validator.\n\n", + "The Operator can utilize upto %s more.\nNote: Each Operator can utilize a maximum of 1 ETH worth SD per validator.\n\n", eth.DisplayAmountInUnits(maxUtilizable, "sd")) if sdStatus.SdUtilizedBalance.Cmp(big.NewInt(0)) != 0 { From c8dc8b70fdcc166bd8d3a33ed9e13b1606418060 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 16 Jan 2024 21:04:16 +0700 Subject: [PATCH 145/159] Update maxUtilizable --- stader-cli/node/status.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 324f13c89..e3a4e7918 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -195,7 +195,7 @@ func getNodeStatus(c *cli.Context) error { fmt.Printf("Note: For repayment of your utilized SD, please use the `stader-cli node repay-sd ` command.\n\n") } - maxUtilizable := new(big.Int).Sub(sdStatus.SdMaxUtilizableAmount, sdStatus.SdUtilizerLatestBalance) + maxUtilizable := new(big.Int).Sub(sdStatus.SdMaxUtilizableAmount, sdStatus.SdUtilizedBalance) if maxUtilizable.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { maxUtilizable = sdStatus.PoolAvailableSDBalance } From 1bb8e44df756e22956b60dfbb8fe9de322e5e214 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Tue, 16 Jan 2024 22:05:25 +0530 Subject: [PATCH 146/159] use only one claim function --- stader/api/node/claim-rewards.go | 44 ++++++++++---------------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/stader/api/node/claim-rewards.go b/stader/api/node/claim-rewards.go index bccea548a..e06a85671 100644 --- a/stader/api/node/claim-rewards.go +++ b/stader/api/node/claim-rewards.go @@ -3,11 +3,9 @@ package node import ( "math/big" - "github.com/ethereum/go-ethereum/core/types" "github.com/stader-labs/stader-node/shared/services" "github.com/stader-labs/stader-node/shared/types/api" "github.com/stader-labs/stader-node/stader-lib/node" - "github.com/stader-labs/stader-node/stader-lib/stader" "github.com/urfave/cli" ) @@ -61,18 +59,10 @@ func CanClaimRewards(c *cli.Context) (*api.CanClaimRewards, error) { return nil, err } - var gasInfo stader.GasInfo - if operatorClaimVaultBalance.Cmp(withdrawableInEth) != 0 { - gasInfo, err = node.EstimateClaimOperatorRewardsWithAmount(orc, nodeAccount.Address, totalWithdrawableEth, opts) - if err != nil { - return nil, err - } - } else { - // estimate gas - gasInfo, err = node.EstimateClaimOperatorRewards(orc, opts) - if err != nil { - return nil, err - } + // estimate gas + gasInfo, err := node.EstimateClaimOperatorRewards(orc, opts) + if err != nil { + return nil, err } response.GasInfo = gasInfo @@ -134,25 +124,17 @@ func ClaimRewards(c *cli.Context) (*api.ClaimRewards, error) { return nil, err } + totalWithdrawableEth := operatorRewardsBalance + if operatorRewardsBalance.Cmp(withdrawableInEth) > 0 { + totalWithdrawableEth = withdrawableInEth + } + // estimate gas - var tx *types.Transaction - if operatorRewardsBalance.Cmp(withdrawableInEth) == 0 { - tx, err = node.ClaimOperatorRewards(orc, opts) - if err != nil { - return nil, err - } - response.RewardsClaimed = operatorRewardsBalance - } else { - totalWithdrawableEth := operatorRewardsBalance - if operatorRewardsBalance.Cmp(withdrawableInEth) > 0 { - totalWithdrawableEth = withdrawableInEth - } - tx, err = node.ClaimOperatorRewardsWithAmount(orc, nodeAccount.Address, totalWithdrawableEth, opts) - if err != nil { - return nil, err - } - response.RewardsClaimed = totalWithdrawableEth + tx, err := node.ClaimOperatorRewards(orc, opts) + if err != nil { + return nil, err } + response.RewardsClaimed = totalWithdrawableEth response.TxHash = tx.Hash() From 74fb129b59b6c6e40ecc45bfff1870d161316d62 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Wed, 17 Jan 2024 13:28:15 +0530 Subject: [PATCH 147/159] display withdrawable eth in claim vault instead of complete claim balance --- shared/types/api/node.go | 1 + stader-cli/node/status.go | 2 +- stader/api/node/status.go | 11 +++++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/shared/types/api/node.go b/shared/types/api/node.go index 0021356f3..357172086 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -35,6 +35,7 @@ type NodeStatusResponse struct { OperatorELRewardsAddress common.Address `json:"operatorELRewardsAddress"` OperatorELRewardsAddressBalance *big.Int `json:"operatorELRewardsAddressBalance"` OperatorRewardCollectorBalance *big.Int `json:"operatorRewardCollectorBalance"` + OperatorWithdrawableEth *big.Int `json:"operatorWithdrawableEth"` DepositedSdCollateral *big.Int `json:"depositedSdCollateral"` SdCollateralWorthValidators *big.Int `json:"sdCollateralWorthValidators"` Registered bool `json:"registered"` diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index e3a4e7918..19cac4262 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -116,7 +116,7 @@ func getNodeStatus(c *cli.Context) error { if status.OperatorRewardCollectorBalance.Cmp(big.NewInt(0)) > 0 { fmt.Printf( "The Operator has aggregated total claims of %s in the claim vault\n", - eth.DisplayAmountInUnits(status.OperatorRewardCollectorBalance, "eth")) + eth.DisplayAmountInUnits(status.OperatorWithdrawableEth, "eth")) fmt.Printf("To transfer the claims to your operator reward address use the %sstader-cli node claim-rewards%s command\n\n", log.ColorGreen, log.ColorReset) } diff --git a/stader/api/node/status.go b/stader/api/node/status.go index aaebd495e..b410a03a3 100644 --- a/stader/api/node/status.go +++ b/stader/api/node/status.go @@ -1,14 +1,15 @@ package node import ( + "math/big" + "time" + stader_backend "github.com/stader-labs/stader-node/shared/types/stader-backend" "github.com/stader-labs/stader-node/shared/utils/eth1" pool_utils "github.com/stader-labs/stader-node/stader-lib/pool-utils" socializing_pool "github.com/stader-labs/stader-node/stader-lib/socializing-pool" stader_config "github.com/stader-labs/stader-node/stader-lib/stader-config" "github.com/stader-labs/stader-node/stader-lib/types" - "math/big" - "time" "github.com/stader-labs/stader-node/shared/services" "github.com/stader-labs/stader-node/shared/types/api" @@ -187,6 +188,12 @@ func getStatus(c *cli.Context) (*api.NodeStatusResponse, error) { } response.OperatorRewardCollectorBalance = operatorRewardCollectorBalance + operatorWithdrawableEth, err := node.WithdrawableInEth(orc, nodeAccount.Address, nil) + if err != nil { + return nil, err + } + response.OperatorWithdrawableEth = operatorWithdrawableEth + //fmt.Printf("Getting operator reward address balance\n") operatorReward, err := tokens.GetEthBalance(pnr.Client, operatorRegistry.OperatorRewardAddress, nil) if err != nil { From a588f9c0c5fc56751af84dc9347f27b76ac88298 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Wed, 17 Jan 2024 20:50:21 +0700 Subject: [PATCH 148/159] WIP: c8dc8b70 Update maxUtilizable --- abis/SDUtilityPool.abi.json | 655 +----- shared/types/api/node.go | 1 + stader-cli/node/utilize-sd.go | 14 + stader-cli/validator/deposit.go | 14 + stader-lib/contracts/sd-utility.go | 3381 +++++++--------------------- stader-lib/sdutility/sd-utility.go | 11 + stader/api/validator/deposit.go | 6 + 7 files changed, 875 insertions(+), 3207 deletions(-) diff --git a/abis/SDUtilityPool.abi.json b/abis/SDUtilityPool.abi.json index 5cd338445..44f0e5c78 100644 --- a/abis/SDUtilityPool.abi.json +++ b/abis/SDUtilityPool.abi.json @@ -1,14 +1,4 @@ [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "AccrualBlockNumberNotLatest", - "type": "error" - }, { "inputs": [], "name": "AlreadyClaimed", @@ -24,16 +14,6 @@ "name": "CallerNotAuthorizedToRedeem", "type": "error" }, - { - "inputs": [], - "name": "CallerNotManager", - "type": "error" - }, - { - "inputs": [], - "name": "CallerNotStaderContract", - "type": "error" - }, { "inputs": [], "name": "CannotFindRequestId", @@ -102,7 +82,7 @@ }, { "inputs": [], - "name": "ZeroAddress", + "name": "UnHealthyPosition", "type": "error" }, { @@ -181,19 +161,6 @@ "name": "FinalizedWithdrawRequest", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -231,19 +198,6 @@ "name": "LiquidationCall", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Paused", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -351,81 +305,6 @@ "name": "RiskConfigUpdated", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -445,19 +324,6 @@ "name": "SDUtilized", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Unpaused", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -587,71 +453,6 @@ "name": "WithdrawnProtocolFee", "type": "event" }, - { - "inputs": [], - "name": "DECIMAL", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_PROTOCOL_FEE", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_UTILIZATION_RATE_PER_BLOCK", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "accrualBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "accrueFee", @@ -689,7 +490,7 @@ "inputs": [ { "internalType": "uint256", - "name": "_requestId", + "name": "requestId", "type": "uint256" } ], @@ -711,19 +512,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "conservativeEthPerKey", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -840,19 +628,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "finalizationBatchLimit", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "finalizeDelegatorWithdrawalRequest", @@ -922,7 +697,7 @@ "inputs": [ { "internalType": "address", - "name": "account", + "name": "", "type": "address" } ], @@ -969,25 +744,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "getOperatorTotalEth", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "getPoolAvailableSDBalance", @@ -1005,7 +761,7 @@ "inputs": [ { "internalType": "address", - "name": "_delegator", + "name": "_owner", "type": "address" } ], @@ -1020,25 +776,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -1058,7 +795,7 @@ }, { "internalType": "uint256", - "name": "totalCollateralInSD", + "name": "totalCollateralInEth", "type": "uint256" }, { @@ -1101,208 +838,51 @@ }, { "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, { "internalType": "address", "name": "account", "type": "address" } ], - "name": "grantRole", + "name": "liquidationCall", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, { "internalType": "address", - "name": "account", + "name": "", "type": "address" } ], - "name": "hasRole", + "name": "liquidationIndexByOperator", "outputs": [ { - "internalType": "bool", + "internalType": "uint256", "name": "", - "type": "bool" + "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { - "inputs": [ - { - "internalType": "address", - "name": "_admin", - "type": "address" - }, - { - "internalType": "address", - "name": "_staderConfig", - "type": "address" - } - ], - "name": "initialize", + "inputs": [], + "name": "maxApproveSD", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { - "inputs": [ + "inputs": [], + "name": "maxETHWorthOfSDPerValidator", + "outputs": [ { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "liquidationCall", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "liquidations", - "outputs": [ - { - "internalType": "uint256", - "name": "totalAmountInEth", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBonusInEth", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalFeeInEth", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isRepaid", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isClaimed", - "type": "bool" - }, - { - "internalType": "address", - "name": "liquidator", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxApproveSD", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "maxETHWorthOfSDPerValidator", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxNonRedeemedDelegatorRequestCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "minBlockDelayToFinalizeRequest", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "nextRequestId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "nextRequestIdToFinalize", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" + "internalType": "uint256", + "name": "", + "type": "uint256" } ], "stateMutability": "view", @@ -1321,37 +901,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "protocolFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -1364,12 +913,12 @@ "outputs": [ { "internalType": "uint256", - "name": "repaidAmount", + "name": "", "type": "uint256" }, { "internalType": "uint256", - "name": "feePaid", + "name": "", "type": "uint256" } ], @@ -1393,12 +942,12 @@ "outputs": [ { "internalType": "uint256", - "name": "repaidAmount", + "name": "", "type": "uint256" }, { "internalType": "uint256", - "name": "feePaid", + "name": "", "type": "uint256" } ], @@ -1433,7 +982,7 @@ "inputs": [ { "internalType": "uint256", - "name": "_cTokenAmount", + "name": "cTokenAmount", "type": "uint256" } ], @@ -1441,7 +990,7 @@ "outputs": [ { "internalType": "uint256", - "name": "_requestId", + "name": "", "type": "uint256" } ], @@ -1452,7 +1001,7 @@ "inputs": [ { "internalType": "uint256", - "name": "_sdAmount", + "name": "sdAmount", "type": "uint256" } ], @@ -1460,59 +1009,13 @@ "outputs": [ { "internalType": "uint256", - "name": "_requestId", + "name": "", "type": "uint256" } ], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "riskConfig", - "outputs": [ - { - "internalType": "uint256", - "name": "liquidationThreshold", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationBonusPercent", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationFeePercent", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "ltv", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "sdRequestedForWithdraw", @@ -1526,71 +1029,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "sdReservedForClaim", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "staderConfig", - "outputs": [ - { - "internalType": "contract IStaderConfig", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalUtilizedSD", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "unpause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -1669,34 +1107,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "liquidationThreshold", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationBonusPercent", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationFeePercent", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "ltv", - "type": "uint256" - } - ], - "name": "updateRiskConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -1749,19 +1159,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "utilizeIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { diff --git a/shared/types/api/node.go b/shared/types/api/node.go index 357172086..50f72ff29 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -459,6 +459,7 @@ type SdStatusResponse struct { HealthFactor *big.Int `json:"healthFactor"` AccumulatedInterest *big.Int `json:"accumulatedInterest"` NotEnoughSdCollateral bool `json:"notEnoughSdCollateral"` + AlreadyLiquidated bool `json:"alreadyLiquidated"` } type NodeRepayExcessSDResponse struct { diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index 6f0798cb5..2940b008d 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -39,6 +39,20 @@ func utilizeSD(c *cli.Context) error { return err } + if sdStatusResponse.SDStatus.AlreadyLiquidated { + fmt.Printf("Your node is in liquidation process") + return nil + } + + healthFactor := eth.WeiToEth(sdStatusResponse.SDStatus.HealthFactor) + if healthFactor < 1 { + fmt.Printf( + "The Operator has a Health Factor of %.6f. \nNote: Please ensure your Health Factor is greater than 1 to avoid liquidations.\n\n", + healthFactor) + + return nil + } + if sdStatusResponse.SDStatus.SdCollateralRequireAmount.Cmp(big.NewInt(0)) == 0 { fmt.Printf("Please add a validator to your node first before utilizing SD from a Utility Pool. Execute the following command to add a validator to your node: stader-cli validator deposit --num-validators \n") return nil diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index b8e01571c..e5b9152f8 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -63,6 +63,20 @@ func nodeDeposit(c *cli.Context) error { return err } + if sdStatusResp.SDStatus.AlreadyLiquidated { + fmt.Printf("Your node is in liquidation process") + return nil + } + + healthFactor := eth.WeiToEth(sdStatusResp.SDStatus.HealthFactor) + if healthFactor < 1 { + fmt.Printf( + "The Operator has a Health Factor of %.6f. \nNote: Please ensure your Health Factor is greater than 1 to avoid liquidations.\n\n", + healthFactor) + + return nil + } + userBalance := status.AccountBalances.ETH amountToSend := new(big.Int).Mul(eth.EthToWei(eth.BaseAmountInEth), big.NewInt(int64(numValidators))) diff --git a/stader-lib/contracts/sd-utility.go b/stader-lib/contracts/sd-utility.go index 825e21849..589d03fc9 100644 --- a/stader-lib/contracts/sd-utility.go +++ b/stader-lib/contracts/sd-utility.go @@ -41,15 +41,15 @@ type OperatorLiquidation struct { // UserData is an auto generated low-level Go binding around an user-defined struct. type UserData struct { - TotalInterestSD *big.Int - TotalCollateralInSD *big.Int - HealthFactor *big.Int - LockedEth *big.Int + TotalInterestSD *big.Int + TotalCollateralInEth *big.Int + HealthFactor *big.Int + LockedEth *big.Int } // SDUtilityPoolMetaData contains all meta data concerning the SDUtilityPool contract. var SDUtilityPoolMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AccrualBlockNumberNotLatest\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyClaimed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyLiquidated\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotAuthorizedToRedeem\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotManager\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotStaderContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotFindRequestId\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientPoolBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAmountOfWithdraw\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInput\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidWithdrawAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxLimitOnWithdrawRequestCountReached\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotClaimable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotLiquidatable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotLiquidator\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"RequestIdNotFinalized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDUtilizeLimitReached\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAccumulated\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalProtocolFee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalUtilizedSD\",\"type\":\"uint256\"}],\"name\":\"AccruedFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"CompleteLiquidation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXToMint\",\"type\":\"uint256\"}],\"name\":\"Delegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestIdToFinalize\",\"type\":\"uint256\"}],\"name\":\"FinalizedWithdrawRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalLiquidationAmountInEth\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationBonusInEth\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationFeeInEth\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"name\":\"LiquidationCall\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"protocolFeeFactor\",\"type\":\"uint256\"}],\"name\":\"ProtocolFeeFactorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXAmount\",\"type\":\"uint256\"}],\"name\":\"Redeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"Repaid\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdToTransfer\",\"type\":\"uint256\"}],\"name\":\"RequestRedeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationThreshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationBonusPercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationFeePercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ltv\",\"type\":\"uint256\"}],\"name\":\"RiskConfigUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"SDUtilized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"conservativeEthPerKey\",\"type\":\"uint256\"}],\"name\":\"UpdatedConservativeEthPerKey\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"finalizationBatchLimit\",\"type\":\"uint256\"}],\"name\":\"UpdatedFinalizationBatchLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxETHWorthOfSDPerValidator\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxETHWorthOfSDPerValidator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxNonRedeemedDelegatorRequestCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minBlockDelayToFinalizeRequest\",\"type\":\"uint256\"}],\"name\":\"UpdatedMinBlockDelayToFinalizeRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizationRatePerBlock\",\"type\":\"uint256\"}],\"name\":\"UtilizationRatePerBlockUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmountToWithdraw\",\"type\":\"uint256\"}],\"name\":\"WithdrawRequestReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"WithdrawnProtocolFee\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DECIMAL\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_PROTOCOL_FEE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_UTILIZATION_RATE_PER_BLOCK\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accrualBlockNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accrueFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accumulatedProtocolFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cTokenTotalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_requestId\",\"type\":\"uint256\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"completeLiquidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"conservativeEthPerKey\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"delegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"delegatorCTokenBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"delegatorWithdrawRequestedCTokenCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"delegatorWithdrawRequests\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountOfCToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdExpected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdFinalized\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finalizationBatchLimit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finalizeDelegatorWithdrawalRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDelegationRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_delegator\",\"type\":\"address\"}],\"name\":\"getDelegatorLatestSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLatestExchangeRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLiquidationThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getOperatorLiquidation\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"totalAmountInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalBonusInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalFeeInEth\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isRepaid\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"isClaimed\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"internalType\":\"structOperatorLiquidation\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"getOperatorTotalEth\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPoolAvailableSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_delegator\",\"type\":\"address\"}],\"name\":\"getRequestIdsByDelegator\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getUserData\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"totalInterestSD\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalCollateralInSD\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"healthFactor\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lockedEth\",\"type\":\"uint256\"}],\"internalType\":\"structUserData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_utilizer\",\"type\":\"address\"}],\"name\":\"getUtilizerLatestBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"liquidationCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"liquidations\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"totalAmountInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalBonusInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalFeeInEth\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isRepaid\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"isClaimed\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxApproveSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxETHWorthOfSDPerValidator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxNonRedeemedDelegatorRequestCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minBlockDelayToFinalizeRequest\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextRequestId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextRequestIdToFinalize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"poolUtilization\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"protocolFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repay\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"repaidAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feePaid\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repayOnBehalf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"repaidAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feePaid\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"requestIdsByDelegatorAddress\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_cTokenAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_requestId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_sdAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdrawWithSDAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_requestId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"riskConfig\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"liquidationThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"liquidationBonusPercent\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"liquidationFeePercent\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"ltv\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sdRequestedForWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sdReservedForClaim\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"staderConfig\",\"outputs\":[{\"internalType\":\"contractIStaderConfig\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalUtilizedSD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newEthPerKey\",\"type\":\"uint256\"}],\"name\":\"updateConservativeEthPerKey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_finalizationBatchLimit\",\"type\":\"uint256\"}],\"name\":\"updateFinalizationBatchLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxETHWorthOfSDPerValidator\",\"type\":\"uint256\"}],\"name\":\"updateMaxETHWorthOfSDPerValidator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"name\":\"updateMaxNonRedeemedDelegatorRequestCount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minBlockDelayToFinalizeRequest\",\"type\":\"uint256\"}],\"name\":\"updateMinBlockDelayToFinalizeRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_protocolFee\",\"type\":\"uint256\"}],\"name\":\"updateProtocolFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"liquidationThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"liquidationBonusPercent\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"liquidationFeePercent\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"ltv\",\"type\":\"uint256\"}],\"name\":\"updateRiskConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_utilizationRatePerBlock\",\"type\":\"uint256\"}],\"name\":\"updateUtilizationRatePerBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"utilizationRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"utilize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"utilizeIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonTerminalKeyCount\",\"type\":\"uint256\"}],\"name\":\"utilizeWhileAddingKeys\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"utilizerData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"principal\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"utilizeIndex\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdrawProtocolFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"name\":\"AlreadyClaimed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyLiquidated\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotAuthorizedToRedeem\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotFindRequestId\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientPoolBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAmountOfWithdraw\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInput\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidWithdrawAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxLimitOnWithdrawRequestCountReached\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotClaimable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotLiquidatable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotLiquidator\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"RequestIdNotFinalized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDUtilizeLimitReached\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnHealthyPosition\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAccumulated\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalProtocolFee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalUtilizedSD\",\"type\":\"uint256\"}],\"name\":\"AccruedFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"CompleteLiquidation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXToMint\",\"type\":\"uint256\"}],\"name\":\"Delegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestIdToFinalize\",\"type\":\"uint256\"}],\"name\":\"FinalizedWithdrawRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalLiquidationAmountInEth\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationBonusInEth\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationFeeInEth\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"name\":\"LiquidationCall\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"protocolFeeFactor\",\"type\":\"uint256\"}],\"name\":\"ProtocolFeeFactorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXAmount\",\"type\":\"uint256\"}],\"name\":\"Redeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"Repaid\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdToTransfer\",\"type\":\"uint256\"}],\"name\":\"RequestRedeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationThreshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationBonusPercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationFeePercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ltv\",\"type\":\"uint256\"}],\"name\":\"RiskConfigUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"SDUtilized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"conservativeEthPerKey\",\"type\":\"uint256\"}],\"name\":\"UpdatedConservativeEthPerKey\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"finalizationBatchLimit\",\"type\":\"uint256\"}],\"name\":\"UpdatedFinalizationBatchLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxETHWorthOfSDPerValidator\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxETHWorthOfSDPerValidator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxNonRedeemedDelegatorRequestCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minBlockDelayToFinalizeRequest\",\"type\":\"uint256\"}],\"name\":\"UpdatedMinBlockDelayToFinalizeRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizationRatePerBlock\",\"type\":\"uint256\"}],\"name\":\"UtilizationRatePerBlockUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmountToWithdraw\",\"type\":\"uint256\"}],\"name\":\"WithdrawRequestReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"WithdrawnProtocolFee\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"accrueFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accumulatedProtocolFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cTokenTotalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"completeLiquidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"delegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"delegatorCTokenBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"delegatorWithdrawRequestedCTokenCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"delegatorWithdrawRequests\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountOfCToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdExpected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdFinalized\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finalizeDelegatorWithdrawalRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDelegationRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_delegator\",\"type\":\"address\"}],\"name\":\"getDelegatorLatestSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLatestExchangeRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLiquidationThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"getOperatorLiquidation\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"totalAmountInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalBonusInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalFeeInEth\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isRepaid\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"isClaimed\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"internalType\":\"structOperatorLiquidation\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPoolAvailableSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"getRequestIdsByDelegator\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getUserData\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"totalInterestSD\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalCollateralInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"healthFactor\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lockedEth\",\"type\":\"uint256\"}],\"internalType\":\"structUserData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_utilizer\",\"type\":\"address\"}],\"name\":\"getUtilizerLatestBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"liquidationCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"liquidationIndexByOperator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxApproveSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxETHWorthOfSDPerValidator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"poolUtilization\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repay\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repayOnBehalf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"requestIdsByDelegatorAddress\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"cTokenAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdrawWithSDAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sdRequestedForWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newEthPerKey\",\"type\":\"uint256\"}],\"name\":\"updateConservativeEthPerKey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_finalizationBatchLimit\",\"type\":\"uint256\"}],\"name\":\"updateFinalizationBatchLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxETHWorthOfSDPerValidator\",\"type\":\"uint256\"}],\"name\":\"updateMaxETHWorthOfSDPerValidator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"name\":\"updateMaxNonRedeemedDelegatorRequestCount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minBlockDelayToFinalizeRequest\",\"type\":\"uint256\"}],\"name\":\"updateMinBlockDelayToFinalizeRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_protocolFee\",\"type\":\"uint256\"}],\"name\":\"updateProtocolFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_utilizationRatePerBlock\",\"type\":\"uint256\"}],\"name\":\"updateUtilizationRatePerBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"utilizationRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"utilize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonTerminalKeyCount\",\"type\":\"uint256\"}],\"name\":\"utilizeWhileAddingKeys\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"utilizerData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"principal\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"utilizeIndex\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdrawProtocolFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // SDUtilityPoolABI is the input ABI used to generate the binding from. @@ -198,161 +198,6 @@ func (_SDUtilityPool *SDUtilityPoolTransactorRaw) Transact(opts *bind.TransactOp return _SDUtilityPool.Contract.contract.Transact(opts, method, params...) } -// DECIMAL is a free data retrieval call binding the contract method 0x6ab55fd9. -// -// Solidity: function DECIMAL() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) DECIMAL(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "DECIMAL") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// DECIMAL is a free data retrieval call binding the contract method 0x6ab55fd9. -// -// Solidity: function DECIMAL() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) DECIMAL() (*big.Int, error) { - return _SDUtilityPool.Contract.DECIMAL(&_SDUtilityPool.CallOpts) -} - -// DECIMAL is a free data retrieval call binding the contract method 0x6ab55fd9. -// -// Solidity: function DECIMAL() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) DECIMAL() (*big.Int, error) { - return _SDUtilityPool.Contract.DECIMAL(&_SDUtilityPool.CallOpts) -} - -// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. -// -// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) -func (_SDUtilityPool *SDUtilityPoolCaller) DEFAULTADMINROLE(opts *bind.CallOpts) ([32]byte, error) { - var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "DEFAULT_ADMIN_ROLE") - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. -// -// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) -func (_SDUtilityPool *SDUtilityPoolSession) DEFAULTADMINROLE() ([32]byte, error) { - return _SDUtilityPool.Contract.DEFAULTADMINROLE(&_SDUtilityPool.CallOpts) -} - -// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. -// -// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) -func (_SDUtilityPool *SDUtilityPoolCallerSession) DEFAULTADMINROLE() ([32]byte, error) { - return _SDUtilityPool.Contract.DEFAULTADMINROLE(&_SDUtilityPool.CallOpts) -} - -// MAXPROTOCOLFEE is a free data retrieval call binding the contract method 0xb8ca3b83. -// -// Solidity: function MAX_PROTOCOL_FEE() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) MAXPROTOCOLFEE(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "MAX_PROTOCOL_FEE") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// MAXPROTOCOLFEE is a free data retrieval call binding the contract method 0xb8ca3b83. -// -// Solidity: function MAX_PROTOCOL_FEE() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) MAXPROTOCOLFEE() (*big.Int, error) { - return _SDUtilityPool.Contract.MAXPROTOCOLFEE(&_SDUtilityPool.CallOpts) -} - -// MAXPROTOCOLFEE is a free data retrieval call binding the contract method 0xb8ca3b83. -// -// Solidity: function MAX_PROTOCOL_FEE() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) MAXPROTOCOLFEE() (*big.Int, error) { - return _SDUtilityPool.Contract.MAXPROTOCOLFEE(&_SDUtilityPool.CallOpts) -} - -// MAXUTILIZATIONRATEPERBLOCK is a free data retrieval call binding the contract method 0x4e7878ee. -// -// Solidity: function MAX_UTILIZATION_RATE_PER_BLOCK() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) MAXUTILIZATIONRATEPERBLOCK(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "MAX_UTILIZATION_RATE_PER_BLOCK") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// MAXUTILIZATIONRATEPERBLOCK is a free data retrieval call binding the contract method 0x4e7878ee. -// -// Solidity: function MAX_UTILIZATION_RATE_PER_BLOCK() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) MAXUTILIZATIONRATEPERBLOCK() (*big.Int, error) { - return _SDUtilityPool.Contract.MAXUTILIZATIONRATEPERBLOCK(&_SDUtilityPool.CallOpts) -} - -// MAXUTILIZATIONRATEPERBLOCK is a free data retrieval call binding the contract method 0x4e7878ee. -// -// Solidity: function MAX_UTILIZATION_RATE_PER_BLOCK() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) MAXUTILIZATIONRATEPERBLOCK() (*big.Int, error) { - return _SDUtilityPool.Contract.MAXUTILIZATIONRATEPERBLOCK(&_SDUtilityPool.CallOpts) -} - -// AccrualBlockNumber is a free data retrieval call binding the contract method 0x6c540baf. -// -// Solidity: function accrualBlockNumber() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) AccrualBlockNumber(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "accrualBlockNumber") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// AccrualBlockNumber is a free data retrieval call binding the contract method 0x6c540baf. -// -// Solidity: function accrualBlockNumber() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) AccrualBlockNumber() (*big.Int, error) { - return _SDUtilityPool.Contract.AccrualBlockNumber(&_SDUtilityPool.CallOpts) -} - -// AccrualBlockNumber is a free data retrieval call binding the contract method 0x6c540baf. -// -// Solidity: function accrualBlockNumber() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) AccrualBlockNumber() (*big.Int, error) { - return _SDUtilityPool.Contract.AccrualBlockNumber(&_SDUtilityPool.CallOpts) -} - // AccumulatedProtocolFee is a free data retrieval call binding the contract method 0xa544a62c. // // Solidity: function accumulatedProtocolFee() view returns(uint256) @@ -415,37 +260,6 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) CTokenTotalSupply() (*big.Int, return _SDUtilityPool.Contract.CTokenTotalSupply(&_SDUtilityPool.CallOpts) } -// ConservativeEthPerKey is a free data retrieval call binding the contract method 0x232d70c3. -// -// Solidity: function conservativeEthPerKey() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) ConservativeEthPerKey(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "conservativeEthPerKey") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// ConservativeEthPerKey is a free data retrieval call binding the contract method 0x232d70c3. -// -// Solidity: function conservativeEthPerKey() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) ConservativeEthPerKey() (*big.Int, error) { - return _SDUtilityPool.Contract.ConservativeEthPerKey(&_SDUtilityPool.CallOpts) -} - -// ConservativeEthPerKey is a free data retrieval call binding the contract method 0x232d70c3. -// -// Solidity: function conservativeEthPerKey() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) ConservativeEthPerKey() (*big.Int, error) { - return _SDUtilityPool.Contract.ConservativeEthPerKey(&_SDUtilityPool.CallOpts) -} - // DelegatorCTokenBalance is a free data retrieval call binding the contract method 0xabf9db02. // // Solidity: function delegatorCTokenBalance(address ) view returns(uint256) @@ -599,37 +413,6 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) ExchangeRateStored() (*big.Int return _SDUtilityPool.Contract.ExchangeRateStored(&_SDUtilityPool.CallOpts) } -// FinalizationBatchLimit is a free data retrieval call binding the contract method 0x6f2bd0b2. -// -// Solidity: function finalizationBatchLimit() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) FinalizationBatchLimit(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "finalizationBatchLimit") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// FinalizationBatchLimit is a free data retrieval call binding the contract method 0x6f2bd0b2. -// -// Solidity: function finalizationBatchLimit() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) FinalizationBatchLimit() (*big.Int, error) { - return _SDUtilityPool.Contract.FinalizationBatchLimit(&_SDUtilityPool.CallOpts) -} - -// FinalizationBatchLimit is a free data retrieval call binding the contract method 0x6f2bd0b2. -// -// Solidity: function finalizationBatchLimit() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) FinalizationBatchLimit() (*big.Int, error) { - return _SDUtilityPool.Contract.FinalizationBatchLimit(&_SDUtilityPool.CallOpts) -} - // GetDelegationRatePerBlock is a free data retrieval call binding the contract method 0x6d00679c. // // Solidity: function getDelegationRatePerBlock() view returns(uint256) @@ -756,10 +539,10 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) GetLiquidationThreshold() (*bi // GetOperatorLiquidation is a free data retrieval call binding the contract method 0x12372ffe. // -// Solidity: function getOperatorLiquidation(address account) view returns((uint256,uint256,uint256,bool,bool,address)) -func (_SDUtilityPool *SDUtilityPoolCaller) GetOperatorLiquidation(opts *bind.CallOpts, account common.Address) (OperatorLiquidation, error) { +// Solidity: function getOperatorLiquidation(address ) view returns((uint256,uint256,uint256,bool,bool,address)) +func (_SDUtilityPool *SDUtilityPoolCaller) GetOperatorLiquidation(opts *bind.CallOpts, arg0 common.Address) (OperatorLiquidation, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "getOperatorLiquidation", account) + err := _SDUtilityPool.contract.Call(opts, &out, "getOperatorLiquidation", arg0) if err != nil { return *new(OperatorLiquidation), err @@ -773,47 +556,16 @@ func (_SDUtilityPool *SDUtilityPoolCaller) GetOperatorLiquidation(opts *bind.Cal // GetOperatorLiquidation is a free data retrieval call binding the contract method 0x12372ffe. // -// Solidity: function getOperatorLiquidation(address account) view returns((uint256,uint256,uint256,bool,bool,address)) -func (_SDUtilityPool *SDUtilityPoolSession) GetOperatorLiquidation(account common.Address) (OperatorLiquidation, error) { - return _SDUtilityPool.Contract.GetOperatorLiquidation(&_SDUtilityPool.CallOpts, account) +// Solidity: function getOperatorLiquidation(address ) view returns((uint256,uint256,uint256,bool,bool,address)) +func (_SDUtilityPool *SDUtilityPoolSession) GetOperatorLiquidation(arg0 common.Address) (OperatorLiquidation, error) { + return _SDUtilityPool.Contract.GetOperatorLiquidation(&_SDUtilityPool.CallOpts, arg0) } // GetOperatorLiquidation is a free data retrieval call binding the contract method 0x12372ffe. // -// Solidity: function getOperatorLiquidation(address account) view returns((uint256,uint256,uint256,bool,bool,address)) -func (_SDUtilityPool *SDUtilityPoolCallerSession) GetOperatorLiquidation(account common.Address) (OperatorLiquidation, error) { - return _SDUtilityPool.Contract.GetOperatorLiquidation(&_SDUtilityPool.CallOpts, account) -} - -// GetOperatorTotalEth is a free data retrieval call binding the contract method 0x2170c14c. -// -// Solidity: function getOperatorTotalEth(address operator) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) GetOperatorTotalEth(opts *bind.CallOpts, operator common.Address) (*big.Int, error) { - var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "getOperatorTotalEth", operator) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetOperatorTotalEth is a free data retrieval call binding the contract method 0x2170c14c. -// -// Solidity: function getOperatorTotalEth(address operator) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) GetOperatorTotalEth(operator common.Address) (*big.Int, error) { - return _SDUtilityPool.Contract.GetOperatorTotalEth(&_SDUtilityPool.CallOpts, operator) -} - -// GetOperatorTotalEth is a free data retrieval call binding the contract method 0x2170c14c. -// -// Solidity: function getOperatorTotalEth(address operator) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) GetOperatorTotalEth(operator common.Address) (*big.Int, error) { - return _SDUtilityPool.Contract.GetOperatorTotalEth(&_SDUtilityPool.CallOpts, operator) +// Solidity: function getOperatorLiquidation(address ) view returns((uint256,uint256,uint256,bool,bool,address)) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetOperatorLiquidation(arg0 common.Address) (OperatorLiquidation, error) { + return _SDUtilityPool.Contract.GetOperatorLiquidation(&_SDUtilityPool.CallOpts, arg0) } // GetPoolAvailableSDBalance is a free data retrieval call binding the contract method 0xda695857. @@ -849,10 +601,10 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) GetPoolAvailableSDBalance() (* // GetRequestIdsByDelegator is a free data retrieval call binding the contract method 0x99775f40. // -// Solidity: function getRequestIdsByDelegator(address _delegator) view returns(uint256[]) -func (_SDUtilityPool *SDUtilityPoolCaller) GetRequestIdsByDelegator(opts *bind.CallOpts, _delegator common.Address) ([]*big.Int, error) { +// Solidity: function getRequestIdsByDelegator(address _owner) view returns(uint256[]) +func (_SDUtilityPool *SDUtilityPoolCaller) GetRequestIdsByDelegator(opts *bind.CallOpts, _owner common.Address) ([]*big.Int, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "getRequestIdsByDelegator", _delegator) + err := _SDUtilityPool.contract.Call(opts, &out, "getRequestIdsByDelegator", _owner) if err != nil { return *new([]*big.Int), err @@ -866,47 +618,16 @@ func (_SDUtilityPool *SDUtilityPoolCaller) GetRequestIdsByDelegator(opts *bind.C // GetRequestIdsByDelegator is a free data retrieval call binding the contract method 0x99775f40. // -// Solidity: function getRequestIdsByDelegator(address _delegator) view returns(uint256[]) -func (_SDUtilityPool *SDUtilityPoolSession) GetRequestIdsByDelegator(_delegator common.Address) ([]*big.Int, error) { - return _SDUtilityPool.Contract.GetRequestIdsByDelegator(&_SDUtilityPool.CallOpts, _delegator) +// Solidity: function getRequestIdsByDelegator(address _owner) view returns(uint256[]) +func (_SDUtilityPool *SDUtilityPoolSession) GetRequestIdsByDelegator(_owner common.Address) ([]*big.Int, error) { + return _SDUtilityPool.Contract.GetRequestIdsByDelegator(&_SDUtilityPool.CallOpts, _owner) } // GetRequestIdsByDelegator is a free data retrieval call binding the contract method 0x99775f40. // -// Solidity: function getRequestIdsByDelegator(address _delegator) view returns(uint256[]) -func (_SDUtilityPool *SDUtilityPoolCallerSession) GetRequestIdsByDelegator(_delegator common.Address) ([]*big.Int, error) { - return _SDUtilityPool.Contract.GetRequestIdsByDelegator(&_SDUtilityPool.CallOpts, _delegator) -} - -// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. -// -// Solidity: function getRoleAdmin(bytes32 role) view returns(bytes32) -func (_SDUtilityPool *SDUtilityPoolCaller) GetRoleAdmin(opts *bind.CallOpts, role [32]byte) ([32]byte, error) { - var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "getRoleAdmin", role) - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. -// -// Solidity: function getRoleAdmin(bytes32 role) view returns(bytes32) -func (_SDUtilityPool *SDUtilityPoolSession) GetRoleAdmin(role [32]byte) ([32]byte, error) { - return _SDUtilityPool.Contract.GetRoleAdmin(&_SDUtilityPool.CallOpts, role) -} - -// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. -// -// Solidity: function getRoleAdmin(bytes32 role) view returns(bytes32) -func (_SDUtilityPool *SDUtilityPoolCallerSession) GetRoleAdmin(role [32]byte) ([32]byte, error) { - return _SDUtilityPool.Contract.GetRoleAdmin(&_SDUtilityPool.CallOpts, role) +// Solidity: function getRequestIdsByDelegator(address _owner) view returns(uint256[]) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetRequestIdsByDelegator(_owner common.Address) ([]*big.Int, error) { + return _SDUtilityPool.Contract.GetRequestIdsByDelegator(&_SDUtilityPool.CallOpts, _owner) } // GetUserData is a free data retrieval call binding the contract method 0xffc9896b. @@ -971,100 +692,35 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) GetUtilizerLatestBalance(_util return _SDUtilityPool.Contract.GetUtilizerLatestBalance(&_SDUtilityPool.CallOpts, _utilizer) } -// HasRole is a free data retrieval call binding the contract method 0x91d14854. +// LiquidationIndexByOperator is a free data retrieval call binding the contract method 0x673ab3fa. // -// Solidity: function hasRole(bytes32 role, address account) view returns(bool) -func (_SDUtilityPool *SDUtilityPoolCaller) HasRole(opts *bind.CallOpts, role [32]byte, account common.Address) (bool, error) { +// Solidity: function liquidationIndexByOperator(address ) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) LiquidationIndexByOperator(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "hasRole", role, account) + err := _SDUtilityPool.contract.Call(opts, &out, "liquidationIndexByOperator", arg0) if err != nil { - return *new(bool), err + return *new(*big.Int), err } - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) return out0, err } -// HasRole is a free data retrieval call binding the contract method 0x91d14854. -// -// Solidity: function hasRole(bytes32 role, address account) view returns(bool) -func (_SDUtilityPool *SDUtilityPoolSession) HasRole(role [32]byte, account common.Address) (bool, error) { - return _SDUtilityPool.Contract.HasRole(&_SDUtilityPool.CallOpts, role, account) -} - -// HasRole is a free data retrieval call binding the contract method 0x91d14854. -// -// Solidity: function hasRole(bytes32 role, address account) view returns(bool) -func (_SDUtilityPool *SDUtilityPoolCallerSession) HasRole(role [32]byte, account common.Address) (bool, error) { - return _SDUtilityPool.Contract.HasRole(&_SDUtilityPool.CallOpts, role, account) -} - -// Liquidations is a free data retrieval call binding the contract method 0xa66c84f4. -// -// Solidity: function liquidations(uint256 ) view returns(uint256 totalAmountInEth, uint256 totalBonusInEth, uint256 totalFeeInEth, bool isRepaid, bool isClaimed, address liquidator) -func (_SDUtilityPool *SDUtilityPoolCaller) Liquidations(opts *bind.CallOpts, arg0 *big.Int) (struct { - TotalAmountInEth *big.Int - TotalBonusInEth *big.Int - TotalFeeInEth *big.Int - IsRepaid bool - IsClaimed bool - Liquidator common.Address -}, error) { - var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "liquidations", arg0) - - outstruct := new(struct { - TotalAmountInEth *big.Int - TotalBonusInEth *big.Int - TotalFeeInEth *big.Int - IsRepaid bool - IsClaimed bool - Liquidator common.Address - }) - if err != nil { - return *outstruct, err - } - - outstruct.TotalAmountInEth = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - outstruct.TotalBonusInEth = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - outstruct.TotalFeeInEth = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) - outstruct.IsRepaid = *abi.ConvertType(out[3], new(bool)).(*bool) - outstruct.IsClaimed = *abi.ConvertType(out[4], new(bool)).(*bool) - outstruct.Liquidator = *abi.ConvertType(out[5], new(common.Address)).(*common.Address) - - return *outstruct, err - -} - -// Liquidations is a free data retrieval call binding the contract method 0xa66c84f4. +// LiquidationIndexByOperator is a free data retrieval call binding the contract method 0x673ab3fa. // -// Solidity: function liquidations(uint256 ) view returns(uint256 totalAmountInEth, uint256 totalBonusInEth, uint256 totalFeeInEth, bool isRepaid, bool isClaimed, address liquidator) -func (_SDUtilityPool *SDUtilityPoolSession) Liquidations(arg0 *big.Int) (struct { - TotalAmountInEth *big.Int - TotalBonusInEth *big.Int - TotalFeeInEth *big.Int - IsRepaid bool - IsClaimed bool - Liquidator common.Address -}, error) { - return _SDUtilityPool.Contract.Liquidations(&_SDUtilityPool.CallOpts, arg0) +// Solidity: function liquidationIndexByOperator(address ) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) LiquidationIndexByOperator(arg0 common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.LiquidationIndexByOperator(&_SDUtilityPool.CallOpts, arg0) } -// Liquidations is a free data retrieval call binding the contract method 0xa66c84f4. +// LiquidationIndexByOperator is a free data retrieval call binding the contract method 0x673ab3fa. // -// Solidity: function liquidations(uint256 ) view returns(uint256 totalAmountInEth, uint256 totalBonusInEth, uint256 totalFeeInEth, bool isRepaid, bool isClaimed, address liquidator) -func (_SDUtilityPool *SDUtilityPoolCallerSession) Liquidations(arg0 *big.Int) (struct { - TotalAmountInEth *big.Int - TotalBonusInEth *big.Int - TotalFeeInEth *big.Int - IsRepaid bool - IsClaimed bool - Liquidator common.Address -}, error) { - return _SDUtilityPool.Contract.Liquidations(&_SDUtilityPool.CallOpts, arg0) +// Solidity: function liquidationIndexByOperator(address ) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) LiquidationIndexByOperator(arg0 common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.LiquidationIndexByOperator(&_SDUtilityPool.CallOpts, arg0) } // MaxETHWorthOfSDPerValidator is a free data retrieval call binding the contract method 0x2807c313. @@ -1098,12 +754,12 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) MaxETHWorthOfSDPerValidator() return _SDUtilityPool.Contract.MaxETHWorthOfSDPerValidator(&_SDUtilityPool.CallOpts) } -// MaxNonRedeemedDelegatorRequestCount is a free data retrieval call binding the contract method 0xc083f3e6. +// PoolUtilization is a free data retrieval call binding the contract method 0x9a3263ee. // -// Solidity: function maxNonRedeemedDelegatorRequestCount() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) MaxNonRedeemedDelegatorRequestCount(opts *bind.CallOpts) (*big.Int, error) { +// Solidity: function poolUtilization() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) PoolUtilization(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "maxNonRedeemedDelegatorRequestCount") + err := _SDUtilityPool.contract.Call(opts, &out, "poolUtilization") if err != nil { return *new(*big.Int), err @@ -1115,26 +771,26 @@ func (_SDUtilityPool *SDUtilityPoolCaller) MaxNonRedeemedDelegatorRequestCount(o } -// MaxNonRedeemedDelegatorRequestCount is a free data retrieval call binding the contract method 0xc083f3e6. +// PoolUtilization is a free data retrieval call binding the contract method 0x9a3263ee. // -// Solidity: function maxNonRedeemedDelegatorRequestCount() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) MaxNonRedeemedDelegatorRequestCount() (*big.Int, error) { - return _SDUtilityPool.Contract.MaxNonRedeemedDelegatorRequestCount(&_SDUtilityPool.CallOpts) +// Solidity: function poolUtilization() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) PoolUtilization() (*big.Int, error) { + return _SDUtilityPool.Contract.PoolUtilization(&_SDUtilityPool.CallOpts) } -// MaxNonRedeemedDelegatorRequestCount is a free data retrieval call binding the contract method 0xc083f3e6. +// PoolUtilization is a free data retrieval call binding the contract method 0x9a3263ee. // -// Solidity: function maxNonRedeemedDelegatorRequestCount() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) MaxNonRedeemedDelegatorRequestCount() (*big.Int, error) { - return _SDUtilityPool.Contract.MaxNonRedeemedDelegatorRequestCount(&_SDUtilityPool.CallOpts) +// Solidity: function poolUtilization() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) PoolUtilization() (*big.Int, error) { + return _SDUtilityPool.Contract.PoolUtilization(&_SDUtilityPool.CallOpts) } -// MinBlockDelayToFinalizeRequest is a free data retrieval call binding the contract method 0xbc1428f6. +// RequestIdsByDelegatorAddress is a free data retrieval call binding the contract method 0x7844e3af. // -// Solidity: function minBlockDelayToFinalizeRequest() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) MinBlockDelayToFinalizeRequest(opts *bind.CallOpts) (*big.Int, error) { +// Solidity: function requestIdsByDelegatorAddress(address , uint256 ) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) RequestIdsByDelegatorAddress(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (*big.Int, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "minBlockDelayToFinalizeRequest") + err := _SDUtilityPool.contract.Call(opts, &out, "requestIdsByDelegatorAddress", arg0, arg1) if err != nil { return *new(*big.Int), err @@ -1146,26 +802,26 @@ func (_SDUtilityPool *SDUtilityPoolCaller) MinBlockDelayToFinalizeRequest(opts * } -// MinBlockDelayToFinalizeRequest is a free data retrieval call binding the contract method 0xbc1428f6. +// RequestIdsByDelegatorAddress is a free data retrieval call binding the contract method 0x7844e3af. // -// Solidity: function minBlockDelayToFinalizeRequest() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) MinBlockDelayToFinalizeRequest() (*big.Int, error) { - return _SDUtilityPool.Contract.MinBlockDelayToFinalizeRequest(&_SDUtilityPool.CallOpts) +// Solidity: function requestIdsByDelegatorAddress(address , uint256 ) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) RequestIdsByDelegatorAddress(arg0 common.Address, arg1 *big.Int) (*big.Int, error) { + return _SDUtilityPool.Contract.RequestIdsByDelegatorAddress(&_SDUtilityPool.CallOpts, arg0, arg1) } -// MinBlockDelayToFinalizeRequest is a free data retrieval call binding the contract method 0xbc1428f6. +// RequestIdsByDelegatorAddress is a free data retrieval call binding the contract method 0x7844e3af. // -// Solidity: function minBlockDelayToFinalizeRequest() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) MinBlockDelayToFinalizeRequest() (*big.Int, error) { - return _SDUtilityPool.Contract.MinBlockDelayToFinalizeRequest(&_SDUtilityPool.CallOpts) +// Solidity: function requestIdsByDelegatorAddress(address , uint256 ) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) RequestIdsByDelegatorAddress(arg0 common.Address, arg1 *big.Int) (*big.Int, error) { + return _SDUtilityPool.Contract.RequestIdsByDelegatorAddress(&_SDUtilityPool.CallOpts, arg0, arg1) } -// NextRequestId is a free data retrieval call binding the contract method 0x6a84a985. +// SdRequestedForWithdraw is a free data retrieval call binding the contract method 0x3b92e3cf. // -// Solidity: function nextRequestId() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) NextRequestId(opts *bind.CallOpts) (*big.Int, error) { +// Solidity: function sdRequestedForWithdraw() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) SdRequestedForWithdraw(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "nextRequestId") + err := _SDUtilityPool.contract.Call(opts, &out, "sdRequestedForWithdraw") if err != nil { return *new(*big.Int), err @@ -1177,26 +833,26 @@ func (_SDUtilityPool *SDUtilityPoolCaller) NextRequestId(opts *bind.CallOpts) (* } -// NextRequestId is a free data retrieval call binding the contract method 0x6a84a985. +// SdRequestedForWithdraw is a free data retrieval call binding the contract method 0x3b92e3cf. // -// Solidity: function nextRequestId() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) NextRequestId() (*big.Int, error) { - return _SDUtilityPool.Contract.NextRequestId(&_SDUtilityPool.CallOpts) +// Solidity: function sdRequestedForWithdraw() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) SdRequestedForWithdraw() (*big.Int, error) { + return _SDUtilityPool.Contract.SdRequestedForWithdraw(&_SDUtilityPool.CallOpts) } -// NextRequestId is a free data retrieval call binding the contract method 0x6a84a985. +// SdRequestedForWithdraw is a free data retrieval call binding the contract method 0x3b92e3cf. // -// Solidity: function nextRequestId() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) NextRequestId() (*big.Int, error) { - return _SDUtilityPool.Contract.NextRequestId(&_SDUtilityPool.CallOpts) +// Solidity: function sdRequestedForWithdraw() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) SdRequestedForWithdraw() (*big.Int, error) { + return _SDUtilityPool.Contract.SdRequestedForWithdraw(&_SDUtilityPool.CallOpts) } -// NextRequestIdToFinalize is a free data retrieval call binding the contract method 0xbbb84362. +// UtilizationRatePerBlock is a free data retrieval call binding the contract method 0x962c7070. // -// Solidity: function nextRequestIdToFinalize() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) NextRequestIdToFinalize(opts *bind.CallOpts) (*big.Int, error) { +// Solidity: function utilizationRatePerBlock() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) UtilizationRatePerBlock(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "nextRequestIdToFinalize") + err := _SDUtilityPool.contract.Call(opts, &out, "utilizationRatePerBlock") if err != nil { return *new(*big.Int), err @@ -1208,57 +864,26 @@ func (_SDUtilityPool *SDUtilityPoolCaller) NextRequestIdToFinalize(opts *bind.Ca } -// NextRequestIdToFinalize is a free data retrieval call binding the contract method 0xbbb84362. +// UtilizationRatePerBlock is a free data retrieval call binding the contract method 0x962c7070. // -// Solidity: function nextRequestIdToFinalize() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) NextRequestIdToFinalize() (*big.Int, error) { - return _SDUtilityPool.Contract.NextRequestIdToFinalize(&_SDUtilityPool.CallOpts) +// Solidity: function utilizationRatePerBlock() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) UtilizationRatePerBlock() (*big.Int, error) { + return _SDUtilityPool.Contract.UtilizationRatePerBlock(&_SDUtilityPool.CallOpts) } -// NextRequestIdToFinalize is a free data retrieval call binding the contract method 0xbbb84362. +// UtilizationRatePerBlock is a free data retrieval call binding the contract method 0x962c7070. // -// Solidity: function nextRequestIdToFinalize() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) NextRequestIdToFinalize() (*big.Int, error) { - return _SDUtilityPool.Contract.NextRequestIdToFinalize(&_SDUtilityPool.CallOpts) -} - -// Paused is a free data retrieval call binding the contract method 0x5c975abb. -// -// Solidity: function paused() view returns(bool) -func (_SDUtilityPool *SDUtilityPoolCaller) Paused(opts *bind.CallOpts) (bool, error) { - var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "paused") - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// Paused is a free data retrieval call binding the contract method 0x5c975abb. -// -// Solidity: function paused() view returns(bool) -func (_SDUtilityPool *SDUtilityPoolSession) Paused() (bool, error) { - return _SDUtilityPool.Contract.Paused(&_SDUtilityPool.CallOpts) -} - -// Paused is a free data retrieval call binding the contract method 0x5c975abb. -// -// Solidity: function paused() view returns(bool) -func (_SDUtilityPool *SDUtilityPoolCallerSession) Paused() (bool, error) { - return _SDUtilityPool.Contract.Paused(&_SDUtilityPool.CallOpts) +// Solidity: function utilizationRatePerBlock() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizationRatePerBlock() (*big.Int, error) { + return _SDUtilityPool.Contract.UtilizationRatePerBlock(&_SDUtilityPool.CallOpts) } -// PoolUtilization is a free data retrieval call binding the contract method 0x9a3263ee. +// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. // -// Solidity: function poolUtilization() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) PoolUtilization(opts *bind.CallOpts) (*big.Int, error) { +// Solidity: function utilizerBalanceStored(address account) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) UtilizerBalanceStored(opts *bind.CallOpts, account common.Address) (*big.Int, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "poolUtilization") + err := _SDUtilityPool.contract.Call(opts, &out, "utilizerBalanceStored", account) if err != nil { return *new(*big.Int), err @@ -1270,1936 +895,572 @@ func (_SDUtilityPool *SDUtilityPoolCaller) PoolUtilization(opts *bind.CallOpts) } -// PoolUtilization is a free data retrieval call binding the contract method 0x9a3263ee. +// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. // -// Solidity: function poolUtilization() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) PoolUtilization() (*big.Int, error) { - return _SDUtilityPool.Contract.PoolUtilization(&_SDUtilityPool.CallOpts) +// Solidity: function utilizerBalanceStored(address account) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) UtilizerBalanceStored(account common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.UtilizerBalanceStored(&_SDUtilityPool.CallOpts, account) } -// PoolUtilization is a free data retrieval call binding the contract method 0x9a3263ee. +// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. // -// Solidity: function poolUtilization() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) PoolUtilization() (*big.Int, error) { - return _SDUtilityPool.Contract.PoolUtilization(&_SDUtilityPool.CallOpts) +// Solidity: function utilizerBalanceStored(address account) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizerBalanceStored(account common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.UtilizerBalanceStored(&_SDUtilityPool.CallOpts, account) } -// ProtocolFee is a free data retrieval call binding the contract method 0xb0e21e8a. +// UtilizerData is a free data retrieval call binding the contract method 0x9e070088. // -// Solidity: function protocolFee() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) ProtocolFee(opts *bind.CallOpts) (*big.Int, error) { +// Solidity: function utilizerData(address ) view returns(uint256 principal, uint256 utilizeIndex) +func (_SDUtilityPool *SDUtilityPoolCaller) UtilizerData(opts *bind.CallOpts, arg0 common.Address) (struct { + Principal *big.Int + UtilizeIndex *big.Int +}, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "protocolFee") + err := _SDUtilityPool.contract.Call(opts, &out, "utilizerData", arg0) + outstruct := new(struct { + Principal *big.Int + UtilizeIndex *big.Int + }) if err != nil { - return *new(*big.Int), err + return *outstruct, err } - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.Principal = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.UtilizeIndex = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - return out0, err + return *outstruct, err } -// ProtocolFee is a free data retrieval call binding the contract method 0xb0e21e8a. +// UtilizerData is a free data retrieval call binding the contract method 0x9e070088. // -// Solidity: function protocolFee() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) ProtocolFee() (*big.Int, error) { - return _SDUtilityPool.Contract.ProtocolFee(&_SDUtilityPool.CallOpts) +// Solidity: function utilizerData(address ) view returns(uint256 principal, uint256 utilizeIndex) +func (_SDUtilityPool *SDUtilityPoolSession) UtilizerData(arg0 common.Address) (struct { + Principal *big.Int + UtilizeIndex *big.Int +}, error) { + return _SDUtilityPool.Contract.UtilizerData(&_SDUtilityPool.CallOpts, arg0) } -// ProtocolFee is a free data retrieval call binding the contract method 0xb0e21e8a. +// UtilizerData is a free data retrieval call binding the contract method 0x9e070088. // -// Solidity: function protocolFee() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) ProtocolFee() (*big.Int, error) { - return _SDUtilityPool.Contract.ProtocolFee(&_SDUtilityPool.CallOpts) +// Solidity: function utilizerData(address ) view returns(uint256 principal, uint256 utilizeIndex) +func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizerData(arg0 common.Address) (struct { + Principal *big.Int + UtilizeIndex *big.Int +}, error) { + return _SDUtilityPool.Contract.UtilizerData(&_SDUtilityPool.CallOpts, arg0) } -// RequestIdsByDelegatorAddress is a free data retrieval call binding the contract method 0x7844e3af. +// AccrueFee is a paid mutator transaction binding the contract method 0xb26cc394. // -// Solidity: function requestIdsByDelegatorAddress(address , uint256 ) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) RequestIdsByDelegatorAddress(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (*big.Int, error) { - var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "requestIdsByDelegatorAddress", arg0, arg1) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - +// Solidity: function accrueFee() returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) AccrueFee(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "accrueFee") } -// RequestIdsByDelegatorAddress is a free data retrieval call binding the contract method 0x7844e3af. +// AccrueFee is a paid mutator transaction binding the contract method 0xb26cc394. // -// Solidity: function requestIdsByDelegatorAddress(address , uint256 ) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) RequestIdsByDelegatorAddress(arg0 common.Address, arg1 *big.Int) (*big.Int, error) { - return _SDUtilityPool.Contract.RequestIdsByDelegatorAddress(&_SDUtilityPool.CallOpts, arg0, arg1) +// Solidity: function accrueFee() returns() +func (_SDUtilityPool *SDUtilityPoolSession) AccrueFee() (*types.Transaction, error) { + return _SDUtilityPool.Contract.AccrueFee(&_SDUtilityPool.TransactOpts) } -// RequestIdsByDelegatorAddress is a free data retrieval call binding the contract method 0x7844e3af. +// AccrueFee is a paid mutator transaction binding the contract method 0xb26cc394. // -// Solidity: function requestIdsByDelegatorAddress(address , uint256 ) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) RequestIdsByDelegatorAddress(arg0 common.Address, arg1 *big.Int) (*big.Int, error) { - return _SDUtilityPool.Contract.RequestIdsByDelegatorAddress(&_SDUtilityPool.CallOpts, arg0, arg1) +// Solidity: function accrueFee() returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) AccrueFee() (*types.Transaction, error) { + return _SDUtilityPool.Contract.AccrueFee(&_SDUtilityPool.TransactOpts) } -// RiskConfig is a free data retrieval call binding the contract method 0x7c90a6ca. +// Claim is a paid mutator transaction binding the contract method 0x379607f5. // -// Solidity: function riskConfig() view returns(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) -func (_SDUtilityPool *SDUtilityPoolCaller) RiskConfig(opts *bind.CallOpts) (struct { - LiquidationThreshold *big.Int - LiquidationBonusPercent *big.Int - LiquidationFeePercent *big.Int - Ltv *big.Int -}, error) { - var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "riskConfig") - - outstruct := new(struct { - LiquidationThreshold *big.Int - LiquidationBonusPercent *big.Int - LiquidationFeePercent *big.Int - Ltv *big.Int - }) - if err != nil { - return *outstruct, err - } - - outstruct.LiquidationThreshold = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - outstruct.LiquidationBonusPercent = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - outstruct.LiquidationFeePercent = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) - outstruct.Ltv = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) - - return *outstruct, err - +// Solidity: function claim(uint256 requestId) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) Claim(opts *bind.TransactOpts, requestId *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "claim", requestId) } -// RiskConfig is a free data retrieval call binding the contract method 0x7c90a6ca. +// Claim is a paid mutator transaction binding the contract method 0x379607f5. // -// Solidity: function riskConfig() view returns(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) -func (_SDUtilityPool *SDUtilityPoolSession) RiskConfig() (struct { - LiquidationThreshold *big.Int - LiquidationBonusPercent *big.Int - LiquidationFeePercent *big.Int - Ltv *big.Int -}, error) { - return _SDUtilityPool.Contract.RiskConfig(&_SDUtilityPool.CallOpts) +// Solidity: function claim(uint256 requestId) returns() +func (_SDUtilityPool *SDUtilityPoolSession) Claim(requestId *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Claim(&_SDUtilityPool.TransactOpts, requestId) } -// RiskConfig is a free data retrieval call binding the contract method 0x7c90a6ca. +// Claim is a paid mutator transaction binding the contract method 0x379607f5. // -// Solidity: function riskConfig() view returns(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) -func (_SDUtilityPool *SDUtilityPoolCallerSession) RiskConfig() (struct { - LiquidationThreshold *big.Int - LiquidationBonusPercent *big.Int - LiquidationFeePercent *big.Int - Ltv *big.Int -}, error) { - return _SDUtilityPool.Contract.RiskConfig(&_SDUtilityPool.CallOpts) +// Solidity: function claim(uint256 requestId) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Claim(requestId *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Claim(&_SDUtilityPool.TransactOpts, requestId) } -// SdRequestedForWithdraw is a free data retrieval call binding the contract method 0x3b92e3cf. +// CompleteLiquidation is a paid mutator transaction binding the contract method 0xd844cb6c. // -// Solidity: function sdRequestedForWithdraw() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) SdRequestedForWithdraw(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "sdRequestedForWithdraw") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - +// Solidity: function completeLiquidation(address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) CompleteLiquidation(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "completeLiquidation", account) } -// SdRequestedForWithdraw is a free data retrieval call binding the contract method 0x3b92e3cf. +// CompleteLiquidation is a paid mutator transaction binding the contract method 0xd844cb6c. // -// Solidity: function sdRequestedForWithdraw() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) SdRequestedForWithdraw() (*big.Int, error) { - return _SDUtilityPool.Contract.SdRequestedForWithdraw(&_SDUtilityPool.CallOpts) +// Solidity: function completeLiquidation(address account) returns() +func (_SDUtilityPool *SDUtilityPoolSession) CompleteLiquidation(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.CompleteLiquidation(&_SDUtilityPool.TransactOpts, account) } -// SdRequestedForWithdraw is a free data retrieval call binding the contract method 0x3b92e3cf. +// CompleteLiquidation is a paid mutator transaction binding the contract method 0xd844cb6c. // -// Solidity: function sdRequestedForWithdraw() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) SdRequestedForWithdraw() (*big.Int, error) { - return _SDUtilityPool.Contract.SdRequestedForWithdraw(&_SDUtilityPool.CallOpts) +// Solidity: function completeLiquidation(address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) CompleteLiquidation(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.CompleteLiquidation(&_SDUtilityPool.TransactOpts, account) } -// SdReservedForClaim is a free data retrieval call binding the contract method 0x2b886941. +// Delegate is a paid mutator transaction binding the contract method 0x9fa6dd35. // -// Solidity: function sdReservedForClaim() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) SdReservedForClaim(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "sdReservedForClaim") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - +// Solidity: function delegate(uint256 sdAmount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) Delegate(opts *bind.TransactOpts, sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "delegate", sdAmount) } -// SdReservedForClaim is a free data retrieval call binding the contract method 0x2b886941. +// Delegate is a paid mutator transaction binding the contract method 0x9fa6dd35. // -// Solidity: function sdReservedForClaim() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) SdReservedForClaim() (*big.Int, error) { - return _SDUtilityPool.Contract.SdReservedForClaim(&_SDUtilityPool.CallOpts) +// Solidity: function delegate(uint256 sdAmount) returns() +func (_SDUtilityPool *SDUtilityPoolSession) Delegate(sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Delegate(&_SDUtilityPool.TransactOpts, sdAmount) } -// SdReservedForClaim is a free data retrieval call binding the contract method 0x2b886941. +// Delegate is a paid mutator transaction binding the contract method 0x9fa6dd35. // -// Solidity: function sdReservedForClaim() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) SdReservedForClaim() (*big.Int, error) { - return _SDUtilityPool.Contract.SdReservedForClaim(&_SDUtilityPool.CallOpts) +// Solidity: function delegate(uint256 sdAmount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Delegate(sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Delegate(&_SDUtilityPool.TransactOpts, sdAmount) } -// StaderConfig is a free data retrieval call binding the contract method 0x490ffa35. +// ExchangeRateCurrent is a paid mutator transaction binding the contract method 0xbd6d894d. // -// Solidity: function staderConfig() view returns(address) -func (_SDUtilityPool *SDUtilityPoolCaller) StaderConfig(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "staderConfig") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - +// Solidity: function exchangeRateCurrent() returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactor) ExchangeRateCurrent(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "exchangeRateCurrent") } -// StaderConfig is a free data retrieval call binding the contract method 0x490ffa35. +// ExchangeRateCurrent is a paid mutator transaction binding the contract method 0xbd6d894d. // -// Solidity: function staderConfig() view returns(address) -func (_SDUtilityPool *SDUtilityPoolSession) StaderConfig() (common.Address, error) { - return _SDUtilityPool.Contract.StaderConfig(&_SDUtilityPool.CallOpts) +// Solidity: function exchangeRateCurrent() returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) ExchangeRateCurrent() (*types.Transaction, error) { + return _SDUtilityPool.Contract.ExchangeRateCurrent(&_SDUtilityPool.TransactOpts) } -// StaderConfig is a free data retrieval call binding the contract method 0x490ffa35. +// ExchangeRateCurrent is a paid mutator transaction binding the contract method 0xbd6d894d. // -// Solidity: function staderConfig() view returns(address) -func (_SDUtilityPool *SDUtilityPoolCallerSession) StaderConfig() (common.Address, error) { - return _SDUtilityPool.Contract.StaderConfig(&_SDUtilityPool.CallOpts) +// Solidity: function exchangeRateCurrent() returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) ExchangeRateCurrent() (*types.Transaction, error) { + return _SDUtilityPool.Contract.ExchangeRateCurrent(&_SDUtilityPool.TransactOpts) } -// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// FinalizeDelegatorWithdrawalRequest is a paid mutator transaction binding the contract method 0x71898b4e. // -// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) -func (_SDUtilityPool *SDUtilityPoolCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { - var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "supportsInterface", interfaceId) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - +// Solidity: function finalizeDelegatorWithdrawalRequest() returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) FinalizeDelegatorWithdrawalRequest(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "finalizeDelegatorWithdrawalRequest") } -// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// FinalizeDelegatorWithdrawalRequest is a paid mutator transaction binding the contract method 0x71898b4e. // -// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) -func (_SDUtilityPool *SDUtilityPoolSession) SupportsInterface(interfaceId [4]byte) (bool, error) { - return _SDUtilityPool.Contract.SupportsInterface(&_SDUtilityPool.CallOpts, interfaceId) +// Solidity: function finalizeDelegatorWithdrawalRequest() returns() +func (_SDUtilityPool *SDUtilityPoolSession) FinalizeDelegatorWithdrawalRequest() (*types.Transaction, error) { + return _SDUtilityPool.Contract.FinalizeDelegatorWithdrawalRequest(&_SDUtilityPool.TransactOpts) } -// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// FinalizeDelegatorWithdrawalRequest is a paid mutator transaction binding the contract method 0x71898b4e. // -// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) -func (_SDUtilityPool *SDUtilityPoolCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { - return _SDUtilityPool.Contract.SupportsInterface(&_SDUtilityPool.CallOpts, interfaceId) +// Solidity: function finalizeDelegatorWithdrawalRequest() returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) FinalizeDelegatorWithdrawalRequest() (*types.Transaction, error) { + return _SDUtilityPool.Contract.FinalizeDelegatorWithdrawalRequest(&_SDUtilityPool.TransactOpts) } -// TotalUtilizedSD is a free data retrieval call binding the contract method 0x8763a328. +// LiquidationCall is a paid mutator transaction binding the contract method 0xd2ac4a3d. // -// Solidity: function totalUtilizedSD() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) TotalUtilizedSD(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "totalUtilizedSD") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - +// Solidity: function liquidationCall(address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) LiquidationCall(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "liquidationCall", account) } -// TotalUtilizedSD is a free data retrieval call binding the contract method 0x8763a328. +// LiquidationCall is a paid mutator transaction binding the contract method 0xd2ac4a3d. // -// Solidity: function totalUtilizedSD() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) TotalUtilizedSD() (*big.Int, error) { - return _SDUtilityPool.Contract.TotalUtilizedSD(&_SDUtilityPool.CallOpts) +// Solidity: function liquidationCall(address account) returns() +func (_SDUtilityPool *SDUtilityPoolSession) LiquidationCall(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.LiquidationCall(&_SDUtilityPool.TransactOpts, account) } -// TotalUtilizedSD is a free data retrieval call binding the contract method 0x8763a328. +// LiquidationCall is a paid mutator transaction binding the contract method 0xd2ac4a3d. // -// Solidity: function totalUtilizedSD() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) TotalUtilizedSD() (*big.Int, error) { - return _SDUtilityPool.Contract.TotalUtilizedSD(&_SDUtilityPool.CallOpts) +// Solidity: function liquidationCall(address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) LiquidationCall(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.LiquidationCall(&_SDUtilityPool.TransactOpts, account) } -// UtilizationRatePerBlock is a free data retrieval call binding the contract method 0x962c7070. +// MaxApproveSD is a paid mutator transaction binding the contract method 0x3e04cd35. // -// Solidity: function utilizationRatePerBlock() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) UtilizationRatePerBlock(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "utilizationRatePerBlock") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - +// Solidity: function maxApproveSD() returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) MaxApproveSD(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "maxApproveSD") } -// UtilizationRatePerBlock is a free data retrieval call binding the contract method 0x962c7070. +// MaxApproveSD is a paid mutator transaction binding the contract method 0x3e04cd35. // -// Solidity: function utilizationRatePerBlock() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) UtilizationRatePerBlock() (*big.Int, error) { - return _SDUtilityPool.Contract.UtilizationRatePerBlock(&_SDUtilityPool.CallOpts) +// Solidity: function maxApproveSD() returns() +func (_SDUtilityPool *SDUtilityPoolSession) MaxApproveSD() (*types.Transaction, error) { + return _SDUtilityPool.Contract.MaxApproveSD(&_SDUtilityPool.TransactOpts) } -// UtilizationRatePerBlock is a free data retrieval call binding the contract method 0x962c7070. +// MaxApproveSD is a paid mutator transaction binding the contract method 0x3e04cd35. // -// Solidity: function utilizationRatePerBlock() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizationRatePerBlock() (*big.Int, error) { - return _SDUtilityPool.Contract.UtilizationRatePerBlock(&_SDUtilityPool.CallOpts) +// Solidity: function maxApproveSD() returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) MaxApproveSD() (*types.Transaction, error) { + return _SDUtilityPool.Contract.MaxApproveSD(&_SDUtilityPool.TransactOpts) } -// UtilizeIndex is a free data retrieval call binding the contract method 0x634c48c7. +// Repay is a paid mutator transaction binding the contract method 0x371fd8e6. // -// Solidity: function utilizeIndex() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) UtilizeIndex(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "utilizeIndex") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - +// Solidity: function repay(uint256 repayAmount) returns(uint256, uint256) +func (_SDUtilityPool *SDUtilityPoolTransactor) Repay(opts *bind.TransactOpts, repayAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "repay", repayAmount) } -// UtilizeIndex is a free data retrieval call binding the contract method 0x634c48c7. +// Repay is a paid mutator transaction binding the contract method 0x371fd8e6. // -// Solidity: function utilizeIndex() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) UtilizeIndex() (*big.Int, error) { - return _SDUtilityPool.Contract.UtilizeIndex(&_SDUtilityPool.CallOpts) +// Solidity: function repay(uint256 repayAmount) returns(uint256, uint256) +func (_SDUtilityPool *SDUtilityPoolSession) Repay(repayAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Repay(&_SDUtilityPool.TransactOpts, repayAmount) } -// UtilizeIndex is a free data retrieval call binding the contract method 0x634c48c7. +// Repay is a paid mutator transaction binding the contract method 0x371fd8e6. // -// Solidity: function utilizeIndex() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizeIndex() (*big.Int, error) { - return _SDUtilityPool.Contract.UtilizeIndex(&_SDUtilityPool.CallOpts) +// Solidity: function repay(uint256 repayAmount) returns(uint256, uint256) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Repay(repayAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Repay(&_SDUtilityPool.TransactOpts, repayAmount) } -// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. +// RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. // -// Solidity: function utilizerBalanceStored(address account) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) UtilizerBalanceStored(opts *bind.CallOpts, account common.Address) (*big.Int, error) { - var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "utilizerBalanceStored", account) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - +// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns(uint256, uint256) +func (_SDUtilityPool *SDUtilityPoolTransactor) RepayOnBehalf(opts *bind.TransactOpts, utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "repayOnBehalf", utilizer, repayAmount) } -// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. +// RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. // -// Solidity: function utilizerBalanceStored(address account) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) UtilizerBalanceStored(account common.Address) (*big.Int, error) { - return _SDUtilityPool.Contract.UtilizerBalanceStored(&_SDUtilityPool.CallOpts, account) +// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns(uint256, uint256) +func (_SDUtilityPool *SDUtilityPoolSession) RepayOnBehalf(utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RepayOnBehalf(&_SDUtilityPool.TransactOpts, utilizer, repayAmount) } -// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. +// RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. // -// Solidity: function utilizerBalanceStored(address account) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizerBalanceStored(account common.Address) (*big.Int, error) { - return _SDUtilityPool.Contract.UtilizerBalanceStored(&_SDUtilityPool.CallOpts, account) +// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns(uint256, uint256) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) RepayOnBehalf(utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RepayOnBehalf(&_SDUtilityPool.TransactOpts, utilizer, repayAmount) } -// UtilizerData is a free data retrieval call binding the contract method 0x9e070088. +// RequestWithdraw is a paid mutator transaction binding the contract method 0x745400c9. // -// Solidity: function utilizerData(address ) view returns(uint256 principal, uint256 utilizeIndex) -func (_SDUtilityPool *SDUtilityPoolCaller) UtilizerData(opts *bind.CallOpts, arg0 common.Address) (struct { - Principal *big.Int - UtilizeIndex *big.Int -}, error) { - var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "utilizerData", arg0) - - outstruct := new(struct { - Principal *big.Int - UtilizeIndex *big.Int - }) - if err != nil { - return *outstruct, err - } - - outstruct.Principal = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - outstruct.UtilizeIndex = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - - return *outstruct, err - +// Solidity: function requestWithdraw(uint256 cTokenAmount) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactor) RequestWithdraw(opts *bind.TransactOpts, cTokenAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "requestWithdraw", cTokenAmount) } -// UtilizerData is a free data retrieval call binding the contract method 0x9e070088. +// RequestWithdraw is a paid mutator transaction binding the contract method 0x745400c9. // -// Solidity: function utilizerData(address ) view returns(uint256 principal, uint256 utilizeIndex) -func (_SDUtilityPool *SDUtilityPoolSession) UtilizerData(arg0 common.Address) (struct { - Principal *big.Int - UtilizeIndex *big.Int -}, error) { - return _SDUtilityPool.Contract.UtilizerData(&_SDUtilityPool.CallOpts, arg0) +// Solidity: function requestWithdraw(uint256 cTokenAmount) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) RequestWithdraw(cTokenAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RequestWithdraw(&_SDUtilityPool.TransactOpts, cTokenAmount) } -// UtilizerData is a free data retrieval call binding the contract method 0x9e070088. +// RequestWithdraw is a paid mutator transaction binding the contract method 0x745400c9. // -// Solidity: function utilizerData(address ) view returns(uint256 principal, uint256 utilizeIndex) -func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizerData(arg0 common.Address) (struct { - Principal *big.Int - UtilizeIndex *big.Int -}, error) { - return _SDUtilityPool.Contract.UtilizerData(&_SDUtilityPool.CallOpts, arg0) +// Solidity: function requestWithdraw(uint256 cTokenAmount) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) RequestWithdraw(cTokenAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RequestWithdraw(&_SDUtilityPool.TransactOpts, cTokenAmount) } -// AccrueFee is a paid mutator transaction binding the contract method 0xb26cc394. +// RequestWithdrawWithSDAmount is a paid mutator transaction binding the contract method 0xc51cd1cc. // -// Solidity: function accrueFee() returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) AccrueFee(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "accrueFee") +// Solidity: function requestWithdrawWithSDAmount(uint256 sdAmount) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactor) RequestWithdrawWithSDAmount(opts *bind.TransactOpts, sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "requestWithdrawWithSDAmount", sdAmount) } -// AccrueFee is a paid mutator transaction binding the contract method 0xb26cc394. +// RequestWithdrawWithSDAmount is a paid mutator transaction binding the contract method 0xc51cd1cc. // -// Solidity: function accrueFee() returns() -func (_SDUtilityPool *SDUtilityPoolSession) AccrueFee() (*types.Transaction, error) { - return _SDUtilityPool.Contract.AccrueFee(&_SDUtilityPool.TransactOpts) +// Solidity: function requestWithdrawWithSDAmount(uint256 sdAmount) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) RequestWithdrawWithSDAmount(sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RequestWithdrawWithSDAmount(&_SDUtilityPool.TransactOpts, sdAmount) } -// AccrueFee is a paid mutator transaction binding the contract method 0xb26cc394. +// RequestWithdrawWithSDAmount is a paid mutator transaction binding the contract method 0xc51cd1cc. // -// Solidity: function accrueFee() returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) AccrueFee() (*types.Transaction, error) { - return _SDUtilityPool.Contract.AccrueFee(&_SDUtilityPool.TransactOpts) +// Solidity: function requestWithdrawWithSDAmount(uint256 sdAmount) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) RequestWithdrawWithSDAmount(sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RequestWithdrawWithSDAmount(&_SDUtilityPool.TransactOpts, sdAmount) } -// Claim is a paid mutator transaction binding the contract method 0x379607f5. +// UpdateConservativeEthPerKey is a paid mutator transaction binding the contract method 0x1c557f05. // -// Solidity: function claim(uint256 _requestId) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) Claim(opts *bind.TransactOpts, _requestId *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "claim", _requestId) +// Solidity: function updateConservativeEthPerKey(uint256 _newEthPerKey) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateConservativeEthPerKey(opts *bind.TransactOpts, _newEthPerKey *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateConservativeEthPerKey", _newEthPerKey) } -// Claim is a paid mutator transaction binding the contract method 0x379607f5. +// UpdateConservativeEthPerKey is a paid mutator transaction binding the contract method 0x1c557f05. // -// Solidity: function claim(uint256 _requestId) returns() -func (_SDUtilityPool *SDUtilityPoolSession) Claim(_requestId *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Claim(&_SDUtilityPool.TransactOpts, _requestId) +// Solidity: function updateConservativeEthPerKey(uint256 _newEthPerKey) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateConservativeEthPerKey(_newEthPerKey *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateConservativeEthPerKey(&_SDUtilityPool.TransactOpts, _newEthPerKey) } -// Claim is a paid mutator transaction binding the contract method 0x379607f5. +// UpdateConservativeEthPerKey is a paid mutator transaction binding the contract method 0x1c557f05. // -// Solidity: function claim(uint256 _requestId) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) Claim(_requestId *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Claim(&_SDUtilityPool.TransactOpts, _requestId) +// Solidity: function updateConservativeEthPerKey(uint256 _newEthPerKey) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateConservativeEthPerKey(_newEthPerKey *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateConservativeEthPerKey(&_SDUtilityPool.TransactOpts, _newEthPerKey) } -// CompleteLiquidation is a paid mutator transaction binding the contract method 0xd844cb6c. +// UpdateFinalizationBatchLimit is a paid mutator transaction binding the contract method 0x267fca73. // -// Solidity: function completeLiquidation(address account) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) CompleteLiquidation(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "completeLiquidation", account) +// Solidity: function updateFinalizationBatchLimit(uint256 _finalizationBatchLimit) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateFinalizationBatchLimit(opts *bind.TransactOpts, _finalizationBatchLimit *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateFinalizationBatchLimit", _finalizationBatchLimit) } -// CompleteLiquidation is a paid mutator transaction binding the contract method 0xd844cb6c. +// UpdateFinalizationBatchLimit is a paid mutator transaction binding the contract method 0x267fca73. // -// Solidity: function completeLiquidation(address account) returns() -func (_SDUtilityPool *SDUtilityPoolSession) CompleteLiquidation(account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.CompleteLiquidation(&_SDUtilityPool.TransactOpts, account) +// Solidity: function updateFinalizationBatchLimit(uint256 _finalizationBatchLimit) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateFinalizationBatchLimit(_finalizationBatchLimit *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateFinalizationBatchLimit(&_SDUtilityPool.TransactOpts, _finalizationBatchLimit) } -// CompleteLiquidation is a paid mutator transaction binding the contract method 0xd844cb6c. +// UpdateFinalizationBatchLimit is a paid mutator transaction binding the contract method 0x267fca73. // -// Solidity: function completeLiquidation(address account) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) CompleteLiquidation(account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.CompleteLiquidation(&_SDUtilityPool.TransactOpts, account) +// Solidity: function updateFinalizationBatchLimit(uint256 _finalizationBatchLimit) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateFinalizationBatchLimit(_finalizationBatchLimit *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateFinalizationBatchLimit(&_SDUtilityPool.TransactOpts, _finalizationBatchLimit) } -// Delegate is a paid mutator transaction binding the contract method 0x9fa6dd35. +// UpdateMaxETHWorthOfSDPerValidator is a paid mutator transaction binding the contract method 0x5393618e. // -// Solidity: function delegate(uint256 sdAmount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) Delegate(opts *bind.TransactOpts, sdAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "delegate", sdAmount) +// Solidity: function updateMaxETHWorthOfSDPerValidator(uint256 _maxETHWorthOfSDPerValidator) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateMaxETHWorthOfSDPerValidator(opts *bind.TransactOpts, _maxETHWorthOfSDPerValidator *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateMaxETHWorthOfSDPerValidator", _maxETHWorthOfSDPerValidator) } -// Delegate is a paid mutator transaction binding the contract method 0x9fa6dd35. +// UpdateMaxETHWorthOfSDPerValidator is a paid mutator transaction binding the contract method 0x5393618e. // -// Solidity: function delegate(uint256 sdAmount) returns() -func (_SDUtilityPool *SDUtilityPoolSession) Delegate(sdAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Delegate(&_SDUtilityPool.TransactOpts, sdAmount) +// Solidity: function updateMaxETHWorthOfSDPerValidator(uint256 _maxETHWorthOfSDPerValidator) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateMaxETHWorthOfSDPerValidator(_maxETHWorthOfSDPerValidator *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateMaxETHWorthOfSDPerValidator(&_SDUtilityPool.TransactOpts, _maxETHWorthOfSDPerValidator) } -// Delegate is a paid mutator transaction binding the contract method 0x9fa6dd35. +// UpdateMaxETHWorthOfSDPerValidator is a paid mutator transaction binding the contract method 0x5393618e. // -// Solidity: function delegate(uint256 sdAmount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) Delegate(sdAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Delegate(&_SDUtilityPool.TransactOpts, sdAmount) +// Solidity: function updateMaxETHWorthOfSDPerValidator(uint256 _maxETHWorthOfSDPerValidator) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateMaxETHWorthOfSDPerValidator(_maxETHWorthOfSDPerValidator *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateMaxETHWorthOfSDPerValidator(&_SDUtilityPool.TransactOpts, _maxETHWorthOfSDPerValidator) } -// ExchangeRateCurrent is a paid mutator transaction binding the contract method 0xbd6d894d. +// UpdateMaxNonRedeemedDelegatorRequestCount is a paid mutator transaction binding the contract method 0xee63e5f9. // -// Solidity: function exchangeRateCurrent() returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactor) ExchangeRateCurrent(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "exchangeRateCurrent") +// Solidity: function updateMaxNonRedeemedDelegatorRequestCount(uint256 _count) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateMaxNonRedeemedDelegatorRequestCount(opts *bind.TransactOpts, _count *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateMaxNonRedeemedDelegatorRequestCount", _count) } -// ExchangeRateCurrent is a paid mutator transaction binding the contract method 0xbd6d894d. +// UpdateMaxNonRedeemedDelegatorRequestCount is a paid mutator transaction binding the contract method 0xee63e5f9. // -// Solidity: function exchangeRateCurrent() returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) ExchangeRateCurrent() (*types.Transaction, error) { - return _SDUtilityPool.Contract.ExchangeRateCurrent(&_SDUtilityPool.TransactOpts) +// Solidity: function updateMaxNonRedeemedDelegatorRequestCount(uint256 _count) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateMaxNonRedeemedDelegatorRequestCount(_count *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateMaxNonRedeemedDelegatorRequestCount(&_SDUtilityPool.TransactOpts, _count) } -// ExchangeRateCurrent is a paid mutator transaction binding the contract method 0xbd6d894d. +// UpdateMaxNonRedeemedDelegatorRequestCount is a paid mutator transaction binding the contract method 0xee63e5f9. // -// Solidity: function exchangeRateCurrent() returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactorSession) ExchangeRateCurrent() (*types.Transaction, error) { - return _SDUtilityPool.Contract.ExchangeRateCurrent(&_SDUtilityPool.TransactOpts) +// Solidity: function updateMaxNonRedeemedDelegatorRequestCount(uint256 _count) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateMaxNonRedeemedDelegatorRequestCount(_count *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateMaxNonRedeemedDelegatorRequestCount(&_SDUtilityPool.TransactOpts, _count) } -// FinalizeDelegatorWithdrawalRequest is a paid mutator transaction binding the contract method 0x71898b4e. +// UpdateMinBlockDelayToFinalizeRequest is a paid mutator transaction binding the contract method 0x4a2965af. // -// Solidity: function finalizeDelegatorWithdrawalRequest() returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) FinalizeDelegatorWithdrawalRequest(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "finalizeDelegatorWithdrawalRequest") +// Solidity: function updateMinBlockDelayToFinalizeRequest(uint256 _minBlockDelayToFinalizeRequest) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateMinBlockDelayToFinalizeRequest(opts *bind.TransactOpts, _minBlockDelayToFinalizeRequest *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateMinBlockDelayToFinalizeRequest", _minBlockDelayToFinalizeRequest) } -// FinalizeDelegatorWithdrawalRequest is a paid mutator transaction binding the contract method 0x71898b4e. +// UpdateMinBlockDelayToFinalizeRequest is a paid mutator transaction binding the contract method 0x4a2965af. // -// Solidity: function finalizeDelegatorWithdrawalRequest() returns() -func (_SDUtilityPool *SDUtilityPoolSession) FinalizeDelegatorWithdrawalRequest() (*types.Transaction, error) { - return _SDUtilityPool.Contract.FinalizeDelegatorWithdrawalRequest(&_SDUtilityPool.TransactOpts) +// Solidity: function updateMinBlockDelayToFinalizeRequest(uint256 _minBlockDelayToFinalizeRequest) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateMinBlockDelayToFinalizeRequest(_minBlockDelayToFinalizeRequest *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateMinBlockDelayToFinalizeRequest(&_SDUtilityPool.TransactOpts, _minBlockDelayToFinalizeRequest) } -// FinalizeDelegatorWithdrawalRequest is a paid mutator transaction binding the contract method 0x71898b4e. +// UpdateMinBlockDelayToFinalizeRequest is a paid mutator transaction binding the contract method 0x4a2965af. // -// Solidity: function finalizeDelegatorWithdrawalRequest() returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) FinalizeDelegatorWithdrawalRequest() (*types.Transaction, error) { - return _SDUtilityPool.Contract.FinalizeDelegatorWithdrawalRequest(&_SDUtilityPool.TransactOpts) +// Solidity: function updateMinBlockDelayToFinalizeRequest(uint256 _minBlockDelayToFinalizeRequest) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateMinBlockDelayToFinalizeRequest(_minBlockDelayToFinalizeRequest *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateMinBlockDelayToFinalizeRequest(&_SDUtilityPool.TransactOpts, _minBlockDelayToFinalizeRequest) } -// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. +// UpdateProtocolFee is a paid mutator transaction binding the contract method 0x4256dd78. // -// Solidity: function grantRole(bytes32 role, address account) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) GrantRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "grantRole", role, account) +// Solidity: function updateProtocolFee(uint256 _protocolFee) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateProtocolFee(opts *bind.TransactOpts, _protocolFee *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateProtocolFee", _protocolFee) } -// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. +// UpdateProtocolFee is a paid mutator transaction binding the contract method 0x4256dd78. // -// Solidity: function grantRole(bytes32 role, address account) returns() -func (_SDUtilityPool *SDUtilityPoolSession) GrantRole(role [32]byte, account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.GrantRole(&_SDUtilityPool.TransactOpts, role, account) -} - -// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. -// -// Solidity: function grantRole(bytes32 role, address account) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) GrantRole(role [32]byte, account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.GrantRole(&_SDUtilityPool.TransactOpts, role, account) -} - -// Initialize is a paid mutator transaction binding the contract method 0x485cc955. -// -// Solidity: function initialize(address _admin, address _staderConfig) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) Initialize(opts *bind.TransactOpts, _admin common.Address, _staderConfig common.Address) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "initialize", _admin, _staderConfig) -} - -// Initialize is a paid mutator transaction binding the contract method 0x485cc955. -// -// Solidity: function initialize(address _admin, address _staderConfig) returns() -func (_SDUtilityPool *SDUtilityPoolSession) Initialize(_admin common.Address, _staderConfig common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Initialize(&_SDUtilityPool.TransactOpts, _admin, _staderConfig) -} - -// Initialize is a paid mutator transaction binding the contract method 0x485cc955. -// -// Solidity: function initialize(address _admin, address _staderConfig) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) Initialize(_admin common.Address, _staderConfig common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Initialize(&_SDUtilityPool.TransactOpts, _admin, _staderConfig) -} - -// LiquidationCall is a paid mutator transaction binding the contract method 0xd2ac4a3d. -// -// Solidity: function liquidationCall(address account) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) LiquidationCall(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "liquidationCall", account) -} - -// LiquidationCall is a paid mutator transaction binding the contract method 0xd2ac4a3d. -// -// Solidity: function liquidationCall(address account) returns() -func (_SDUtilityPool *SDUtilityPoolSession) LiquidationCall(account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.LiquidationCall(&_SDUtilityPool.TransactOpts, account) -} - -// LiquidationCall is a paid mutator transaction binding the contract method 0xd2ac4a3d. -// -// Solidity: function liquidationCall(address account) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) LiquidationCall(account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.LiquidationCall(&_SDUtilityPool.TransactOpts, account) -} - -// MaxApproveSD is a paid mutator transaction binding the contract method 0x3e04cd35. -// -// Solidity: function maxApproveSD() returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) MaxApproveSD(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "maxApproveSD") -} - -// MaxApproveSD is a paid mutator transaction binding the contract method 0x3e04cd35. -// -// Solidity: function maxApproveSD() returns() -func (_SDUtilityPool *SDUtilityPoolSession) MaxApproveSD() (*types.Transaction, error) { - return _SDUtilityPool.Contract.MaxApproveSD(&_SDUtilityPool.TransactOpts) -} - -// MaxApproveSD is a paid mutator transaction binding the contract method 0x3e04cd35. -// -// Solidity: function maxApproveSD() returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) MaxApproveSD() (*types.Transaction, error) { - return _SDUtilityPool.Contract.MaxApproveSD(&_SDUtilityPool.TransactOpts) -} - -// Pause is a paid mutator transaction binding the contract method 0x8456cb59. -// -// Solidity: function pause() returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "pause") -} - -// Pause is a paid mutator transaction binding the contract method 0x8456cb59. -// -// Solidity: function pause() returns() -func (_SDUtilityPool *SDUtilityPoolSession) Pause() (*types.Transaction, error) { - return _SDUtilityPool.Contract.Pause(&_SDUtilityPool.TransactOpts) -} - -// Pause is a paid mutator transaction binding the contract method 0x8456cb59. -// -// Solidity: function pause() returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) Pause() (*types.Transaction, error) { - return _SDUtilityPool.Contract.Pause(&_SDUtilityPool.TransactOpts) -} - -// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. -// -// Solidity: function renounceRole(bytes32 role, address account) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) RenounceRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "renounceRole", role, account) -} - -// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. -// -// Solidity: function renounceRole(bytes32 role, address account) returns() -func (_SDUtilityPool *SDUtilityPoolSession) RenounceRole(role [32]byte, account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RenounceRole(&_SDUtilityPool.TransactOpts, role, account) -} - -// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. -// -// Solidity: function renounceRole(bytes32 role, address account) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) RenounceRole(role [32]byte, account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RenounceRole(&_SDUtilityPool.TransactOpts, role, account) -} - -// Repay is a paid mutator transaction binding the contract method 0x371fd8e6. -// -// Solidity: function repay(uint256 repayAmount) returns(uint256 repaidAmount, uint256 feePaid) -func (_SDUtilityPool *SDUtilityPoolTransactor) Repay(opts *bind.TransactOpts, repayAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "repay", repayAmount) -} - -// Repay is a paid mutator transaction binding the contract method 0x371fd8e6. -// -// Solidity: function repay(uint256 repayAmount) returns(uint256 repaidAmount, uint256 feePaid) -func (_SDUtilityPool *SDUtilityPoolSession) Repay(repayAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Repay(&_SDUtilityPool.TransactOpts, repayAmount) -} - -// Repay is a paid mutator transaction binding the contract method 0x371fd8e6. -// -// Solidity: function repay(uint256 repayAmount) returns(uint256 repaidAmount, uint256 feePaid) -func (_SDUtilityPool *SDUtilityPoolTransactorSession) Repay(repayAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Repay(&_SDUtilityPool.TransactOpts, repayAmount) -} - -// RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. -// -// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns(uint256 repaidAmount, uint256 feePaid) -func (_SDUtilityPool *SDUtilityPoolTransactor) RepayOnBehalf(opts *bind.TransactOpts, utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "repayOnBehalf", utilizer, repayAmount) -} - -// RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. -// -// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns(uint256 repaidAmount, uint256 feePaid) -func (_SDUtilityPool *SDUtilityPoolSession) RepayOnBehalf(utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RepayOnBehalf(&_SDUtilityPool.TransactOpts, utilizer, repayAmount) -} - -// RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. -// -// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns(uint256 repaidAmount, uint256 feePaid) -func (_SDUtilityPool *SDUtilityPoolTransactorSession) RepayOnBehalf(utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RepayOnBehalf(&_SDUtilityPool.TransactOpts, utilizer, repayAmount) -} - -// RequestWithdraw is a paid mutator transaction binding the contract method 0x745400c9. -// -// Solidity: function requestWithdraw(uint256 _cTokenAmount) returns(uint256 _requestId) -func (_SDUtilityPool *SDUtilityPoolTransactor) RequestWithdraw(opts *bind.TransactOpts, _cTokenAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "requestWithdraw", _cTokenAmount) -} - -// RequestWithdraw is a paid mutator transaction binding the contract method 0x745400c9. -// -// Solidity: function requestWithdraw(uint256 _cTokenAmount) returns(uint256 _requestId) -func (_SDUtilityPool *SDUtilityPoolSession) RequestWithdraw(_cTokenAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RequestWithdraw(&_SDUtilityPool.TransactOpts, _cTokenAmount) -} - -// RequestWithdraw is a paid mutator transaction binding the contract method 0x745400c9. -// -// Solidity: function requestWithdraw(uint256 _cTokenAmount) returns(uint256 _requestId) -func (_SDUtilityPool *SDUtilityPoolTransactorSession) RequestWithdraw(_cTokenAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RequestWithdraw(&_SDUtilityPool.TransactOpts, _cTokenAmount) -} - -// RequestWithdrawWithSDAmount is a paid mutator transaction binding the contract method 0xc51cd1cc. -// -// Solidity: function requestWithdrawWithSDAmount(uint256 _sdAmount) returns(uint256 _requestId) -func (_SDUtilityPool *SDUtilityPoolTransactor) RequestWithdrawWithSDAmount(opts *bind.TransactOpts, _sdAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "requestWithdrawWithSDAmount", _sdAmount) -} - -// RequestWithdrawWithSDAmount is a paid mutator transaction binding the contract method 0xc51cd1cc. -// -// Solidity: function requestWithdrawWithSDAmount(uint256 _sdAmount) returns(uint256 _requestId) -func (_SDUtilityPool *SDUtilityPoolSession) RequestWithdrawWithSDAmount(_sdAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RequestWithdrawWithSDAmount(&_SDUtilityPool.TransactOpts, _sdAmount) -} - -// RequestWithdrawWithSDAmount is a paid mutator transaction binding the contract method 0xc51cd1cc. -// -// Solidity: function requestWithdrawWithSDAmount(uint256 _sdAmount) returns(uint256 _requestId) -func (_SDUtilityPool *SDUtilityPoolTransactorSession) RequestWithdrawWithSDAmount(_sdAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RequestWithdrawWithSDAmount(&_SDUtilityPool.TransactOpts, _sdAmount) -} - -// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. -// -// Solidity: function revokeRole(bytes32 role, address account) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) RevokeRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "revokeRole", role, account) -} - -// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. -// -// Solidity: function revokeRole(bytes32 role, address account) returns() -func (_SDUtilityPool *SDUtilityPoolSession) RevokeRole(role [32]byte, account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RevokeRole(&_SDUtilityPool.TransactOpts, role, account) -} - -// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. -// -// Solidity: function revokeRole(bytes32 role, address account) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) RevokeRole(role [32]byte, account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RevokeRole(&_SDUtilityPool.TransactOpts, role, account) -} - -// Unpause is a paid mutator transaction binding the contract method 0x3f4ba83a. -// -// Solidity: function unpause() returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) Unpause(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "unpause") -} - -// Unpause is a paid mutator transaction binding the contract method 0x3f4ba83a. -// -// Solidity: function unpause() returns() -func (_SDUtilityPool *SDUtilityPoolSession) Unpause() (*types.Transaction, error) { - return _SDUtilityPool.Contract.Unpause(&_SDUtilityPool.TransactOpts) -} - -// Unpause is a paid mutator transaction binding the contract method 0x3f4ba83a. -// -// Solidity: function unpause() returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) Unpause() (*types.Transaction, error) { - return _SDUtilityPool.Contract.Unpause(&_SDUtilityPool.TransactOpts) -} - -// UpdateConservativeEthPerKey is a paid mutator transaction binding the contract method 0x1c557f05. -// -// Solidity: function updateConservativeEthPerKey(uint256 _newEthPerKey) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateConservativeEthPerKey(opts *bind.TransactOpts, _newEthPerKey *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "updateConservativeEthPerKey", _newEthPerKey) -} - -// UpdateConservativeEthPerKey is a paid mutator transaction binding the contract method 0x1c557f05. -// -// Solidity: function updateConservativeEthPerKey(uint256 _newEthPerKey) returns() -func (_SDUtilityPool *SDUtilityPoolSession) UpdateConservativeEthPerKey(_newEthPerKey *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateConservativeEthPerKey(&_SDUtilityPool.TransactOpts, _newEthPerKey) -} - -// UpdateConservativeEthPerKey is a paid mutator transaction binding the contract method 0x1c557f05. -// -// Solidity: function updateConservativeEthPerKey(uint256 _newEthPerKey) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateConservativeEthPerKey(_newEthPerKey *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateConservativeEthPerKey(&_SDUtilityPool.TransactOpts, _newEthPerKey) -} - -// UpdateFinalizationBatchLimit is a paid mutator transaction binding the contract method 0x267fca73. -// -// Solidity: function updateFinalizationBatchLimit(uint256 _finalizationBatchLimit) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateFinalizationBatchLimit(opts *bind.TransactOpts, _finalizationBatchLimit *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "updateFinalizationBatchLimit", _finalizationBatchLimit) -} - -// UpdateFinalizationBatchLimit is a paid mutator transaction binding the contract method 0x267fca73. -// -// Solidity: function updateFinalizationBatchLimit(uint256 _finalizationBatchLimit) returns() -func (_SDUtilityPool *SDUtilityPoolSession) UpdateFinalizationBatchLimit(_finalizationBatchLimit *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateFinalizationBatchLimit(&_SDUtilityPool.TransactOpts, _finalizationBatchLimit) -} - -// UpdateFinalizationBatchLimit is a paid mutator transaction binding the contract method 0x267fca73. -// -// Solidity: function updateFinalizationBatchLimit(uint256 _finalizationBatchLimit) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateFinalizationBatchLimit(_finalizationBatchLimit *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateFinalizationBatchLimit(&_SDUtilityPool.TransactOpts, _finalizationBatchLimit) -} - -// UpdateMaxETHWorthOfSDPerValidator is a paid mutator transaction binding the contract method 0x5393618e. -// -// Solidity: function updateMaxETHWorthOfSDPerValidator(uint256 _maxETHWorthOfSDPerValidator) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateMaxETHWorthOfSDPerValidator(opts *bind.TransactOpts, _maxETHWorthOfSDPerValidator *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "updateMaxETHWorthOfSDPerValidator", _maxETHWorthOfSDPerValidator) -} - -// UpdateMaxETHWorthOfSDPerValidator is a paid mutator transaction binding the contract method 0x5393618e. -// -// Solidity: function updateMaxETHWorthOfSDPerValidator(uint256 _maxETHWorthOfSDPerValidator) returns() -func (_SDUtilityPool *SDUtilityPoolSession) UpdateMaxETHWorthOfSDPerValidator(_maxETHWorthOfSDPerValidator *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateMaxETHWorthOfSDPerValidator(&_SDUtilityPool.TransactOpts, _maxETHWorthOfSDPerValidator) -} - -// UpdateMaxETHWorthOfSDPerValidator is a paid mutator transaction binding the contract method 0x5393618e. -// -// Solidity: function updateMaxETHWorthOfSDPerValidator(uint256 _maxETHWorthOfSDPerValidator) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateMaxETHWorthOfSDPerValidator(_maxETHWorthOfSDPerValidator *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateMaxETHWorthOfSDPerValidator(&_SDUtilityPool.TransactOpts, _maxETHWorthOfSDPerValidator) -} - -// UpdateMaxNonRedeemedDelegatorRequestCount is a paid mutator transaction binding the contract method 0xee63e5f9. -// -// Solidity: function updateMaxNonRedeemedDelegatorRequestCount(uint256 _count) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateMaxNonRedeemedDelegatorRequestCount(opts *bind.TransactOpts, _count *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "updateMaxNonRedeemedDelegatorRequestCount", _count) -} - -// UpdateMaxNonRedeemedDelegatorRequestCount is a paid mutator transaction binding the contract method 0xee63e5f9. -// -// Solidity: function updateMaxNonRedeemedDelegatorRequestCount(uint256 _count) returns() -func (_SDUtilityPool *SDUtilityPoolSession) UpdateMaxNonRedeemedDelegatorRequestCount(_count *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateMaxNonRedeemedDelegatorRequestCount(&_SDUtilityPool.TransactOpts, _count) -} - -// UpdateMaxNonRedeemedDelegatorRequestCount is a paid mutator transaction binding the contract method 0xee63e5f9. -// -// Solidity: function updateMaxNonRedeemedDelegatorRequestCount(uint256 _count) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateMaxNonRedeemedDelegatorRequestCount(_count *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateMaxNonRedeemedDelegatorRequestCount(&_SDUtilityPool.TransactOpts, _count) -} - -// UpdateMinBlockDelayToFinalizeRequest is a paid mutator transaction binding the contract method 0x4a2965af. -// -// Solidity: function updateMinBlockDelayToFinalizeRequest(uint256 _minBlockDelayToFinalizeRequest) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateMinBlockDelayToFinalizeRequest(opts *bind.TransactOpts, _minBlockDelayToFinalizeRequest *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "updateMinBlockDelayToFinalizeRequest", _minBlockDelayToFinalizeRequest) -} - -// UpdateMinBlockDelayToFinalizeRequest is a paid mutator transaction binding the contract method 0x4a2965af. -// -// Solidity: function updateMinBlockDelayToFinalizeRequest(uint256 _minBlockDelayToFinalizeRequest) returns() -func (_SDUtilityPool *SDUtilityPoolSession) UpdateMinBlockDelayToFinalizeRequest(_minBlockDelayToFinalizeRequest *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateMinBlockDelayToFinalizeRequest(&_SDUtilityPool.TransactOpts, _minBlockDelayToFinalizeRequest) -} - -// UpdateMinBlockDelayToFinalizeRequest is a paid mutator transaction binding the contract method 0x4a2965af. -// -// Solidity: function updateMinBlockDelayToFinalizeRequest(uint256 _minBlockDelayToFinalizeRequest) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateMinBlockDelayToFinalizeRequest(_minBlockDelayToFinalizeRequest *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateMinBlockDelayToFinalizeRequest(&_SDUtilityPool.TransactOpts, _minBlockDelayToFinalizeRequest) -} - -// UpdateProtocolFee is a paid mutator transaction binding the contract method 0x4256dd78. -// -// Solidity: function updateProtocolFee(uint256 _protocolFee) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateProtocolFee(opts *bind.TransactOpts, _protocolFee *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "updateProtocolFee", _protocolFee) -} - -// UpdateProtocolFee is a paid mutator transaction binding the contract method 0x4256dd78. -// -// Solidity: function updateProtocolFee(uint256 _protocolFee) returns() -func (_SDUtilityPool *SDUtilityPoolSession) UpdateProtocolFee(_protocolFee *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateProtocolFee(&_SDUtilityPool.TransactOpts, _protocolFee) -} - -// UpdateProtocolFee is a paid mutator transaction binding the contract method 0x4256dd78. -// -// Solidity: function updateProtocolFee(uint256 _protocolFee) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateProtocolFee(_protocolFee *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateProtocolFee(&_SDUtilityPool.TransactOpts, _protocolFee) -} - -// UpdateRiskConfig is a paid mutator transaction binding the contract method 0x62569a51. -// -// Solidity: function updateRiskConfig(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateRiskConfig(opts *bind.TransactOpts, liquidationThreshold *big.Int, liquidationBonusPercent *big.Int, liquidationFeePercent *big.Int, ltv *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "updateRiskConfig", liquidationThreshold, liquidationBonusPercent, liquidationFeePercent, ltv) -} - -// UpdateRiskConfig is a paid mutator transaction binding the contract method 0x62569a51. -// -// Solidity: function updateRiskConfig(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) returns() -func (_SDUtilityPool *SDUtilityPoolSession) UpdateRiskConfig(liquidationThreshold *big.Int, liquidationBonusPercent *big.Int, liquidationFeePercent *big.Int, ltv *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateRiskConfig(&_SDUtilityPool.TransactOpts, liquidationThreshold, liquidationBonusPercent, liquidationFeePercent, ltv) -} - -// UpdateRiskConfig is a paid mutator transaction binding the contract method 0x62569a51. -// -// Solidity: function updateRiskConfig(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateRiskConfig(liquidationThreshold *big.Int, liquidationBonusPercent *big.Int, liquidationFeePercent *big.Int, ltv *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateRiskConfig(&_SDUtilityPool.TransactOpts, liquidationThreshold, liquidationBonusPercent, liquidationFeePercent, ltv) -} - -// UpdateStaderConfig is a paid mutator transaction binding the contract method 0x9ee804cb. -// -// Solidity: function updateStaderConfig(address _staderConfig) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateStaderConfig(opts *bind.TransactOpts, _staderConfig common.Address) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "updateStaderConfig", _staderConfig) -} - -// UpdateStaderConfig is a paid mutator transaction binding the contract method 0x9ee804cb. -// -// Solidity: function updateStaderConfig(address _staderConfig) returns() -func (_SDUtilityPool *SDUtilityPoolSession) UpdateStaderConfig(_staderConfig common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateStaderConfig(&_SDUtilityPool.TransactOpts, _staderConfig) -} - -// UpdateStaderConfig is a paid mutator transaction binding the contract method 0x9ee804cb. -// -// Solidity: function updateStaderConfig(address _staderConfig) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateStaderConfig(_staderConfig common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateStaderConfig(&_SDUtilityPool.TransactOpts, _staderConfig) -} - -// UpdateUtilizationRatePerBlock is a paid mutator transaction binding the contract method 0xcb2d89dd. -// -// Solidity: function updateUtilizationRatePerBlock(uint256 _utilizationRatePerBlock) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateUtilizationRatePerBlock(opts *bind.TransactOpts, _utilizationRatePerBlock *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "updateUtilizationRatePerBlock", _utilizationRatePerBlock) -} - -// UpdateUtilizationRatePerBlock is a paid mutator transaction binding the contract method 0xcb2d89dd. -// -// Solidity: function updateUtilizationRatePerBlock(uint256 _utilizationRatePerBlock) returns() -func (_SDUtilityPool *SDUtilityPoolSession) UpdateUtilizationRatePerBlock(_utilizationRatePerBlock *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateUtilizationRatePerBlock(&_SDUtilityPool.TransactOpts, _utilizationRatePerBlock) -} - -// UpdateUtilizationRatePerBlock is a paid mutator transaction binding the contract method 0xcb2d89dd. -// -// Solidity: function updateUtilizationRatePerBlock(uint256 _utilizationRatePerBlock) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateUtilizationRatePerBlock(_utilizationRatePerBlock *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateUtilizationRatePerBlock(&_SDUtilityPool.TransactOpts, _utilizationRatePerBlock) -} - -// Utilize is a paid mutator transaction binding the contract method 0xec29c551. -// -// Solidity: function utilize(uint256 utilizeAmount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) Utilize(opts *bind.TransactOpts, utilizeAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "utilize", utilizeAmount) -} - -// Utilize is a paid mutator transaction binding the contract method 0xec29c551. -// -// Solidity: function utilize(uint256 utilizeAmount) returns() -func (_SDUtilityPool *SDUtilityPoolSession) Utilize(utilizeAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Utilize(&_SDUtilityPool.TransactOpts, utilizeAmount) -} - -// Utilize is a paid mutator transaction binding the contract method 0xec29c551. -// -// Solidity: function utilize(uint256 utilizeAmount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) Utilize(utilizeAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Utilize(&_SDUtilityPool.TransactOpts, utilizeAmount) -} - -// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. -// -// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) UtilizeWhileAddingKeys(opts *bind.TransactOpts, operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "utilizeWhileAddingKeys", operator, utilizeAmount, nonTerminalKeyCount) -} - -// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. -// -// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() -func (_SDUtilityPool *SDUtilityPoolSession) UtilizeWhileAddingKeys(operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UtilizeWhileAddingKeys(&_SDUtilityPool.TransactOpts, operator, utilizeAmount, nonTerminalKeyCount) -} - -// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. -// -// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UtilizeWhileAddingKeys(operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UtilizeWhileAddingKeys(&_SDUtilityPool.TransactOpts, operator, utilizeAmount, nonTerminalKeyCount) -} - -// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. -// -// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactor) UtilizerBalanceCurrent(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "utilizerBalanceCurrent", account) -} - -// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. -// -// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) UtilizerBalanceCurrent(account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UtilizerBalanceCurrent(&_SDUtilityPool.TransactOpts, account) -} - -// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. -// -// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UtilizerBalanceCurrent(account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UtilizerBalanceCurrent(&_SDUtilityPool.TransactOpts, account) -} - -// WithdrawProtocolFee is a paid mutator transaction binding the contract method 0x424cd833. -// -// Solidity: function withdrawProtocolFee(uint256 _amount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) WithdrawProtocolFee(opts *bind.TransactOpts, _amount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "withdrawProtocolFee", _amount) -} - -// WithdrawProtocolFee is a paid mutator transaction binding the contract method 0x424cd833. -// -// Solidity: function withdrawProtocolFee(uint256 _amount) returns() -func (_SDUtilityPool *SDUtilityPoolSession) WithdrawProtocolFee(_amount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.WithdrawProtocolFee(&_SDUtilityPool.TransactOpts, _amount) -} - -// WithdrawProtocolFee is a paid mutator transaction binding the contract method 0x424cd833. -// -// Solidity: function withdrawProtocolFee(uint256 _amount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) WithdrawProtocolFee(_amount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.WithdrawProtocolFee(&_SDUtilityPool.TransactOpts, _amount) -} - -// SDUtilityPoolAccruedFeesIterator is returned from FilterAccruedFees and is used to iterate over the raw logs and unpacked data for AccruedFees events raised by the SDUtilityPool contract. -type SDUtilityPoolAccruedFeesIterator struct { - Event *SDUtilityPoolAccruedFees // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolAccruedFeesIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SDUtilityPoolAccruedFees) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SDUtilityPoolAccruedFees) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolAccruedFeesIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SDUtilityPoolAccruedFeesIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SDUtilityPoolAccruedFees represents a AccruedFees event raised by the SDUtilityPool contract. -type SDUtilityPoolAccruedFees struct { - FeeAccumulated *big.Int - TotalProtocolFee *big.Int - TotalUtilizedSD *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterAccruedFees is a free log retrieval operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. -// -// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterAccruedFees(opts *bind.FilterOpts) (*SDUtilityPoolAccruedFeesIterator, error) { - - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "AccruedFees") - if err != nil { - return nil, err - } - return &SDUtilityPoolAccruedFeesIterator{contract: _SDUtilityPool.contract, event: "AccruedFees", logs: logs, sub: sub}, nil -} - -// WatchAccruedFees is a free log subscription operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. -// -// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchAccruedFees(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolAccruedFees) (event.Subscription, error) { - - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "AccruedFees") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolAccruedFees) - if err := _SDUtilityPool.contract.UnpackLog(event, "AccruedFees", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseAccruedFees is a log parse operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. -// -// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseAccruedFees(log types.Log) (*SDUtilityPoolAccruedFees, error) { - event := new(SDUtilityPoolAccruedFees) - if err := _SDUtilityPool.contract.UnpackLog(event, "AccruedFees", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SDUtilityPoolCompleteLiquidationIterator is returned from FilterCompleteLiquidation and is used to iterate over the raw logs and unpacked data for CompleteLiquidation events raised by the SDUtilityPool contract. -type SDUtilityPoolCompleteLiquidationIterator struct { - Event *SDUtilityPoolCompleteLiquidation // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolCompleteLiquidationIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SDUtilityPoolCompleteLiquidation) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SDUtilityPoolCompleteLiquidation) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolCompleteLiquidationIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SDUtilityPoolCompleteLiquidationIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SDUtilityPoolCompleteLiquidation represents a CompleteLiquidation event raised by the SDUtilityPool contract. -type SDUtilityPoolCompleteLiquidation struct { - Index *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterCompleteLiquidation is a free log retrieval operation binding the contract event 0x2f0c36e8e230af6ceee7ecc30319e10800731fef4913c80afcf23f84b148df5d. -// -// Solidity: event CompleteLiquidation(uint256 indexed index) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterCompleteLiquidation(opts *bind.FilterOpts, index []*big.Int) (*SDUtilityPoolCompleteLiquidationIterator, error) { - - var indexRule []interface{} - for _, indexItem := range index { - indexRule = append(indexRule, indexItem) - } - - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "CompleteLiquidation", indexRule) - if err != nil { - return nil, err - } - return &SDUtilityPoolCompleteLiquidationIterator{contract: _SDUtilityPool.contract, event: "CompleteLiquidation", logs: logs, sub: sub}, nil -} - -// WatchCompleteLiquidation is a free log subscription operation binding the contract event 0x2f0c36e8e230af6ceee7ecc30319e10800731fef4913c80afcf23f84b148df5d. -// -// Solidity: event CompleteLiquidation(uint256 indexed index) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchCompleteLiquidation(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolCompleteLiquidation, index []*big.Int) (event.Subscription, error) { - - var indexRule []interface{} - for _, indexItem := range index { - indexRule = append(indexRule, indexItem) - } - - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "CompleteLiquidation", indexRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolCompleteLiquidation) - if err := _SDUtilityPool.contract.UnpackLog(event, "CompleteLiquidation", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseCompleteLiquidation is a log parse operation binding the contract event 0x2f0c36e8e230af6ceee7ecc30319e10800731fef4913c80afcf23f84b148df5d. -// -// Solidity: event CompleteLiquidation(uint256 indexed index) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseCompleteLiquidation(log types.Log) (*SDUtilityPoolCompleteLiquidation, error) { - event := new(SDUtilityPoolCompleteLiquidation) - if err := _SDUtilityPool.contract.UnpackLog(event, "CompleteLiquidation", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SDUtilityPoolDelegatedIterator is returned from FilterDelegated and is used to iterate over the raw logs and unpacked data for Delegated events raised by the SDUtilityPool contract. -type SDUtilityPoolDelegatedIterator struct { - Event *SDUtilityPoolDelegated // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolDelegatedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SDUtilityPoolDelegated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SDUtilityPoolDelegated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolDelegatedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SDUtilityPoolDelegatedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SDUtilityPoolDelegated represents a Delegated event raised by the SDUtilityPool contract. -type SDUtilityPoolDelegated struct { - Delegator common.Address - SdAmount *big.Int - SdXToMint *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterDelegated is a free log retrieval operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. -// -// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterDelegated(opts *bind.FilterOpts, delegator []common.Address) (*SDUtilityPoolDelegatedIterator, error) { - - var delegatorRule []interface{} - for _, delegatorItem := range delegator { - delegatorRule = append(delegatorRule, delegatorItem) - } - - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Delegated", delegatorRule) - if err != nil { - return nil, err - } - return &SDUtilityPoolDelegatedIterator{contract: _SDUtilityPool.contract, event: "Delegated", logs: logs, sub: sub}, nil -} - -// WatchDelegated is a free log subscription operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. -// -// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchDelegated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolDelegated, delegator []common.Address) (event.Subscription, error) { - - var delegatorRule []interface{} - for _, delegatorItem := range delegator { - delegatorRule = append(delegatorRule, delegatorItem) - } - - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Delegated", delegatorRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolDelegated) - if err := _SDUtilityPool.contract.UnpackLog(event, "Delegated", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseDelegated is a log parse operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. -// -// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseDelegated(log types.Log) (*SDUtilityPoolDelegated, error) { - event := new(SDUtilityPoolDelegated) - if err := _SDUtilityPool.contract.UnpackLog(event, "Delegated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SDUtilityPoolFinalizedWithdrawRequestIterator is returned from FilterFinalizedWithdrawRequest and is used to iterate over the raw logs and unpacked data for FinalizedWithdrawRequest events raised by the SDUtilityPool contract. -type SDUtilityPoolFinalizedWithdrawRequestIterator struct { - Event *SDUtilityPoolFinalizedWithdrawRequest // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SDUtilityPoolFinalizedWithdrawRequest) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SDUtilityPoolFinalizedWithdrawRequest) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SDUtilityPoolFinalizedWithdrawRequest represents a FinalizedWithdrawRequest event raised by the SDUtilityPool contract. -type SDUtilityPoolFinalizedWithdrawRequest struct { - NextRequestIdToFinalize *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterFinalizedWithdrawRequest is a free log retrieval operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. -// -// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterFinalizedWithdrawRequest(opts *bind.FilterOpts) (*SDUtilityPoolFinalizedWithdrawRequestIterator, error) { - - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "FinalizedWithdrawRequest") - if err != nil { - return nil, err - } - return &SDUtilityPoolFinalizedWithdrawRequestIterator{contract: _SDUtilityPool.contract, event: "FinalizedWithdrawRequest", logs: logs, sub: sub}, nil -} - -// WatchFinalizedWithdrawRequest is a free log subscription operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. -// -// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchFinalizedWithdrawRequest(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolFinalizedWithdrawRequest) (event.Subscription, error) { - - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "FinalizedWithdrawRequest") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolFinalizedWithdrawRequest) - if err := _SDUtilityPool.contract.UnpackLog(event, "FinalizedWithdrawRequest", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseFinalizedWithdrawRequest is a log parse operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. -// -// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseFinalizedWithdrawRequest(log types.Log) (*SDUtilityPoolFinalizedWithdrawRequest, error) { - event := new(SDUtilityPoolFinalizedWithdrawRequest) - if err := _SDUtilityPool.contract.UnpackLog(event, "FinalizedWithdrawRequest", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SDUtilityPoolInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the SDUtilityPool contract. -type SDUtilityPoolInitializedIterator struct { - Event *SDUtilityPoolInitialized // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolInitializedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SDUtilityPoolInitialized) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SDUtilityPoolInitialized) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolInitializedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SDUtilityPoolInitializedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SDUtilityPoolInitialized represents a Initialized event raised by the SDUtilityPool contract. -type SDUtilityPoolInitialized struct { - Version uint8 - Raw types.Log // Blockchain specific contextual infos +// Solidity: function updateProtocolFee(uint256 _protocolFee) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateProtocolFee(_protocolFee *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateProtocolFee(&_SDUtilityPool.TransactOpts, _protocolFee) } -// FilterInitialized is a free log retrieval operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// UpdateProtocolFee is a paid mutator transaction binding the contract method 0x4256dd78. // -// Solidity: event Initialized(uint8 version) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterInitialized(opts *bind.FilterOpts) (*SDUtilityPoolInitializedIterator, error) { - - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Initialized") - if err != nil { - return nil, err - } - return &SDUtilityPoolInitializedIterator{contract: _SDUtilityPool.contract, event: "Initialized", logs: logs, sub: sub}, nil +// Solidity: function updateProtocolFee(uint256 _protocolFee) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateProtocolFee(_protocolFee *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateProtocolFee(&_SDUtilityPool.TransactOpts, _protocolFee) } -// WatchInitialized is a free log subscription operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// UpdateStaderConfig is a paid mutator transaction binding the contract method 0x9ee804cb. // -// Solidity: event Initialized(uint8 version) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolInitialized) (event.Subscription, error) { - - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Initialized") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolInitialized) - if err := _SDUtilityPool.contract.UnpackLog(event, "Initialized", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil +// Solidity: function updateStaderConfig(address _staderConfig) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateStaderConfig(opts *bind.TransactOpts, _staderConfig common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateStaderConfig", _staderConfig) } -// ParseInitialized is a log parse operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// UpdateStaderConfig is a paid mutator transaction binding the contract method 0x9ee804cb. // -// Solidity: event Initialized(uint8 version) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseInitialized(log types.Log) (*SDUtilityPoolInitialized, error) { - event := new(SDUtilityPoolInitialized) - if err := _SDUtilityPool.contract.UnpackLog(event, "Initialized", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SDUtilityPoolLiquidationCallIterator is returned from FilterLiquidationCall and is used to iterate over the raw logs and unpacked data for LiquidationCall events raised by the SDUtilityPool contract. -type SDUtilityPoolLiquidationCallIterator struct { - Event *SDUtilityPoolLiquidationCall // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolLiquidationCallIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SDUtilityPoolLiquidationCall) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true +// Solidity: function updateStaderConfig(address _staderConfig) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateStaderConfig(_staderConfig common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateStaderConfig(&_SDUtilityPool.TransactOpts, _staderConfig) +} - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SDUtilityPoolLiquidationCall) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true +// UpdateStaderConfig is a paid mutator transaction binding the contract method 0x9ee804cb. +// +// Solidity: function updateStaderConfig(address _staderConfig) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateStaderConfig(_staderConfig common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateStaderConfig(&_SDUtilityPool.TransactOpts, _staderConfig) +} - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } +// UpdateUtilizationRatePerBlock is a paid mutator transaction binding the contract method 0xcb2d89dd. +// +// Solidity: function updateUtilizationRatePerBlock(uint256 _utilizationRatePerBlock) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateUtilizationRatePerBlock(opts *bind.TransactOpts, _utilizationRatePerBlock *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateUtilizationRatePerBlock", _utilizationRatePerBlock) } -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolLiquidationCallIterator) Error() error { - return it.fail +// UpdateUtilizationRatePerBlock is a paid mutator transaction binding the contract method 0xcb2d89dd. +// +// Solidity: function updateUtilizationRatePerBlock(uint256 _utilizationRatePerBlock) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateUtilizationRatePerBlock(_utilizationRatePerBlock *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateUtilizationRatePerBlock(&_SDUtilityPool.TransactOpts, _utilizationRatePerBlock) } -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SDUtilityPoolLiquidationCallIterator) Close() error { - it.sub.Unsubscribe() - return nil +// UpdateUtilizationRatePerBlock is a paid mutator transaction binding the contract method 0xcb2d89dd. +// +// Solidity: function updateUtilizationRatePerBlock(uint256 _utilizationRatePerBlock) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateUtilizationRatePerBlock(_utilizationRatePerBlock *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateUtilizationRatePerBlock(&_SDUtilityPool.TransactOpts, _utilizationRatePerBlock) } -// SDUtilityPoolLiquidationCall represents a LiquidationCall event raised by the SDUtilityPool contract. -type SDUtilityPoolLiquidationCall struct { - Account common.Address - TotalLiquidationAmountInEth *big.Int - LiquidationBonusInEth *big.Int - LiquidationFeeInEth *big.Int - Liquidator common.Address - Raw types.Log // Blockchain specific contextual infos +// Utilize is a paid mutator transaction binding the contract method 0xec29c551. +// +// Solidity: function utilize(uint256 utilizeAmount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) Utilize(opts *bind.TransactOpts, utilizeAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "utilize", utilizeAmount) } -// FilterLiquidationCall is a free log retrieval operation binding the contract event 0xcc9de8be9ac1f02b70a8ca2612f451a769d6d160ad91de17dcc38e54c567a532. +// Utilize is a paid mutator transaction binding the contract method 0xec29c551. // -// Solidity: event LiquidationCall(address indexed account, uint256 totalLiquidationAmountInEth, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth, address indexed liquidator) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterLiquidationCall(opts *bind.FilterOpts, account []common.Address, liquidator []common.Address) (*SDUtilityPoolLiquidationCallIterator, error) { +// Solidity: function utilize(uint256 utilizeAmount) returns() +func (_SDUtilityPool *SDUtilityPoolSession) Utilize(utilizeAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Utilize(&_SDUtilityPool.TransactOpts, utilizeAmount) +} - var accountRule []interface{} - for _, accountItem := range account { - accountRule = append(accountRule, accountItem) - } +// Utilize is a paid mutator transaction binding the contract method 0xec29c551. +// +// Solidity: function utilize(uint256 utilizeAmount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Utilize(utilizeAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Utilize(&_SDUtilityPool.TransactOpts, utilizeAmount) +} - var liquidatorRule []interface{} - for _, liquidatorItem := range liquidator { - liquidatorRule = append(liquidatorRule, liquidatorItem) - } +// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. +// +// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UtilizeWhileAddingKeys(opts *bind.TransactOpts, operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "utilizeWhileAddingKeys", operator, utilizeAmount, nonTerminalKeyCount) +} - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "LiquidationCall", accountRule, liquidatorRule) - if err != nil { - return nil, err - } - return &SDUtilityPoolLiquidationCallIterator{contract: _SDUtilityPool.contract, event: "LiquidationCall", logs: logs, sub: sub}, nil +// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. +// +// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UtilizeWhileAddingKeys(operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UtilizeWhileAddingKeys(&_SDUtilityPool.TransactOpts, operator, utilizeAmount, nonTerminalKeyCount) } -// WatchLiquidationCall is a free log subscription operation binding the contract event 0xcc9de8be9ac1f02b70a8ca2612f451a769d6d160ad91de17dcc38e54c567a532. +// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. // -// Solidity: event LiquidationCall(address indexed account, uint256 totalLiquidationAmountInEth, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth, address indexed liquidator) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchLiquidationCall(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolLiquidationCall, account []common.Address, liquidator []common.Address) (event.Subscription, error) { +// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UtilizeWhileAddingKeys(operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UtilizeWhileAddingKeys(&_SDUtilityPool.TransactOpts, operator, utilizeAmount, nonTerminalKeyCount) +} - var accountRule []interface{} - for _, accountItem := range account { - accountRule = append(accountRule, accountItem) - } +// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. +// +// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactor) UtilizerBalanceCurrent(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "utilizerBalanceCurrent", account) +} - var liquidatorRule []interface{} - for _, liquidatorItem := range liquidator { - liquidatorRule = append(liquidatorRule, liquidatorItem) - } +// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. +// +// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) UtilizerBalanceCurrent(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UtilizerBalanceCurrent(&_SDUtilityPool.TransactOpts, account) +} - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "LiquidationCall", accountRule, liquidatorRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolLiquidationCall) - if err := _SDUtilityPool.contract.UnpackLog(event, "LiquidationCall", log); err != nil { - return err - } - event.Raw = log +// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. +// +// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UtilizerBalanceCurrent(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UtilizerBalanceCurrent(&_SDUtilityPool.TransactOpts, account) +} - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil +// WithdrawProtocolFee is a paid mutator transaction binding the contract method 0x424cd833. +// +// Solidity: function withdrawProtocolFee(uint256 _amount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) WithdrawProtocolFee(opts *bind.TransactOpts, _amount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "withdrawProtocolFee", _amount) } -// ParseLiquidationCall is a log parse operation binding the contract event 0xcc9de8be9ac1f02b70a8ca2612f451a769d6d160ad91de17dcc38e54c567a532. +// WithdrawProtocolFee is a paid mutator transaction binding the contract method 0x424cd833. // -// Solidity: event LiquidationCall(address indexed account, uint256 totalLiquidationAmountInEth, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth, address indexed liquidator) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseLiquidationCall(log types.Log) (*SDUtilityPoolLiquidationCall, error) { - event := new(SDUtilityPoolLiquidationCall) - if err := _SDUtilityPool.contract.UnpackLog(event, "LiquidationCall", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil +// Solidity: function withdrawProtocolFee(uint256 _amount) returns() +func (_SDUtilityPool *SDUtilityPoolSession) WithdrawProtocolFee(_amount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.WithdrawProtocolFee(&_SDUtilityPool.TransactOpts, _amount) +} + +// WithdrawProtocolFee is a paid mutator transaction binding the contract method 0x424cd833. +// +// Solidity: function withdrawProtocolFee(uint256 _amount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) WithdrawProtocolFee(_amount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.WithdrawProtocolFee(&_SDUtilityPool.TransactOpts, _amount) } -// SDUtilityPoolPausedIterator is returned from FilterPaused and is used to iterate over the raw logs and unpacked data for Paused events raised by the SDUtilityPool contract. -type SDUtilityPoolPausedIterator struct { - Event *SDUtilityPoolPaused // Event containing the contract specifics and raw log +// SDUtilityPoolAccruedFeesIterator is returned from FilterAccruedFees and is used to iterate over the raw logs and unpacked data for AccruedFees events raised by the SDUtilityPool contract. +type SDUtilityPoolAccruedFeesIterator struct { + Event *SDUtilityPoolAccruedFees // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -3213,7 +1474,7 @@ type SDUtilityPoolPausedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolPausedIterator) Next() bool { +func (it *SDUtilityPoolAccruedFeesIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -3222,7 +1483,7 @@ func (it *SDUtilityPoolPausedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolPaused) + it.Event = new(SDUtilityPoolAccruedFees) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -3237,7 +1498,7 @@ func (it *SDUtilityPoolPausedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolPaused) + it.Event = new(SDUtilityPoolAccruedFees) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -3253,41 +1514,43 @@ func (it *SDUtilityPoolPausedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolPausedIterator) Error() error { +func (it *SDUtilityPoolAccruedFeesIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolPausedIterator) Close() error { +func (it *SDUtilityPoolAccruedFeesIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolPaused represents a Paused event raised by the SDUtilityPool contract. -type SDUtilityPoolPaused struct { - Account common.Address - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolAccruedFees represents a AccruedFees event raised by the SDUtilityPool contract. +type SDUtilityPoolAccruedFees struct { + FeeAccumulated *big.Int + TotalProtocolFee *big.Int + TotalUtilizedSD *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterPaused is a free log retrieval operation binding the contract event 0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258. +// FilterAccruedFees is a free log retrieval operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. // -// Solidity: event Paused(address account) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterPaused(opts *bind.FilterOpts) (*SDUtilityPoolPausedIterator, error) { +// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterAccruedFees(opts *bind.FilterOpts) (*SDUtilityPoolAccruedFeesIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Paused") + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "AccruedFees") if err != nil { return nil, err } - return &SDUtilityPoolPausedIterator{contract: _SDUtilityPool.contract, event: "Paused", logs: logs, sub: sub}, nil + return &SDUtilityPoolAccruedFeesIterator{contract: _SDUtilityPool.contract, event: "AccruedFees", logs: logs, sub: sub}, nil } -// WatchPaused is a free log subscription operation binding the contract event 0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258. +// WatchAccruedFees is a free log subscription operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. // -// Solidity: event Paused(address account) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchPaused(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolPaused) (event.Subscription, error) { +// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchAccruedFees(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolAccruedFees) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Paused") + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "AccruedFees") if err != nil { return nil, err } @@ -3297,8 +1560,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchPaused(opts *bind.WatchOpts, s select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolPaused) - if err := _SDUtilityPool.contract.UnpackLog(event, "Paused", log); err != nil { + event := new(SDUtilityPoolAccruedFees) + if err := _SDUtilityPool.contract.UnpackLog(event, "AccruedFees", log); err != nil { return err } event.Raw = log @@ -3319,21 +1582,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchPaused(opts *bind.WatchOpts, s }), nil } -// ParsePaused is a log parse operation binding the contract event 0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258. +// ParseAccruedFees is a log parse operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. // -// Solidity: event Paused(address account) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParsePaused(log types.Log) (*SDUtilityPoolPaused, error) { - event := new(SDUtilityPoolPaused) - if err := _SDUtilityPool.contract.UnpackLog(event, "Paused", log); err != nil { +// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseAccruedFees(log types.Log) (*SDUtilityPoolAccruedFees, error) { + event := new(SDUtilityPoolAccruedFees) + if err := _SDUtilityPool.contract.UnpackLog(event, "AccruedFees", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolProtocolFeeFactorUpdatedIterator is returned from FilterProtocolFeeFactorUpdated and is used to iterate over the raw logs and unpacked data for ProtocolFeeFactorUpdated events raised by the SDUtilityPool contract. -type SDUtilityPoolProtocolFeeFactorUpdatedIterator struct { - Event *SDUtilityPoolProtocolFeeFactorUpdated // Event containing the contract specifics and raw log +// SDUtilityPoolCompleteLiquidationIterator is returned from FilterCompleteLiquidation and is used to iterate over the raw logs and unpacked data for CompleteLiquidation events raised by the SDUtilityPool contract. +type SDUtilityPoolCompleteLiquidationIterator struct { + Event *SDUtilityPoolCompleteLiquidation // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -3347,7 +1610,7 @@ type SDUtilityPoolProtocolFeeFactorUpdatedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Next() bool { +func (it *SDUtilityPoolCompleteLiquidationIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -3356,7 +1619,7 @@ func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolProtocolFeeFactorUpdated) + it.Event = new(SDUtilityPoolCompleteLiquidation) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -3371,7 +1634,7 @@ func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolProtocolFeeFactorUpdated) + it.Event = new(SDUtilityPoolCompleteLiquidation) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -3387,41 +1650,51 @@ func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Error() error { +func (it *SDUtilityPoolCompleteLiquidationIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Close() error { +func (it *SDUtilityPoolCompleteLiquidationIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolProtocolFeeFactorUpdated represents a ProtocolFeeFactorUpdated event raised by the SDUtilityPool contract. -type SDUtilityPoolProtocolFeeFactorUpdated struct { - ProtocolFeeFactor *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolCompleteLiquidation represents a CompleteLiquidation event raised by the SDUtilityPool contract. +type SDUtilityPoolCompleteLiquidation struct { + Index *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterProtocolFeeFactorUpdated is a free log retrieval operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. +// FilterCompleteLiquidation is a free log retrieval operation binding the contract event 0x2f0c36e8e230af6ceee7ecc30319e10800731fef4913c80afcf23f84b148df5d. // -// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterProtocolFeeFactorUpdated(opts *bind.FilterOpts) (*SDUtilityPoolProtocolFeeFactorUpdatedIterator, error) { +// Solidity: event CompleteLiquidation(uint256 indexed index) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterCompleteLiquidation(opts *bind.FilterOpts, index []*big.Int) (*SDUtilityPoolCompleteLiquidationIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "ProtocolFeeFactorUpdated") + var indexRule []interface{} + for _, indexItem := range index { + indexRule = append(indexRule, indexItem) + } + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "CompleteLiquidation", indexRule) if err != nil { return nil, err } - return &SDUtilityPoolProtocolFeeFactorUpdatedIterator{contract: _SDUtilityPool.contract, event: "ProtocolFeeFactorUpdated", logs: logs, sub: sub}, nil + return &SDUtilityPoolCompleteLiquidationIterator{contract: _SDUtilityPool.contract, event: "CompleteLiquidation", logs: logs, sub: sub}, nil } -// WatchProtocolFeeFactorUpdated is a free log subscription operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. +// WatchCompleteLiquidation is a free log subscription operation binding the contract event 0x2f0c36e8e230af6ceee7ecc30319e10800731fef4913c80afcf23f84b148df5d. // -// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchProtocolFeeFactorUpdated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolProtocolFeeFactorUpdated) (event.Subscription, error) { +// Solidity: event CompleteLiquidation(uint256 indexed index) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchCompleteLiquidation(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolCompleteLiquidation, index []*big.Int) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "ProtocolFeeFactorUpdated") + var indexRule []interface{} + for _, indexItem := range index { + indexRule = append(indexRule, indexItem) + } + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "CompleteLiquidation", indexRule) if err != nil { return nil, err } @@ -3431,8 +1704,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchProtocolFeeFactorUpdated(opts select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolProtocolFeeFactorUpdated) - if err := _SDUtilityPool.contract.UnpackLog(event, "ProtocolFeeFactorUpdated", log); err != nil { + event := new(SDUtilityPoolCompleteLiquidation) + if err := _SDUtilityPool.contract.UnpackLog(event, "CompleteLiquidation", log); err != nil { return err } event.Raw = log @@ -3453,21 +1726,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchProtocolFeeFactorUpdated(opts }), nil } -// ParseProtocolFeeFactorUpdated is a log parse operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. +// ParseCompleteLiquidation is a log parse operation binding the contract event 0x2f0c36e8e230af6ceee7ecc30319e10800731fef4913c80afcf23f84b148df5d. // -// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseProtocolFeeFactorUpdated(log types.Log) (*SDUtilityPoolProtocolFeeFactorUpdated, error) { - event := new(SDUtilityPoolProtocolFeeFactorUpdated) - if err := _SDUtilityPool.contract.UnpackLog(event, "ProtocolFeeFactorUpdated", log); err != nil { +// Solidity: event CompleteLiquidation(uint256 indexed index) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseCompleteLiquidation(log types.Log) (*SDUtilityPoolCompleteLiquidation, error) { + event := new(SDUtilityPoolCompleteLiquidation) + if err := _SDUtilityPool.contract.UnpackLog(event, "CompleteLiquidation", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolRedeemedIterator is returned from FilterRedeemed and is used to iterate over the raw logs and unpacked data for Redeemed events raised by the SDUtilityPool contract. -type SDUtilityPoolRedeemedIterator struct { - Event *SDUtilityPoolRedeemed // Event containing the contract specifics and raw log +// SDUtilityPoolDelegatedIterator is returned from FilterDelegated and is used to iterate over the raw logs and unpacked data for Delegated events raised by the SDUtilityPool contract. +type SDUtilityPoolDelegatedIterator struct { + Event *SDUtilityPoolDelegated // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -3481,7 +1754,7 @@ type SDUtilityPoolRedeemedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolRedeemedIterator) Next() bool { +func (it *SDUtilityPoolDelegatedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -3490,7 +1763,7 @@ func (it *SDUtilityPoolRedeemedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRedeemed) + it.Event = new(SDUtilityPoolDelegated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -3505,7 +1778,7 @@ func (it *SDUtilityPoolRedeemedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRedeemed) + it.Event = new(SDUtilityPoolDelegated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -3521,53 +1794,53 @@ func (it *SDUtilityPoolRedeemedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolRedeemedIterator) Error() error { +func (it *SDUtilityPoolDelegatedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolRedeemedIterator) Close() error { +func (it *SDUtilityPoolDelegatedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolRedeemed represents a Redeemed event raised by the SDUtilityPool contract. -type SDUtilityPoolRedeemed struct { +// SDUtilityPoolDelegated represents a Delegated event raised by the SDUtilityPool contract. +type SDUtilityPoolDelegated struct { Delegator common.Address SdAmount *big.Int - SdXAmount *big.Int + SdXToMint *big.Int Raw types.Log // Blockchain specific contextual infos } -// FilterRedeemed is a free log retrieval operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. +// FilterDelegated is a free log retrieval operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. // -// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRedeemed(opts *bind.FilterOpts, delegator []common.Address) (*SDUtilityPoolRedeemedIterator, error) { +// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterDelegated(opts *bind.FilterOpts, delegator []common.Address) (*SDUtilityPoolDelegatedIterator, error) { var delegatorRule []interface{} for _, delegatorItem := range delegator { delegatorRule = append(delegatorRule, delegatorItem) } - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Redeemed", delegatorRule) + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Delegated", delegatorRule) if err != nil { return nil, err } - return &SDUtilityPoolRedeemedIterator{contract: _SDUtilityPool.contract, event: "Redeemed", logs: logs, sub: sub}, nil + return &SDUtilityPoolDelegatedIterator{contract: _SDUtilityPool.contract, event: "Delegated", logs: logs, sub: sub}, nil } -// WatchRedeemed is a free log subscription operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. +// WatchDelegated is a free log subscription operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. // -// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRedeemed(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRedeemed, delegator []common.Address) (event.Subscription, error) { +// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchDelegated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolDelegated, delegator []common.Address) (event.Subscription, error) { var delegatorRule []interface{} for _, delegatorItem := range delegator { delegatorRule = append(delegatorRule, delegatorItem) } - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Redeemed", delegatorRule) + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Delegated", delegatorRule) if err != nil { return nil, err } @@ -3577,8 +1850,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRedeemed(opts *bind.WatchOpts, select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolRedeemed) - if err := _SDUtilityPool.contract.UnpackLog(event, "Redeemed", log); err != nil { + event := new(SDUtilityPoolDelegated) + if err := _SDUtilityPool.contract.UnpackLog(event, "Delegated", log); err != nil { return err } event.Raw = log @@ -3599,21 +1872,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRedeemed(opts *bind.WatchOpts, }), nil } -// ParseRedeemed is a log parse operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. +// ParseDelegated is a log parse operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. // -// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRedeemed(log types.Log) (*SDUtilityPoolRedeemed, error) { - event := new(SDUtilityPoolRedeemed) - if err := _SDUtilityPool.contract.UnpackLog(event, "Redeemed", log); err != nil { +// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseDelegated(log types.Log) (*SDUtilityPoolDelegated, error) { + event := new(SDUtilityPoolDelegated) + if err := _SDUtilityPool.contract.UnpackLog(event, "Delegated", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolRepaidIterator is returned from FilterRepaid and is used to iterate over the raw logs and unpacked data for Repaid events raised by the SDUtilityPool contract. -type SDUtilityPoolRepaidIterator struct { - Event *SDUtilityPoolRepaid // Event containing the contract specifics and raw log +// SDUtilityPoolFinalizedWithdrawRequestIterator is returned from FilterFinalizedWithdrawRequest and is used to iterate over the raw logs and unpacked data for FinalizedWithdrawRequest events raised by the SDUtilityPool contract. +type SDUtilityPoolFinalizedWithdrawRequestIterator struct { + Event *SDUtilityPoolFinalizedWithdrawRequest // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -3627,7 +1900,7 @@ type SDUtilityPoolRepaidIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolRepaidIterator) Next() bool { +func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -3636,7 +1909,7 @@ func (it *SDUtilityPoolRepaidIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRepaid) + it.Event = new(SDUtilityPoolFinalizedWithdrawRequest) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -3651,7 +1924,7 @@ func (it *SDUtilityPoolRepaidIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRepaid) + it.Event = new(SDUtilityPoolFinalizedWithdrawRequest) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -3667,52 +1940,41 @@ func (it *SDUtilityPoolRepaidIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolRepaidIterator) Error() error { +func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolRepaidIterator) Close() error { +func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolRepaid represents a Repaid event raised by the SDUtilityPool contract. -type SDUtilityPoolRepaid struct { - Utilizer common.Address - RepayAmount *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolFinalizedWithdrawRequest represents a FinalizedWithdrawRequest event raised by the SDUtilityPool contract. +type SDUtilityPoolFinalizedWithdrawRequest struct { + NextRequestIdToFinalize *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterRepaid is a free log retrieval operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. +// FilterFinalizedWithdrawRequest is a free log retrieval operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. // -// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRepaid(opts *bind.FilterOpts, utilizer []common.Address) (*SDUtilityPoolRepaidIterator, error) { - - var utilizerRule []interface{} - for _, utilizerItem := range utilizer { - utilizerRule = append(utilizerRule, utilizerItem) - } +// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterFinalizedWithdrawRequest(opts *bind.FilterOpts) (*SDUtilityPoolFinalizedWithdrawRequestIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Repaid", utilizerRule) + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "FinalizedWithdrawRequest") if err != nil { return nil, err } - return &SDUtilityPoolRepaidIterator{contract: _SDUtilityPool.contract, event: "Repaid", logs: logs, sub: sub}, nil + return &SDUtilityPoolFinalizedWithdrawRequestIterator{contract: _SDUtilityPool.contract, event: "FinalizedWithdrawRequest", logs: logs, sub: sub}, nil } -// WatchRepaid is a free log subscription operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. +// WatchFinalizedWithdrawRequest is a free log subscription operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. // -// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRepaid(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRepaid, utilizer []common.Address) (event.Subscription, error) { - - var utilizerRule []interface{} - for _, utilizerItem := range utilizer { - utilizerRule = append(utilizerRule, utilizerItem) - } +// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchFinalizedWithdrawRequest(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolFinalizedWithdrawRequest) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Repaid", utilizerRule) + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "FinalizedWithdrawRequest") if err != nil { return nil, err } @@ -3722,8 +1984,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRepaid(opts *bind.WatchOpts, s select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolRepaid) - if err := _SDUtilityPool.contract.UnpackLog(event, "Repaid", log); err != nil { + event := new(SDUtilityPoolFinalizedWithdrawRequest) + if err := _SDUtilityPool.contract.UnpackLog(event, "FinalizedWithdrawRequest", log); err != nil { return err } event.Raw = log @@ -3744,21 +2006,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRepaid(opts *bind.WatchOpts, s }), nil } -// ParseRepaid is a log parse operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. +// ParseFinalizedWithdrawRequest is a log parse operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. // -// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRepaid(log types.Log) (*SDUtilityPoolRepaid, error) { - event := new(SDUtilityPoolRepaid) - if err := _SDUtilityPool.contract.UnpackLog(event, "Repaid", log); err != nil { +// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseFinalizedWithdrawRequest(log types.Log) (*SDUtilityPoolFinalizedWithdrawRequest, error) { + event := new(SDUtilityPoolFinalizedWithdrawRequest) + if err := _SDUtilityPool.contract.UnpackLog(event, "FinalizedWithdrawRequest", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolRequestRedeemedIterator is returned from FilterRequestRedeemed and is used to iterate over the raw logs and unpacked data for RequestRedeemed events raised by the SDUtilityPool contract. -type SDUtilityPoolRequestRedeemedIterator struct { - Event *SDUtilityPoolRequestRedeemed // Event containing the contract specifics and raw log +// SDUtilityPoolLiquidationCallIterator is returned from FilterLiquidationCall and is used to iterate over the raw logs and unpacked data for LiquidationCall events raised by the SDUtilityPool contract. +type SDUtilityPoolLiquidationCallIterator struct { + Event *SDUtilityPoolLiquidationCall // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -3772,7 +2034,7 @@ type SDUtilityPoolRequestRedeemedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { +func (it *SDUtilityPoolLiquidationCallIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -3781,7 +2043,7 @@ func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRequestRedeemed) + it.Event = new(SDUtilityPoolLiquidationCall) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -3796,7 +2058,7 @@ func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRequestRedeemed) + it.Event = new(SDUtilityPoolLiquidationCall) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -3812,42 +2074,65 @@ func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolRequestRedeemedIterator) Error() error { +func (it *SDUtilityPoolLiquidationCallIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolRequestRedeemedIterator) Close() error { +func (it *SDUtilityPoolLiquidationCallIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolRequestRedeemed represents a RequestRedeemed event raised by the SDUtilityPool contract. -type SDUtilityPoolRequestRedeemed struct { - Caller common.Address - SdToTransfer *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolLiquidationCall represents a LiquidationCall event raised by the SDUtilityPool contract. +type SDUtilityPoolLiquidationCall struct { + Account common.Address + TotalLiquidationAmountInEth *big.Int + LiquidationBonusInEth *big.Int + LiquidationFeeInEth *big.Int + Liquidator common.Address + Raw types.Log // Blockchain specific contextual infos } -// FilterRequestRedeemed is a free log retrieval operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. +// FilterLiquidationCall is a free log retrieval operation binding the contract event 0xcc9de8be9ac1f02b70a8ca2612f451a769d6d160ad91de17dcc38e54c567a532. // -// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRequestRedeemed(opts *bind.FilterOpts) (*SDUtilityPoolRequestRedeemedIterator, error) { +// Solidity: event LiquidationCall(address indexed account, uint256 totalLiquidationAmountInEth, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth, address indexed liquidator) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterLiquidationCall(opts *bind.FilterOpts, account []common.Address, liquidator []common.Address) (*SDUtilityPoolLiquidationCallIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RequestRedeemed") + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + var liquidatorRule []interface{} + for _, liquidatorItem := range liquidator { + liquidatorRule = append(liquidatorRule, liquidatorItem) + } + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "LiquidationCall", accountRule, liquidatorRule) if err != nil { return nil, err } - return &SDUtilityPoolRequestRedeemedIterator{contract: _SDUtilityPool.contract, event: "RequestRedeemed", logs: logs, sub: sub}, nil + return &SDUtilityPoolLiquidationCallIterator{contract: _SDUtilityPool.contract, event: "LiquidationCall", logs: logs, sub: sub}, nil } -// WatchRequestRedeemed is a free log subscription operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. +// WatchLiquidationCall is a free log subscription operation binding the contract event 0xcc9de8be9ac1f02b70a8ca2612f451a769d6d160ad91de17dcc38e54c567a532. // -// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRequestRedeemed(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRequestRedeemed) (event.Subscription, error) { +// Solidity: event LiquidationCall(address indexed account, uint256 totalLiquidationAmountInEth, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth, address indexed liquidator) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchLiquidationCall(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolLiquidationCall, account []common.Address, liquidator []common.Address) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RequestRedeemed") + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + var liquidatorRule []interface{} + for _, liquidatorItem := range liquidator { + liquidatorRule = append(liquidatorRule, liquidatorItem) + } + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "LiquidationCall", accountRule, liquidatorRule) if err != nil { return nil, err } @@ -3857,8 +2142,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRequestRedeemed(opts *bind.Wat select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolRequestRedeemed) - if err := _SDUtilityPool.contract.UnpackLog(event, "RequestRedeemed", log); err != nil { + event := new(SDUtilityPoolLiquidationCall) + if err := _SDUtilityPool.contract.UnpackLog(event, "LiquidationCall", log); err != nil { return err } event.Raw = log @@ -3879,21 +2164,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRequestRedeemed(opts *bind.Wat }), nil } -// ParseRequestRedeemed is a log parse operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. +// ParseLiquidationCall is a log parse operation binding the contract event 0xcc9de8be9ac1f02b70a8ca2612f451a769d6d160ad91de17dcc38e54c567a532. // -// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRequestRedeemed(log types.Log) (*SDUtilityPoolRequestRedeemed, error) { - event := new(SDUtilityPoolRequestRedeemed) - if err := _SDUtilityPool.contract.UnpackLog(event, "RequestRedeemed", log); err != nil { +// Solidity: event LiquidationCall(address indexed account, uint256 totalLiquidationAmountInEth, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth, address indexed liquidator) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseLiquidationCall(log types.Log) (*SDUtilityPoolLiquidationCall, error) { + event := new(SDUtilityPoolLiquidationCall) + if err := _SDUtilityPool.contract.UnpackLog(event, "LiquidationCall", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolRiskConfigUpdatedIterator is returned from FilterRiskConfigUpdated and is used to iterate over the raw logs and unpacked data for RiskConfigUpdated events raised by the SDUtilityPool contract. -type SDUtilityPoolRiskConfigUpdatedIterator struct { - Event *SDUtilityPoolRiskConfigUpdated // Event containing the contract specifics and raw log +// SDUtilityPoolProtocolFeeFactorUpdatedIterator is returned from FilterProtocolFeeFactorUpdated and is used to iterate over the raw logs and unpacked data for ProtocolFeeFactorUpdated events raised by the SDUtilityPool contract. +type SDUtilityPoolProtocolFeeFactorUpdatedIterator struct { + Event *SDUtilityPoolProtocolFeeFactorUpdated // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -3907,7 +2192,7 @@ type SDUtilityPoolRiskConfigUpdatedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolRiskConfigUpdatedIterator) Next() bool { +func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -3916,7 +2201,7 @@ func (it *SDUtilityPoolRiskConfigUpdatedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRiskConfigUpdated) + it.Event = new(SDUtilityPoolProtocolFeeFactorUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -3931,7 +2216,7 @@ func (it *SDUtilityPoolRiskConfigUpdatedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRiskConfigUpdated) + it.Event = new(SDUtilityPoolProtocolFeeFactorUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -3947,44 +2232,41 @@ func (it *SDUtilityPoolRiskConfigUpdatedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolRiskConfigUpdatedIterator) Error() error { +func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolRiskConfigUpdatedIterator) Close() error { +func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolRiskConfigUpdated represents a RiskConfigUpdated event raised by the SDUtilityPool contract. -type SDUtilityPoolRiskConfigUpdated struct { - LiquidationThreshold *big.Int - LiquidationBonusPercent *big.Int - LiquidationFeePercent *big.Int - Ltv *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterRiskConfigUpdated is a free log retrieval operation binding the contract event 0x62dd46f943681bd727e339f4baaa19fb66ea209fbe7d9b4a75aa74c33acc18f3. +// SDUtilityPoolProtocolFeeFactorUpdated represents a ProtocolFeeFactorUpdated event raised by the SDUtilityPool contract. +type SDUtilityPoolProtocolFeeFactorUpdated struct { + ProtocolFeeFactor *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterProtocolFeeFactorUpdated is a free log retrieval operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. // -// Solidity: event RiskConfigUpdated(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRiskConfigUpdated(opts *bind.FilterOpts) (*SDUtilityPoolRiskConfigUpdatedIterator, error) { +// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterProtocolFeeFactorUpdated(opts *bind.FilterOpts) (*SDUtilityPoolProtocolFeeFactorUpdatedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RiskConfigUpdated") + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "ProtocolFeeFactorUpdated") if err != nil { return nil, err } - return &SDUtilityPoolRiskConfigUpdatedIterator{contract: _SDUtilityPool.contract, event: "RiskConfigUpdated", logs: logs, sub: sub}, nil + return &SDUtilityPoolProtocolFeeFactorUpdatedIterator{contract: _SDUtilityPool.contract, event: "ProtocolFeeFactorUpdated", logs: logs, sub: sub}, nil } -// WatchRiskConfigUpdated is a free log subscription operation binding the contract event 0x62dd46f943681bd727e339f4baaa19fb66ea209fbe7d9b4a75aa74c33acc18f3. +// WatchProtocolFeeFactorUpdated is a free log subscription operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. // -// Solidity: event RiskConfigUpdated(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRiskConfigUpdated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRiskConfigUpdated) (event.Subscription, error) { +// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchProtocolFeeFactorUpdated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolProtocolFeeFactorUpdated) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RiskConfigUpdated") + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "ProtocolFeeFactorUpdated") if err != nil { return nil, err } @@ -3994,8 +2276,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRiskConfigUpdated(opts *bind.W select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolRiskConfigUpdated) - if err := _SDUtilityPool.contract.UnpackLog(event, "RiskConfigUpdated", log); err != nil { + event := new(SDUtilityPoolProtocolFeeFactorUpdated) + if err := _SDUtilityPool.contract.UnpackLog(event, "ProtocolFeeFactorUpdated", log); err != nil { return err } event.Raw = log @@ -4016,21 +2298,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRiskConfigUpdated(opts *bind.W }), nil } -// ParseRiskConfigUpdated is a log parse operation binding the contract event 0x62dd46f943681bd727e339f4baaa19fb66ea209fbe7d9b4a75aa74c33acc18f3. +// ParseProtocolFeeFactorUpdated is a log parse operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. // -// Solidity: event RiskConfigUpdated(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRiskConfigUpdated(log types.Log) (*SDUtilityPoolRiskConfigUpdated, error) { - event := new(SDUtilityPoolRiskConfigUpdated) - if err := _SDUtilityPool.contract.UnpackLog(event, "RiskConfigUpdated", log); err != nil { +// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseProtocolFeeFactorUpdated(log types.Log) (*SDUtilityPoolProtocolFeeFactorUpdated, error) { + event := new(SDUtilityPoolProtocolFeeFactorUpdated) + if err := _SDUtilityPool.contract.UnpackLog(event, "ProtocolFeeFactorUpdated", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolRoleAdminChangedIterator is returned from FilterRoleAdminChanged and is used to iterate over the raw logs and unpacked data for RoleAdminChanged events raised by the SDUtilityPool contract. -type SDUtilityPoolRoleAdminChangedIterator struct { - Event *SDUtilityPoolRoleAdminChanged // Event containing the contract specifics and raw log +// SDUtilityPoolRedeemedIterator is returned from FilterRedeemed and is used to iterate over the raw logs and unpacked data for Redeemed events raised by the SDUtilityPool contract. +type SDUtilityPoolRedeemedIterator struct { + Event *SDUtilityPoolRedeemed // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -4044,7 +2326,7 @@ type SDUtilityPoolRoleAdminChangedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolRoleAdminChangedIterator) Next() bool { +func (it *SDUtilityPoolRedeemedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -4053,7 +2335,7 @@ func (it *SDUtilityPoolRoleAdminChangedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRoleAdminChanged) + it.Event = new(SDUtilityPoolRedeemed) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -4068,7 +2350,7 @@ func (it *SDUtilityPoolRoleAdminChangedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRoleAdminChanged) + it.Event = new(SDUtilityPoolRedeemed) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -4084,69 +2366,53 @@ func (it *SDUtilityPoolRoleAdminChangedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolRoleAdminChangedIterator) Error() error { +func (it *SDUtilityPoolRedeemedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolRoleAdminChangedIterator) Close() error { +func (it *SDUtilityPoolRedeemedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolRoleAdminChanged represents a RoleAdminChanged event raised by the SDUtilityPool contract. -type SDUtilityPoolRoleAdminChanged struct { - Role [32]byte - PreviousAdminRole [32]byte - NewAdminRole [32]byte - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolRedeemed represents a Redeemed event raised by the SDUtilityPool contract. +type SDUtilityPoolRedeemed struct { + Delegator common.Address + SdAmount *big.Int + SdXAmount *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterRoleAdminChanged is a free log retrieval operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. +// FilterRedeemed is a free log retrieval operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. // -// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRoleAdminChanged(opts *bind.FilterOpts, role [][32]byte, previousAdminRole [][32]byte, newAdminRole [][32]byte) (*SDUtilityPoolRoleAdminChangedIterator, error) { +// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRedeemed(opts *bind.FilterOpts, delegator []common.Address) (*SDUtilityPoolRedeemedIterator, error) { - var roleRule []interface{} - for _, roleItem := range role { - roleRule = append(roleRule, roleItem) - } - var previousAdminRoleRule []interface{} - for _, previousAdminRoleItem := range previousAdminRole { - previousAdminRoleRule = append(previousAdminRoleRule, previousAdminRoleItem) - } - var newAdminRoleRule []interface{} - for _, newAdminRoleItem := range newAdminRole { - newAdminRoleRule = append(newAdminRoleRule, newAdminRoleItem) + var delegatorRule []interface{} + for _, delegatorItem := range delegator { + delegatorRule = append(delegatorRule, delegatorItem) } - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RoleAdminChanged", roleRule, previousAdminRoleRule, newAdminRoleRule) + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Redeemed", delegatorRule) if err != nil { return nil, err } - return &SDUtilityPoolRoleAdminChangedIterator{contract: _SDUtilityPool.contract, event: "RoleAdminChanged", logs: logs, sub: sub}, nil + return &SDUtilityPoolRedeemedIterator{contract: _SDUtilityPool.contract, event: "Redeemed", logs: logs, sub: sub}, nil } -// WatchRoleAdminChanged is a free log subscription operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. +// WatchRedeemed is a free log subscription operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. // -// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRoleAdminChanged(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRoleAdminChanged, role [][32]byte, previousAdminRole [][32]byte, newAdminRole [][32]byte) (event.Subscription, error) { +// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRedeemed(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRedeemed, delegator []common.Address) (event.Subscription, error) { - var roleRule []interface{} - for _, roleItem := range role { - roleRule = append(roleRule, roleItem) - } - var previousAdminRoleRule []interface{} - for _, previousAdminRoleItem := range previousAdminRole { - previousAdminRoleRule = append(previousAdminRoleRule, previousAdminRoleItem) - } - var newAdminRoleRule []interface{} - for _, newAdminRoleItem := range newAdminRole { - newAdminRoleRule = append(newAdminRoleRule, newAdminRoleItem) + var delegatorRule []interface{} + for _, delegatorItem := range delegator { + delegatorRule = append(delegatorRule, delegatorItem) } - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RoleAdminChanged", roleRule, previousAdminRoleRule, newAdminRoleRule) + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Redeemed", delegatorRule) if err != nil { return nil, err } @@ -4156,8 +2422,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRoleAdminChanged(opts *bind.Wa select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolRoleAdminChanged) - if err := _SDUtilityPool.contract.UnpackLog(event, "RoleAdminChanged", log); err != nil { + event := new(SDUtilityPoolRedeemed) + if err := _SDUtilityPool.contract.UnpackLog(event, "Redeemed", log); err != nil { return err } event.Raw = log @@ -4178,21 +2444,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRoleAdminChanged(opts *bind.Wa }), nil } -// ParseRoleAdminChanged is a log parse operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. +// ParseRedeemed is a log parse operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. // -// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRoleAdminChanged(log types.Log) (*SDUtilityPoolRoleAdminChanged, error) { - event := new(SDUtilityPoolRoleAdminChanged) - if err := _SDUtilityPool.contract.UnpackLog(event, "RoleAdminChanged", log); err != nil { +// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRedeemed(log types.Log) (*SDUtilityPoolRedeemed, error) { + event := new(SDUtilityPoolRedeemed) + if err := _SDUtilityPool.contract.UnpackLog(event, "Redeemed", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolRoleGrantedIterator is returned from FilterRoleGranted and is used to iterate over the raw logs and unpacked data for RoleGranted events raised by the SDUtilityPool contract. -type SDUtilityPoolRoleGrantedIterator struct { - Event *SDUtilityPoolRoleGranted // Event containing the contract specifics and raw log +// SDUtilityPoolRepaidIterator is returned from FilterRepaid and is used to iterate over the raw logs and unpacked data for Repaid events raised by the SDUtilityPool contract. +type SDUtilityPoolRepaidIterator struct { + Event *SDUtilityPoolRepaid // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -4206,7 +2472,7 @@ type SDUtilityPoolRoleGrantedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolRoleGrantedIterator) Next() bool { +func (it *SDUtilityPoolRepaidIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -4215,7 +2481,7 @@ func (it *SDUtilityPoolRoleGrantedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRoleGranted) + it.Event = new(SDUtilityPoolRepaid) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -4230,7 +2496,7 @@ func (it *SDUtilityPoolRoleGrantedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRoleGranted) + it.Event = new(SDUtilityPoolRepaid) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -4246,69 +2512,52 @@ func (it *SDUtilityPoolRoleGrantedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolRoleGrantedIterator) Error() error { +func (it *SDUtilityPoolRepaidIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolRoleGrantedIterator) Close() error { +func (it *SDUtilityPoolRepaidIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolRoleGranted represents a RoleGranted event raised by the SDUtilityPool contract. -type SDUtilityPoolRoleGranted struct { - Role [32]byte - Account common.Address - Sender common.Address - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolRepaid represents a Repaid event raised by the SDUtilityPool contract. +type SDUtilityPoolRepaid struct { + Utilizer common.Address + RepayAmount *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterRoleGranted is a free log retrieval operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. +// FilterRepaid is a free log retrieval operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. // -// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRoleGranted(opts *bind.FilterOpts, role [][32]byte, account []common.Address, sender []common.Address) (*SDUtilityPoolRoleGrantedIterator, error) { +// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRepaid(opts *bind.FilterOpts, utilizer []common.Address) (*SDUtilityPoolRepaidIterator, error) { - var roleRule []interface{} - for _, roleItem := range role { - roleRule = append(roleRule, roleItem) - } - var accountRule []interface{} - for _, accountItem := range account { - accountRule = append(accountRule, accountItem) - } - var senderRule []interface{} - for _, senderItem := range sender { - senderRule = append(senderRule, senderItem) + var utilizerRule []interface{} + for _, utilizerItem := range utilizer { + utilizerRule = append(utilizerRule, utilizerItem) } - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RoleGranted", roleRule, accountRule, senderRule) + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Repaid", utilizerRule) if err != nil { return nil, err } - return &SDUtilityPoolRoleGrantedIterator{contract: _SDUtilityPool.contract, event: "RoleGranted", logs: logs, sub: sub}, nil + return &SDUtilityPoolRepaidIterator{contract: _SDUtilityPool.contract, event: "Repaid", logs: logs, sub: sub}, nil } -// WatchRoleGranted is a free log subscription operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. +// WatchRepaid is a free log subscription operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. // -// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRoleGranted(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRoleGranted, role [][32]byte, account []common.Address, sender []common.Address) (event.Subscription, error) { +// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRepaid(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRepaid, utilizer []common.Address) (event.Subscription, error) { - var roleRule []interface{} - for _, roleItem := range role { - roleRule = append(roleRule, roleItem) - } - var accountRule []interface{} - for _, accountItem := range account { - accountRule = append(accountRule, accountItem) - } - var senderRule []interface{} - for _, senderItem := range sender { - senderRule = append(senderRule, senderItem) + var utilizerRule []interface{} + for _, utilizerItem := range utilizer { + utilizerRule = append(utilizerRule, utilizerItem) } - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RoleGranted", roleRule, accountRule, senderRule) + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Repaid", utilizerRule) if err != nil { return nil, err } @@ -4318,8 +2567,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRoleGranted(opts *bind.WatchOp select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolRoleGranted) - if err := _SDUtilityPool.contract.UnpackLog(event, "RoleGranted", log); err != nil { + event := new(SDUtilityPoolRepaid) + if err := _SDUtilityPool.contract.UnpackLog(event, "Repaid", log); err != nil { return err } event.Raw = log @@ -4340,21 +2589,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRoleGranted(opts *bind.WatchOp }), nil } -// ParseRoleGranted is a log parse operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. +// ParseRepaid is a log parse operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. // -// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRoleGranted(log types.Log) (*SDUtilityPoolRoleGranted, error) { - event := new(SDUtilityPoolRoleGranted) - if err := _SDUtilityPool.contract.UnpackLog(event, "RoleGranted", log); err != nil { +// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRepaid(log types.Log) (*SDUtilityPoolRepaid, error) { + event := new(SDUtilityPoolRepaid) + if err := _SDUtilityPool.contract.UnpackLog(event, "Repaid", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolRoleRevokedIterator is returned from FilterRoleRevoked and is used to iterate over the raw logs and unpacked data for RoleRevoked events raised by the SDUtilityPool contract. -type SDUtilityPoolRoleRevokedIterator struct { - Event *SDUtilityPoolRoleRevoked // Event containing the contract specifics and raw log +// SDUtilityPoolRequestRedeemedIterator is returned from FilterRequestRedeemed and is used to iterate over the raw logs and unpacked data for RequestRedeemed events raised by the SDUtilityPool contract. +type SDUtilityPoolRequestRedeemedIterator struct { + Event *SDUtilityPoolRequestRedeemed // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -4368,7 +2617,7 @@ type SDUtilityPoolRoleRevokedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolRoleRevokedIterator) Next() bool { +func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -4377,7 +2626,7 @@ func (it *SDUtilityPoolRoleRevokedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRoleRevoked) + it.Event = new(SDUtilityPoolRequestRedeemed) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -4392,7 +2641,7 @@ func (it *SDUtilityPoolRoleRevokedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRoleRevoked) + it.Event = new(SDUtilityPoolRequestRedeemed) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -4408,69 +2657,42 @@ func (it *SDUtilityPoolRoleRevokedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolRoleRevokedIterator) Error() error { +func (it *SDUtilityPoolRequestRedeemedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolRoleRevokedIterator) Close() error { +func (it *SDUtilityPoolRequestRedeemedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolRoleRevoked represents a RoleRevoked event raised by the SDUtilityPool contract. -type SDUtilityPoolRoleRevoked struct { - Role [32]byte - Account common.Address - Sender common.Address - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolRequestRedeemed represents a RequestRedeemed event raised by the SDUtilityPool contract. +type SDUtilityPoolRequestRedeemed struct { + Caller common.Address + SdToTransfer *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterRoleRevoked is a free log retrieval operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. +// FilterRequestRedeemed is a free log retrieval operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. // -// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRoleRevoked(opts *bind.FilterOpts, role [][32]byte, account []common.Address, sender []common.Address) (*SDUtilityPoolRoleRevokedIterator, error) { - - var roleRule []interface{} - for _, roleItem := range role { - roleRule = append(roleRule, roleItem) - } - var accountRule []interface{} - for _, accountItem := range account { - accountRule = append(accountRule, accountItem) - } - var senderRule []interface{} - for _, senderItem := range sender { - senderRule = append(senderRule, senderItem) - } +// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRequestRedeemed(opts *bind.FilterOpts) (*SDUtilityPoolRequestRedeemedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RoleRevoked", roleRule, accountRule, senderRule) + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RequestRedeemed") if err != nil { return nil, err } - return &SDUtilityPoolRoleRevokedIterator{contract: _SDUtilityPool.contract, event: "RoleRevoked", logs: logs, sub: sub}, nil + return &SDUtilityPoolRequestRedeemedIterator{contract: _SDUtilityPool.contract, event: "RequestRedeemed", logs: logs, sub: sub}, nil } -// WatchRoleRevoked is a free log subscription operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. +// WatchRequestRedeemed is a free log subscription operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. // -// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRoleRevoked(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRoleRevoked, role [][32]byte, account []common.Address, sender []common.Address) (event.Subscription, error) { - - var roleRule []interface{} - for _, roleItem := range role { - roleRule = append(roleRule, roleItem) - } - var accountRule []interface{} - for _, accountItem := range account { - accountRule = append(accountRule, accountItem) - } - var senderRule []interface{} - for _, senderItem := range sender { - senderRule = append(senderRule, senderItem) - } +// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRequestRedeemed(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRequestRedeemed) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RoleRevoked", roleRule, accountRule, senderRule) + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RequestRedeemed") if err != nil { return nil, err } @@ -4480,8 +2702,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRoleRevoked(opts *bind.WatchOp select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolRoleRevoked) - if err := _SDUtilityPool.contract.UnpackLog(event, "RoleRevoked", log); err != nil { + event := new(SDUtilityPoolRequestRedeemed) + if err := _SDUtilityPool.contract.UnpackLog(event, "RequestRedeemed", log); err != nil { return err } event.Raw = log @@ -4502,21 +2724,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRoleRevoked(opts *bind.WatchOp }), nil } -// ParseRoleRevoked is a log parse operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. +// ParseRequestRedeemed is a log parse operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. // -// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRoleRevoked(log types.Log) (*SDUtilityPoolRoleRevoked, error) { - event := new(SDUtilityPoolRoleRevoked) - if err := _SDUtilityPool.contract.UnpackLog(event, "RoleRevoked", log); err != nil { +// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRequestRedeemed(log types.Log) (*SDUtilityPoolRequestRedeemed, error) { + event := new(SDUtilityPoolRequestRedeemed) + if err := _SDUtilityPool.contract.UnpackLog(event, "RequestRedeemed", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolSDUtilizedIterator is returned from FilterSDUtilized and is used to iterate over the raw logs and unpacked data for SDUtilized events raised by the SDUtilityPool contract. -type SDUtilityPoolSDUtilizedIterator struct { - Event *SDUtilityPoolSDUtilized // Event containing the contract specifics and raw log +// SDUtilityPoolRiskConfigUpdatedIterator is returned from FilterRiskConfigUpdated and is used to iterate over the raw logs and unpacked data for RiskConfigUpdated events raised by the SDUtilityPool contract. +type SDUtilityPoolRiskConfigUpdatedIterator struct { + Event *SDUtilityPoolRiskConfigUpdated // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -4530,7 +2752,7 @@ type SDUtilityPoolSDUtilizedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { +func (it *SDUtilityPoolRiskConfigUpdatedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -4539,7 +2761,7 @@ func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolSDUtilized) + it.Event = new(SDUtilityPoolRiskConfigUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -4554,7 +2776,7 @@ func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolSDUtilized) + it.Event = new(SDUtilityPoolRiskConfigUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -4570,42 +2792,44 @@ func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolSDUtilizedIterator) Error() error { +func (it *SDUtilityPoolRiskConfigUpdatedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolSDUtilizedIterator) Close() error { +func (it *SDUtilityPoolRiskConfigUpdatedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolSDUtilized represents a SDUtilized event raised by the SDUtilityPool contract. -type SDUtilityPoolSDUtilized struct { - Utilizer common.Address - UtilizeAmount *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolRiskConfigUpdated represents a RiskConfigUpdated event raised by the SDUtilityPool contract. +type SDUtilityPoolRiskConfigUpdated struct { + LiquidationThreshold *big.Int + LiquidationBonusPercent *big.Int + LiquidationFeePercent *big.Int + Ltv *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterSDUtilized is a free log retrieval operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. +// FilterRiskConfigUpdated is a free log retrieval operation binding the contract event 0x62dd46f943681bd727e339f4baaa19fb66ea209fbe7d9b4a75aa74c33acc18f3. // -// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterSDUtilized(opts *bind.FilterOpts) (*SDUtilityPoolSDUtilizedIterator, error) { +// Solidity: event RiskConfigUpdated(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRiskConfigUpdated(opts *bind.FilterOpts) (*SDUtilityPoolRiskConfigUpdatedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "SDUtilized") + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RiskConfigUpdated") if err != nil { return nil, err } - return &SDUtilityPoolSDUtilizedIterator{contract: _SDUtilityPool.contract, event: "SDUtilized", logs: logs, sub: sub}, nil + return &SDUtilityPoolRiskConfigUpdatedIterator{contract: _SDUtilityPool.contract, event: "RiskConfigUpdated", logs: logs, sub: sub}, nil } -// WatchSDUtilized is a free log subscription operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. +// WatchRiskConfigUpdated is a free log subscription operation binding the contract event 0x62dd46f943681bd727e339f4baaa19fb66ea209fbe7d9b4a75aa74c33acc18f3. // -// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchSDUtilized(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolSDUtilized) (event.Subscription, error) { +// Solidity: event RiskConfigUpdated(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRiskConfigUpdated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRiskConfigUpdated) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "SDUtilized") + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RiskConfigUpdated") if err != nil { return nil, err } @@ -4615,8 +2839,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchSDUtilized(opts *bind.WatchOpt select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolSDUtilized) - if err := _SDUtilityPool.contract.UnpackLog(event, "SDUtilized", log); err != nil { + event := new(SDUtilityPoolRiskConfigUpdated) + if err := _SDUtilityPool.contract.UnpackLog(event, "RiskConfigUpdated", log); err != nil { return err } event.Raw = log @@ -4637,21 +2861,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchSDUtilized(opts *bind.WatchOpt }), nil } -// ParseSDUtilized is a log parse operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. +// ParseRiskConfigUpdated is a log parse operation binding the contract event 0x62dd46f943681bd727e339f4baaa19fb66ea209fbe7d9b4a75aa74c33acc18f3. // -// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseSDUtilized(log types.Log) (*SDUtilityPoolSDUtilized, error) { - event := new(SDUtilityPoolSDUtilized) - if err := _SDUtilityPool.contract.UnpackLog(event, "SDUtilized", log); err != nil { +// Solidity: event RiskConfigUpdated(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRiskConfigUpdated(log types.Log) (*SDUtilityPoolRiskConfigUpdated, error) { + event := new(SDUtilityPoolRiskConfigUpdated) + if err := _SDUtilityPool.contract.UnpackLog(event, "RiskConfigUpdated", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolUnpausedIterator is returned from FilterUnpaused and is used to iterate over the raw logs and unpacked data for Unpaused events raised by the SDUtilityPool contract. -type SDUtilityPoolUnpausedIterator struct { - Event *SDUtilityPoolUnpaused // Event containing the contract specifics and raw log +// SDUtilityPoolSDUtilizedIterator is returned from FilterSDUtilized and is used to iterate over the raw logs and unpacked data for SDUtilized events raised by the SDUtilityPool contract. +type SDUtilityPoolSDUtilizedIterator struct { + Event *SDUtilityPoolSDUtilized // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -4665,7 +2889,7 @@ type SDUtilityPoolUnpausedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolUnpausedIterator) Next() bool { +func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -4674,7 +2898,7 @@ func (it *SDUtilityPoolUnpausedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolUnpaused) + it.Event = new(SDUtilityPoolSDUtilized) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -4689,7 +2913,7 @@ func (it *SDUtilityPoolUnpausedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolUnpaused) + it.Event = new(SDUtilityPoolSDUtilized) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -4705,41 +2929,42 @@ func (it *SDUtilityPoolUnpausedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolUnpausedIterator) Error() error { +func (it *SDUtilityPoolSDUtilizedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolUnpausedIterator) Close() error { +func (it *SDUtilityPoolSDUtilizedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolUnpaused represents a Unpaused event raised by the SDUtilityPool contract. -type SDUtilityPoolUnpaused struct { - Account common.Address - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolSDUtilized represents a SDUtilized event raised by the SDUtilityPool contract. +type SDUtilityPoolSDUtilized struct { + Utilizer common.Address + UtilizeAmount *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterUnpaused is a free log retrieval operation binding the contract event 0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa. +// FilterSDUtilized is a free log retrieval operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. // -// Solidity: event Unpaused(address account) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterUnpaused(opts *bind.FilterOpts) (*SDUtilityPoolUnpausedIterator, error) { +// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterSDUtilized(opts *bind.FilterOpts) (*SDUtilityPoolSDUtilizedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Unpaused") + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "SDUtilized") if err != nil { return nil, err } - return &SDUtilityPoolUnpausedIterator{contract: _SDUtilityPool.contract, event: "Unpaused", logs: logs, sub: sub}, nil + return &SDUtilityPoolSDUtilizedIterator{contract: _SDUtilityPool.contract, event: "SDUtilized", logs: logs, sub: sub}, nil } -// WatchUnpaused is a free log subscription operation binding the contract event 0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa. +// WatchSDUtilized is a free log subscription operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. // -// Solidity: event Unpaused(address account) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchUnpaused(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolUnpaused) (event.Subscription, error) { +// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchSDUtilized(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolSDUtilized) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Unpaused") + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "SDUtilized") if err != nil { return nil, err } @@ -4749,8 +2974,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchUnpaused(opts *bind.WatchOpts, select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolUnpaused) - if err := _SDUtilityPool.contract.UnpackLog(event, "Unpaused", log); err != nil { + event := new(SDUtilityPoolSDUtilized) + if err := _SDUtilityPool.contract.UnpackLog(event, "SDUtilized", log); err != nil { return err } event.Raw = log @@ -4771,12 +2996,12 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchUnpaused(opts *bind.WatchOpts, }), nil } -// ParseUnpaused is a log parse operation binding the contract event 0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa. +// ParseSDUtilized is a log parse operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. // -// Solidity: event Unpaused(address account) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseUnpaused(log types.Log) (*SDUtilityPoolUnpaused, error) { - event := new(SDUtilityPoolUnpaused) - if err := _SDUtilityPool.contract.UnpackLog(event, "Unpaused", log); err != nil { +// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseSDUtilized(log types.Log) (*SDUtilityPoolSDUtilized, error) { + event := new(SDUtilityPoolSDUtilized) + if err := _SDUtilityPool.contract.UnpackLog(event, "SDUtilized", log); err != nil { return nil, err } event.Raw = log diff --git a/stader-lib/sdutility/sd-utility.go b/stader-lib/sdutility/sd-utility.go index 7d0ccceaa..f1cccf044 100644 --- a/stader-lib/sdutility/sd-utility.go +++ b/stader-lib/sdutility/sd-utility.go @@ -106,3 +106,14 @@ func GetUserData(sp *stader.SDUtilityPoolContractManager, address common.Address return &userData, nil } + +func AlreadyLiquidated(sp *stader.SDUtilityPoolContractManager, address common.Address, opts *bind.CallOpts) (bool, error) { + liquidationIndex, err := sp.SDUtilityPool.LiquidationIndexByOperator(opts, address) + if err != nil { + return false, err + } + + isAlreadyLiquidated := liquidationIndex.Cmp(big.NewInt(0)) != 0 + + return isAlreadyLiquidated, nil +} diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index 6c9ff0633..3a98ebbd2 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -88,6 +88,11 @@ func GetSDStatus( return nil, err } + alreadyLiquidated, err := sdutility.AlreadyLiquidated(sdu, operatorAddress, nil) + if err != nil { + return nil, err + } + return &api.SdStatusResponse{ NotEnoughSdCollateral: !hasEnoughSdCollateral, SdUtilizerLatestBalance: sdUtilityLatestBalance, @@ -101,6 +106,7 @@ func GetSDStatus( SdRewardEligible: rewardEligibleSD, HealthFactor: userData.HealthFactor, AccumulatedInterest: userData.TotalInterestSD, + AlreadyLiquidated: alreadyLiquidated, }, nil } From 8bb260bc1b6629de67c62dfa3a2120c968f2bc4f Mon Sep 17 00:00:00 2001 From: batphonghan Date: Fri, 19 Jan 2024 09:09:51 +0700 Subject: [PATCH 149/159] Add more metrics --- shared/services/state/network-state.go | 18 ++++++++++++++++++ stader/guardian/collector/constants.go | 2 ++ .../guardian/collector/operator-collector.go | 10 ++++++++++ stader/guardian/collector/state-locker.go | 1 + 4 files changed, 31 insertions(+) diff --git a/shared/services/state/network-state.go b/shared/services/state/network-state.go index 3ad016b69..e62d89689 100644 --- a/shared/services/state/network-state.go +++ b/shared/services/state/network-state.go @@ -138,6 +138,11 @@ type MetricDetails struct { // done HealthFactor float64 + + // done + LiquidationStatus float64 + + ClaimVaultBalance float64 } type MetricsCache struct { @@ -506,6 +511,16 @@ func CreateMetricsCache( return nil, err } + orc, err := services.GetOperatorRewardsCollectorContract(c) + if err != nil { + return nil, err + } + + operatorClaimVaultBalance, err := node.GetOperatorRewardsCollectorBalance(orc, nodeAddress, nil) + if err != nil { + return nil, err + } + minThreshold := math.RoundDown(eth.WeiToEth(permissionlessPoolThreshold.MinThreshold), 2) sdPriceFormatted := math.RoundDown(eth.WeiToEth(sdPrice), 2) collateralRatioInSd := minThreshold * sdPriceFormatted @@ -581,6 +596,9 @@ func CreateMetricsCache( metricsDetails.OperatorSDSelfBond = math.RoundDown(eth.WeiToEth(operatorSdCollateral), SixDecimalRound) + metricsDetails.LiquidationStatus = 0 + metricsDetails.ClaimVaultBalance = math.RoundDown(eth.WeiToEth(operatorClaimVaultBalance), SixDecimalRound) + state.StaderNetworkDetails = metricsDetails state.logLine("Retrieved Stader Network Details (total time: %s)", time.Since(start)) diff --git a/stader/guardian/collector/constants.go b/stader/guardian/collector/constants.go index 3a27be0b7..43d1b9f5b 100644 --- a/stader/guardian/collector/constants.go +++ b/stader/guardian/collector/constants.go @@ -36,6 +36,8 @@ const LockedEth = "eth_locked" const HeathFactor = "heath_factor" const TotalSDUtilizationPosition = "sd_utility_position" const TotalSDSelfBonded = "total_sd_self_bonded" +const LiquidationStatus = "liquidation_status" +const ClaimVaultBalance = "claim_vault_balance" // Node Health => stader_node_health+ key const NodeSub = "node_health" diff --git a/stader/guardian/collector/operator-collector.go b/stader/guardian/collector/operator-collector.go index 4269d9265..366098214 100644 --- a/stader/guardian/collector/operator-collector.go +++ b/stader/guardian/collector/operator-collector.go @@ -40,6 +40,8 @@ type OperatorCollector struct { SdCollateralPct *prometheus.Desc LockedEth *prometheus.Desc HealthFactor *prometheus.Desc + LiquidationStatus *prometheus.Desc + ClaimVaultBalance *prometheus.Desc // The beacon client bc beacon.Client @@ -133,6 +135,10 @@ func NewOperatorCollector( prometheus.BuildFQName(namespace, OperatorSub, TotalSDUtilizationPosition), "", nil, nil), TotalSDSelfBond: prometheus.NewDesc( prometheus.BuildFQName(namespace, OperatorSub, TotalSDSelfBonded), "", nil, nil), + LiquidationStatus: prometheus.NewDesc( + prometheus.BuildFQName(namespace, OperatorSub, LiquidationStatus), "", nil, nil), + ClaimVaultBalance: prometheus.NewDesc( + prometheus.BuildFQName(namespace, OperatorSub, ClaimVaultBalance), "", nil, nil), bc: bc, ec: ec, nodeAddress: nodeAddress, @@ -170,6 +176,8 @@ func (collector *OperatorCollector) Describe(channel chan<- *prometheus.Desc) { channel <- collector.HealthFactor channel <- collector.TotalSDUtilizationPosition channel <- collector.TotalSDSelfBond + channel <- collector.LiquidationStatus + channel <- collector.ClaimVaultBalance } // Collect the latest metric values and pass them to Prometheus @@ -204,6 +212,8 @@ func (collector *OperatorCollector) Collect(channel chan<- prometheus.Metric) { channel <- prometheus.MustNewConstMetric(collector.HealthFactor, prometheus.GaugeValue, state.StaderNetworkDetails.HealthFactor) channel <- prometheus.MustNewConstMetric(collector.TotalSDUtilizationPosition, prometheus.GaugeValue, float64(state.StaderNetworkDetails.OperatorSDUtilizationPosition)) channel <- prometheus.MustNewConstMetric(collector.TotalSDSelfBond, prometheus.GaugeValue, float64(state.StaderNetworkDetails.OperatorSDSelfBond)) + channel <- prometheus.MustNewConstMetric(collector.LiquidationStatus, prometheus.GaugeValue, state.StaderNetworkDetails.LiquidationStatus) + channel <- prometheus.MustNewConstMetric(collector.ClaimVaultBalance, prometheus.GaugeValue, state.StaderNetworkDetails.ClaimVaultBalance) } // Log error messages diff --git a/stader/guardian/collector/state-locker.go b/stader/guardian/collector/state-locker.go index 3cdc08791..dd690bb18 100644 --- a/stader/guardian/collector/state-locker.go +++ b/stader/guardian/collector/state-locker.go @@ -66,6 +66,7 @@ func NewMetricsCacheContainer() *MetricsCacheContainer { SdCollateralPct: 0, LockedEth: 0, HealthFactor: 0, + LiquidationStatus: 0, StaderQueuedValidators: big.NewInt(0), }, }, From b3af591754c61aff7e160c13436ff4d8e7ddd00e Mon Sep 17 00:00:00 2001 From: batphonghan Date: Fri, 19 Jan 2024 09:25:56 +0700 Subject: [PATCH 150/159] Update metrics --- shared/services/state/network-state.go | 7 ++++++- stader-lib/sdutility/sd-utility.go | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/shared/services/state/network-state.go b/shared/services/state/network-state.go index e62d89689..86f867981 100644 --- a/shared/services/state/network-state.go +++ b/shared/services/state/network-state.go @@ -511,6 +511,11 @@ func CreateMetricsCache( return nil, err } + liquidIndex, err := sdutility.LiquidationIndexByOperator(sdu, nodeAddress, nil) + if err != nil { + return nil, err + } + orc, err := services.GetOperatorRewardsCollectorContract(c) if err != nil { return nil, err @@ -596,7 +601,7 @@ func CreateMetricsCache( metricsDetails.OperatorSDSelfBond = math.RoundDown(eth.WeiToEth(operatorSdCollateral), SixDecimalRound) - metricsDetails.LiquidationStatus = 0 + metricsDetails.LiquidationStatus = float64(liquidIndex.Int64()) metricsDetails.ClaimVaultBalance = math.RoundDown(eth.WeiToEth(operatorClaimVaultBalance), SixDecimalRound) state.StaderNetworkDetails = metricsDetails diff --git a/stader-lib/sdutility/sd-utility.go b/stader-lib/sdutility/sd-utility.go index f1cccf044..31775a205 100644 --- a/stader-lib/sdutility/sd-utility.go +++ b/stader-lib/sdutility/sd-utility.go @@ -108,7 +108,7 @@ func GetUserData(sp *stader.SDUtilityPoolContractManager, address common.Address } func AlreadyLiquidated(sp *stader.SDUtilityPoolContractManager, address common.Address, opts *bind.CallOpts) (bool, error) { - liquidationIndex, err := sp.SDUtilityPool.LiquidationIndexByOperator(opts, address) + liquidationIndex, err := LiquidationIndexByOperator(sp, address, nil) if err != nil { return false, err } @@ -117,3 +117,7 @@ func AlreadyLiquidated(sp *stader.SDUtilityPoolContractManager, address common.A return isAlreadyLiquidated, nil } + +func LiquidationIndexByOperator(sp *stader.SDUtilityPoolContractManager, address common.Address, opts *bind.CallOpts) (*big.Int, error) { + return sp.SDUtilityPool.LiquidationIndexByOperator(opts, address) +} From 31355b8be842cce1e3f5f351b7cd158a2a97c527 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 30 Jan 2024 11:58:37 +0700 Subject: [PATCH 151/159] Update metrics --- abis/SDUtilityPool.abi.json | 2451 +++++++++-------- shared/services/state/network-state.go | 19 + stader-lib/contracts/sd-utility.go | 33 +- stader-lib/sdutility/sd-utility.go | 18 + .../guardian/collector/network-collector.go | 21 +- .../guardian/collector/operator-collector.go | 16 + 6 files changed, 1327 insertions(+), 1231 deletions(-) diff --git a/abis/SDUtilityPool.abi.json b/abis/SDUtilityPool.abi.json index 44f0e5c78..4c9eef785 100644 --- a/abis/SDUtilityPool.abi.json +++ b/abis/SDUtilityPool.abi.json @@ -1,1260 +1,1273 @@ [ { - "inputs": [], - "name": "AlreadyClaimed", - "type": "error" + "inputs": [], + "name": "AlreadyClaimed", + "type": "error" }, { - "inputs": [], - "name": "AlreadyLiquidated", - "type": "error" + "inputs": [], + "name": "AlreadyLiquidated", + "type": "error" }, { - "inputs": [], - "name": "CallerNotAuthorizedToRedeem", - "type": "error" + "inputs": [], + "name": "CallerNotAuthorizedToRedeem", + "type": "error" }, { - "inputs": [], - "name": "CannotFindRequestId", - "type": "error" + "inputs": [], + "name": "CannotFindRequestId", + "type": "error" }, { - "inputs": [], - "name": "InsufficientPoolBalance", - "type": "error" + "inputs": [], + "name": "InsufficientPoolBalance", + "type": "error" }, { - "inputs": [], - "name": "InvalidAmountOfWithdraw", - "type": "error" + "inputs": [], + "name": "InvalidAmountOfWithdraw", + "type": "error" }, { - "inputs": [], - "name": "InvalidInput", - "type": "error" + "inputs": [], + "name": "InvalidInput", + "type": "error" }, { - "inputs": [], - "name": "InvalidWithdrawAmount", - "type": "error" + "inputs": [], + "name": "InvalidWithdrawAmount", + "type": "error" }, { - "inputs": [], - "name": "MaxLimitOnWithdrawRequestCountReached", - "type": "error" + "inputs": [], + "name": "MaxLimitOnWithdrawRequestCountReached", + "type": "error" }, { - "inputs": [], - "name": "NotClaimable", - "type": "error" + "inputs": [], + "name": "NotClaimable", + "type": "error" }, { - "inputs": [], - "name": "NotLiquidatable", - "type": "error" + "inputs": [], + "name": "NotLiquidatable", + "type": "error" }, { - "inputs": [], - "name": "NotLiquidator", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "requestId", - "type": "uint256" - } - ], - "name": "RequestIdNotFinalized", - "type": "error" - }, - { - "inputs": [], - "name": "SDTransferFailed", - "type": "error" - }, - { - "inputs": [], - "name": "SDUtilizeLimitReached", - "type": "error" - }, - { - "inputs": [], - "name": "UnHealthyPosition", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "feeAccumulated", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalProtocolFee", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalUtilizedSD", - "type": "uint256" - } - ], - "name": "AccruedFees", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "CompleteLiquidation", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "delegator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sdAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sdXToMint", - "type": "uint256" - } - ], - "name": "Delegated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "nextRequestIdToFinalize", - "type": "uint256" - } - ], - "name": "FinalizedWithdrawRequest", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalLiquidationAmountInEth", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "liquidationBonusInEth", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "liquidationFeeInEth", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "address", - "name": "liquidator", - "type": "address" - } - ], - "name": "LiquidationCall", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "protocolFeeFactor", - "type": "uint256" - } - ], - "name": "ProtocolFeeFactorUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "delegator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sdAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sdXAmount", - "type": "uint256" - } - ], - "name": "Redeemed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "utilizer", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "repayAmount", - "type": "uint256" - } - ], - "name": "Repaid", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "caller", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sdToTransfer", - "type": "uint256" - } - ], - "name": "RequestRedeemed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "liquidationThreshold", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "liquidationBonusPercent", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "liquidationFeePercent", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "ltv", - "type": "uint256" - } - ], - "name": "RiskConfigUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "utilizer", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "utilizeAmount", - "type": "uint256" - } - ], - "name": "SDUtilized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "conservativeEthPerKey", - "type": "uint256" - } - ], - "name": "UpdatedConservativeEthPerKey", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "finalizationBatchLimit", - "type": "uint256" - } - ], - "name": "UpdatedFinalizationBatchLimit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "maxETHWorthOfSDPerValidator", - "type": "uint256" - } - ], - "name": "UpdatedMaxETHWorthOfSDPerValidator", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "count", - "type": "uint256" - } - ], - "name": "UpdatedMaxNonRedeemedDelegatorRequestCount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "minBlockDelayToFinalizeRequest", - "type": "uint256" - } - ], - "name": "UpdatedMinBlockDelayToFinalizeRequest", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_staderConfig", - "type": "address" - } - ], - "name": "UpdatedStaderConfig", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "utilizationRatePerBlock", - "type": "uint256" - } - ], - "name": "UtilizationRatePerBlockUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "caller", - "type": "address" + "inputs": [], + "name": "NotLiquidator", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + } + ], + "name": "RequestIdNotFinalized", + "type": "error" + }, + { + "inputs": [], + "name": "SDTransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "SDUtilizeLimitReached", + "type": "error" + }, + { + "inputs": [], + "name": "UnHealthyPosition", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "feeAccumulated", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalProtocolFee", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalUtilizedSD", + "type": "uint256" + } + ], + "name": "AccruedFees", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "CompleteLiquidation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdXToMint", + "type": "uint256" + } + ], + "name": "Delegated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "nextRequestIdToFinalize", + "type": "uint256" + } + ], + "name": "FinalizedWithdrawRequest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalLiquidationAmountInEth", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidationBonusInEth", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidationFeeInEth", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "liquidator", + "type": "address" + } + ], + "name": "LiquidationCall", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "protocolFeeFactor", + "type": "uint256" + } + ], + "name": "ProtocolFeeFactorUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdXAmount", + "type": "uint256" + } + ], + "name": "Redeemed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "utilizer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "Repaid", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdToTransfer", + "type": "uint256" + } + ], + "name": "RequestRedeemed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "liquidationThreshold", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidationBonusPercent", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidationFeePercent", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "ltv", + "type": "uint256" + } + ], + "name": "RiskConfigUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "utilizer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "utilizeAmount", + "type": "uint256" + } + ], + "name": "SDUtilized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "conservativeEthPerKey", + "type": "uint256" + } + ], + "name": "UpdatedConservativeEthPerKey", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "finalizationBatchLimit", + "type": "uint256" + } + ], + "name": "UpdatedFinalizationBatchLimit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "maxETHWorthOfSDPerValidator", + "type": "uint256" + } + ], + "name": "UpdatedMaxETHWorthOfSDPerValidator", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "count", + "type": "uint256" + } + ], + "name": "UpdatedMaxNonRedeemedDelegatorRequestCount", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "minBlockDelayToFinalizeRequest", + "type": "uint256" + } + ], + "name": "UpdatedMinBlockDelayToFinalizeRequest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_staderConfig", + "type": "address" + } + ], + "name": "UpdatedStaderConfig", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "utilizationRatePerBlock", + "type": "uint256" + } + ], + "name": "UtilizationRatePerBlockUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "nextRequestId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdAmountToWithdraw", + "type": "uint256" + } + ], + "name": "WithdrawRequestReceived", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "WithdrawnProtocolFee", + "type": "event" + }, + { + "inputs": [], + "name": "accrueFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "accumulatedProtocolFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "cTokenTotalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "completeLiquidation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "sdAmount", + "type": "uint256" + } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "delegatorCTokenBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "delegatorWithdrawRequestedCTokenCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "delegatorWithdrawRequests", + "outputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountOfCToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "sdExpected", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "sdFinalized", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestBlock", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "exchangeRateCurrent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "exchangeRateStored", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "finalizeDelegatorWithdrawalRequest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getDelegationRatePerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_delegator", + "type": "address" + } + ], + "name": "getDelegatorLatestSDBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getLatestExchangeRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getLiquidationThreshold", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "getOperatorLiquidation", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "totalAmountInEth", + "type": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "nextRequestId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sdAmountToWithdraw", - "type": "uint256" - } - ], - "name": "WithdrawRequestReceived", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "WithdrawnProtocolFee", - "type": "event" - }, - { - "inputs": [], - "name": "accrueFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "accumulatedProtocolFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "cTokenTotalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "requestId", - "type": "uint256" - } - ], - "name": "claim", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "completeLiquidation", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "sdAmount", - "type": "uint256" - } - ], - "name": "delegate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "delegatorCTokenBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "delegatorWithdrawRequestedCTokenCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "delegatorWithdrawRequests", - "outputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amountOfCToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sdExpected", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sdFinalized", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "requestBlock", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "exchangeRateCurrent", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "exchangeRateStored", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "finalizeDelegatorWithdrawalRequest", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "getDelegationRatePerBlock", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_delegator", - "type": "address" - } - ], - "name": "getDelegatorLatestSDBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getLatestExchangeRate", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getLiquidationThreshold", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "getOperatorLiquidation", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "totalAmountInEth", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBonusInEth", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalFeeInEth", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isRepaid", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isClaimed", - "type": "bool" - }, - { - "internalType": "address", - "name": "liquidator", - "type": "address" - } - ], - "internalType": "struct OperatorLiquidation", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPoolAvailableSDBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_owner", - "type": "address" - } - ], - "name": "getRequestIdsByDelegator", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "getUserData", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "totalInterestSD", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalCollateralInEth", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "healthFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lockedEth", - "type": "uint256" - } - ], - "internalType": "struct UserData", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_utilizer", - "type": "address" - } - ], - "name": "getUtilizerLatestBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "liquidationCall", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "liquidationIndexByOperator", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxApproveSD", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "maxETHWorthOfSDPerValidator", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "poolUtilization", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "repayAmount", - "type": "uint256" - } - ], - "name": "repay", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" + "internalType": "uint256", + "name": "totalBonusInEth", + "type": "uint256" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "utilizer", - "type": "address" + "internalType": "uint256", + "name": "totalFeeInEth", + "type": "uint256" }, { - "internalType": "uint256", - "name": "repayAmount", - "type": "uint256" - } - ], - "name": "repayOnBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" + "internalType": "bool", + "name": "isRepaid", + "type": "bool" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" + "internalType": "bool", + "name": "isClaimed", + "type": "bool" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "requestIdsByDelegatorAddress", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "cTokenAmount", - "type": "uint256" - } - ], - "name": "requestWithdraw", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "sdAmount", - "type": "uint256" - } - ], - "name": "requestWithdrawWithSDAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "sdRequestedForWithdraw", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_newEthPerKey", - "type": "uint256" - } - ], - "name": "updateConservativeEthPerKey", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_finalizationBatchLimit", - "type": "uint256" - } - ], - "name": "updateFinalizationBatchLimit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_maxETHWorthOfSDPerValidator", - "type": "uint256" - } - ], - "name": "updateMaxETHWorthOfSDPerValidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_count", - "type": "uint256" - } - ], - "name": "updateMaxNonRedeemedDelegatorRequestCount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_minBlockDelayToFinalizeRequest", - "type": "uint256" - } - ], - "name": "updateMinBlockDelayToFinalizeRequest", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_protocolFee", - "type": "uint256" - } - ], - "name": "updateProtocolFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_staderConfig", - "type": "address" - } - ], - "name": "updateStaderConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_utilizationRatePerBlock", - "type": "uint256" - } - ], - "name": "updateUtilizationRatePerBlock", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "utilizationRatePerBlock", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "utilizeAmount", - "type": "uint256" - } - ], - "name": "utilize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" + "internalType": "address", + "name": "liquidator", + "type": "address" + } + ], + "internalType": "struct OperatorLiquidation", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPoolAvailableSDBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "getRequestIdsByDelegator", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getUserData", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "totalInterestSD", + "type": "uint256" }, { - "internalType": "uint256", - "name": "utilizeAmount", - "type": "uint256" + "internalType": "uint256", + "name": "totalCollateralInEth", + "type": "uint256" }, { - "internalType": "uint256", - "name": "nonTerminalKeyCount", - "type": "uint256" - } - ], - "name": "utilizeWhileAddingKeys", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "utilizerBalanceCurrent", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "utilizerBalanceStored", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "utilizerData", - "outputs": [ - { - "internalType": "uint256", - "name": "principal", - "type": "uint256" + "internalType": "uint256", + "name": "healthFactor", + "type": "uint256" }, { - "internalType": "uint256", - "name": "utilizeIndex", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "withdrawProtocolFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "internalType": "uint256", + "name": "lockedEth", + "type": "uint256" + } + ], + "internalType": "struct UserData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_utilizer", + "type": "address" + } + ], + "name": "getUtilizerLatestBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "liquidationCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "liquidationIndexByOperator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxApproveSD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "maxETHWorthOfSDPerValidator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poolUtilization", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repay", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "utilizer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repayOnBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "requestIdsByDelegatorAddress", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "cTokenAmount", + "type": "uint256" + } + ], + "name": "requestWithdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "sdAmount", + "type": "uint256" + } + ], + "name": "requestWithdrawWithSDAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "sdRequestedForWithdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalUtilizedSD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_newEthPerKey", + "type": "uint256" + } + ], + "name": "updateConservativeEthPerKey", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_finalizationBatchLimit", + "type": "uint256" + } + ], + "name": "updateFinalizationBatchLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_maxETHWorthOfSDPerValidator", + "type": "uint256" + } + ], + "name": "updateMaxETHWorthOfSDPerValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_count", + "type": "uint256" + } + ], + "name": "updateMaxNonRedeemedDelegatorRequestCount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_minBlockDelayToFinalizeRequest", + "type": "uint256" + } + ], + "name": "updateMinBlockDelayToFinalizeRequest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_protocolFee", + "type": "uint256" + } + ], + "name": "updateProtocolFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staderConfig", + "type": "address" + } + ], + "name": "updateStaderConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_utilizationRatePerBlock", + "type": "uint256" + } + ], + "name": "updateUtilizationRatePerBlock", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "utilizationRatePerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "utilizeAmount", + "type": "uint256" + } + ], + "name": "utilize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "utilizeAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nonTerminalKeyCount", + "type": "uint256" + } + ], + "name": "utilizeWhileAddingKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "utilizerBalanceCurrent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "utilizerBalanceStored", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "utilizerData", + "outputs": [ + { + "internalType": "uint256", + "name": "principal", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "utilizeIndex", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "withdrawProtocolFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" } -] + ] \ No newline at end of file diff --git a/shared/services/state/network-state.go b/shared/services/state/network-state.go index 86f867981..53693fad5 100644 --- a/shared/services/state/network-state.go +++ b/shared/services/state/network-state.go @@ -63,6 +63,12 @@ type MetricDetails struct { // done MaxEthThreshold float64 + // done + TotalSDUtilized float64 + + // done + TotalSDUtilizationTVL float64 + // Validator specific info // done @@ -506,6 +512,16 @@ func CreateMetricsCache( return nil, err } + totalSDUtilized, err := sdutility.GetTotalTVL(sdu, nil) + if err != nil { + return nil, err + } + + totalSDUtilizationTVL, err := sdutility.GetTotalTVL(sdu, nil) + if err != nil { + return nil, err + } + userData, err := sdutility.GetUserData(sdu, nodeAddress, nil) if err != nil { return nil, err @@ -604,6 +620,9 @@ func CreateMetricsCache( metricsDetails.LiquidationStatus = float64(liquidIndex.Int64()) metricsDetails.ClaimVaultBalance = math.RoundDown(eth.WeiToEth(operatorClaimVaultBalance), SixDecimalRound) + metricsDetails.TotalSDUtilized = float64(totalSDUtilized.Int64()) + metricsDetails.TotalSDUtilizationTVL = float64(totalSDUtilizationTVL.Int64()) + state.StaderNetworkDetails = metricsDetails state.logLine("Retrieved Stader Network Details (total time: %s)", time.Since(start)) diff --git a/stader-lib/contracts/sd-utility.go b/stader-lib/contracts/sd-utility.go index 589d03fc9..3b0f387b4 100644 --- a/stader-lib/contracts/sd-utility.go +++ b/stader-lib/contracts/sd-utility.go @@ -49,7 +49,7 @@ type UserData struct { // SDUtilityPoolMetaData contains all meta data concerning the SDUtilityPool contract. var SDUtilityPoolMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"AlreadyClaimed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyLiquidated\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotAuthorizedToRedeem\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotFindRequestId\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientPoolBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAmountOfWithdraw\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInput\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidWithdrawAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxLimitOnWithdrawRequestCountReached\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotClaimable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotLiquidatable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotLiquidator\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"RequestIdNotFinalized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDUtilizeLimitReached\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnHealthyPosition\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAccumulated\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalProtocolFee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalUtilizedSD\",\"type\":\"uint256\"}],\"name\":\"AccruedFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"CompleteLiquidation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXToMint\",\"type\":\"uint256\"}],\"name\":\"Delegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestIdToFinalize\",\"type\":\"uint256\"}],\"name\":\"FinalizedWithdrawRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalLiquidationAmountInEth\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationBonusInEth\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationFeeInEth\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"name\":\"LiquidationCall\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"protocolFeeFactor\",\"type\":\"uint256\"}],\"name\":\"ProtocolFeeFactorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXAmount\",\"type\":\"uint256\"}],\"name\":\"Redeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"Repaid\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdToTransfer\",\"type\":\"uint256\"}],\"name\":\"RequestRedeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationThreshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationBonusPercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationFeePercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ltv\",\"type\":\"uint256\"}],\"name\":\"RiskConfigUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"SDUtilized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"conservativeEthPerKey\",\"type\":\"uint256\"}],\"name\":\"UpdatedConservativeEthPerKey\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"finalizationBatchLimit\",\"type\":\"uint256\"}],\"name\":\"UpdatedFinalizationBatchLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxETHWorthOfSDPerValidator\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxETHWorthOfSDPerValidator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxNonRedeemedDelegatorRequestCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minBlockDelayToFinalizeRequest\",\"type\":\"uint256\"}],\"name\":\"UpdatedMinBlockDelayToFinalizeRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizationRatePerBlock\",\"type\":\"uint256\"}],\"name\":\"UtilizationRatePerBlockUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmountToWithdraw\",\"type\":\"uint256\"}],\"name\":\"WithdrawRequestReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"WithdrawnProtocolFee\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"accrueFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accumulatedProtocolFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cTokenTotalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"completeLiquidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"delegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"delegatorCTokenBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"delegatorWithdrawRequestedCTokenCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"delegatorWithdrawRequests\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountOfCToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdExpected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdFinalized\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finalizeDelegatorWithdrawalRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDelegationRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_delegator\",\"type\":\"address\"}],\"name\":\"getDelegatorLatestSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLatestExchangeRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLiquidationThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"getOperatorLiquidation\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"totalAmountInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalBonusInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalFeeInEth\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isRepaid\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"isClaimed\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"internalType\":\"structOperatorLiquidation\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPoolAvailableSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"getRequestIdsByDelegator\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getUserData\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"totalInterestSD\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalCollateralInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"healthFactor\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lockedEth\",\"type\":\"uint256\"}],\"internalType\":\"structUserData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_utilizer\",\"type\":\"address\"}],\"name\":\"getUtilizerLatestBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"liquidationCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"liquidationIndexByOperator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxApproveSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxETHWorthOfSDPerValidator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"poolUtilization\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repay\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repayOnBehalf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"requestIdsByDelegatorAddress\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"cTokenAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdrawWithSDAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sdRequestedForWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newEthPerKey\",\"type\":\"uint256\"}],\"name\":\"updateConservativeEthPerKey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_finalizationBatchLimit\",\"type\":\"uint256\"}],\"name\":\"updateFinalizationBatchLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxETHWorthOfSDPerValidator\",\"type\":\"uint256\"}],\"name\":\"updateMaxETHWorthOfSDPerValidator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"name\":\"updateMaxNonRedeemedDelegatorRequestCount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minBlockDelayToFinalizeRequest\",\"type\":\"uint256\"}],\"name\":\"updateMinBlockDelayToFinalizeRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_protocolFee\",\"type\":\"uint256\"}],\"name\":\"updateProtocolFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_utilizationRatePerBlock\",\"type\":\"uint256\"}],\"name\":\"updateUtilizationRatePerBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"utilizationRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"utilize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonTerminalKeyCount\",\"type\":\"uint256\"}],\"name\":\"utilizeWhileAddingKeys\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"utilizerData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"principal\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"utilizeIndex\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdrawProtocolFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"name\":\"AlreadyClaimed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyLiquidated\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotAuthorizedToRedeem\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotFindRequestId\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientPoolBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAmountOfWithdraw\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInput\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidWithdrawAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxLimitOnWithdrawRequestCountReached\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotClaimable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotLiquidatable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotLiquidator\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"RequestIdNotFinalized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDUtilizeLimitReached\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnHealthyPosition\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAccumulated\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalProtocolFee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalUtilizedSD\",\"type\":\"uint256\"}],\"name\":\"AccruedFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"CompleteLiquidation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXToMint\",\"type\":\"uint256\"}],\"name\":\"Delegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestIdToFinalize\",\"type\":\"uint256\"}],\"name\":\"FinalizedWithdrawRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalLiquidationAmountInEth\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationBonusInEth\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationFeeInEth\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"name\":\"LiquidationCall\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"protocolFeeFactor\",\"type\":\"uint256\"}],\"name\":\"ProtocolFeeFactorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXAmount\",\"type\":\"uint256\"}],\"name\":\"Redeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"Repaid\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdToTransfer\",\"type\":\"uint256\"}],\"name\":\"RequestRedeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationThreshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationBonusPercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationFeePercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ltv\",\"type\":\"uint256\"}],\"name\":\"RiskConfigUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"SDUtilized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"conservativeEthPerKey\",\"type\":\"uint256\"}],\"name\":\"UpdatedConservativeEthPerKey\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"finalizationBatchLimit\",\"type\":\"uint256\"}],\"name\":\"UpdatedFinalizationBatchLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxETHWorthOfSDPerValidator\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxETHWorthOfSDPerValidator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxNonRedeemedDelegatorRequestCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minBlockDelayToFinalizeRequest\",\"type\":\"uint256\"}],\"name\":\"UpdatedMinBlockDelayToFinalizeRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizationRatePerBlock\",\"type\":\"uint256\"}],\"name\":\"UtilizationRatePerBlockUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmountToWithdraw\",\"type\":\"uint256\"}],\"name\":\"WithdrawRequestReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"WithdrawnProtocolFee\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"accrueFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accumulatedProtocolFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cTokenTotalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"completeLiquidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"delegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"delegatorCTokenBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"delegatorWithdrawRequestedCTokenCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"delegatorWithdrawRequests\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountOfCToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdExpected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdFinalized\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finalizeDelegatorWithdrawalRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDelegationRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_delegator\",\"type\":\"address\"}],\"name\":\"getDelegatorLatestSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLatestExchangeRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLiquidationThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"getOperatorLiquidation\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"totalAmountInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalBonusInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalFeeInEth\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isRepaid\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"isClaimed\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"internalType\":\"structOperatorLiquidation\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPoolAvailableSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"getRequestIdsByDelegator\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getUserData\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"totalInterestSD\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalCollateralInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"healthFactor\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lockedEth\",\"type\":\"uint256\"}],\"internalType\":\"structUserData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_utilizer\",\"type\":\"address\"}],\"name\":\"getUtilizerLatestBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"liquidationCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"liquidationIndexByOperator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxApproveSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxETHWorthOfSDPerValidator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"poolUtilization\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repay\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repayOnBehalf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"requestIdsByDelegatorAddress\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"cTokenAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdrawWithSDAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sdRequestedForWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalUtilizedSD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newEthPerKey\",\"type\":\"uint256\"}],\"name\":\"updateConservativeEthPerKey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_finalizationBatchLimit\",\"type\":\"uint256\"}],\"name\":\"updateFinalizationBatchLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxETHWorthOfSDPerValidator\",\"type\":\"uint256\"}],\"name\":\"updateMaxETHWorthOfSDPerValidator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"name\":\"updateMaxNonRedeemedDelegatorRequestCount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minBlockDelayToFinalizeRequest\",\"type\":\"uint256\"}],\"name\":\"updateMinBlockDelayToFinalizeRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_protocolFee\",\"type\":\"uint256\"}],\"name\":\"updateProtocolFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_utilizationRatePerBlock\",\"type\":\"uint256\"}],\"name\":\"updateUtilizationRatePerBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"utilizationRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"utilize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonTerminalKeyCount\",\"type\":\"uint256\"}],\"name\":\"utilizeWhileAddingKeys\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"utilizerData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"principal\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"utilizeIndex\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdrawProtocolFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // SDUtilityPoolABI is the input ABI used to generate the binding from. @@ -847,6 +847,37 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) SdRequestedForWithdraw() (*big return _SDUtilityPool.Contract.SdRequestedForWithdraw(&_SDUtilityPool.CallOpts) } +// TotalUtilizedSD is a free data retrieval call binding the contract method 0x8763a328. +// +// Solidity: function totalUtilizedSD() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) TotalUtilizedSD(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "totalUtilizedSD") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TotalUtilizedSD is a free data retrieval call binding the contract method 0x8763a328. +// +// Solidity: function totalUtilizedSD() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) TotalUtilizedSD() (*big.Int, error) { + return _SDUtilityPool.Contract.TotalUtilizedSD(&_SDUtilityPool.CallOpts) +} + +// TotalUtilizedSD is a free data retrieval call binding the contract method 0x8763a328. +// +// Solidity: function totalUtilizedSD() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) TotalUtilizedSD() (*big.Int, error) { + return _SDUtilityPool.Contract.TotalUtilizedSD(&_SDUtilityPool.CallOpts) +} + // UtilizationRatePerBlock is a free data retrieval call binding the contract method 0x962c7070. // // Solidity: function utilizationRatePerBlock() view returns(uint256) diff --git a/stader-lib/sdutility/sd-utility.go b/stader-lib/sdutility/sd-utility.go index 31775a205..4f3e96512 100644 --- a/stader-lib/sdutility/sd-utility.go +++ b/stader-lib/sdutility/sd-utility.go @@ -121,3 +121,21 @@ func AlreadyLiquidated(sp *stader.SDUtilityPoolContractManager, address common.A func LiquidationIndexByOperator(sp *stader.SDUtilityPoolContractManager, address common.Address, opts *bind.CallOpts) (*big.Int, error) { return sp.SDUtilityPool.LiquidationIndexByOperator(opts, address) } + +func GetTotalTVL(sp *stader.SDUtilityPoolContractManager, opts *bind.CallOpts) (*big.Int, error) { + supply, err := sp.SDUtilityPool.CTokenTotalSupply(opts) + if err != nil { + return nil, err + } + + er, err := sp.SDUtilityPool.GetLatestExchangeRate(opts) + if err != nil { + return nil, err + } + + return new(big.Int).Sub(supply, er), nil +} + +func GetTotalUtilized(sp *stader.SDUtilityPoolContractManager, opts *bind.CallOpts) (*big.Int, error) { + return sp.SDUtilityPool.TotalUtilizedSD(opts) +} diff --git a/stader/guardian/collector/network-collector.go b/stader/guardian/collector/network-collector.go index b7e6c5713..0bb761150 100644 --- a/stader/guardian/collector/network-collector.go +++ b/stader/guardian/collector/network-collector.go @@ -62,10 +62,9 @@ type NetworkCollector struct { // The utilize amount + fee SdUtilityPoolBalance *prometheus.Desc - // - SDUtilizationPosition *prometheus.Desc + TotalSDUtilized *prometheus.Desc - SDSelfBond *prometheus.Desc + TotalTVLSDUtilization *prometheus.Desc // The beacon client bc beacon.Client @@ -151,12 +150,12 @@ func NewNetworkCollector(bc beacon.Client, ec stader.ExecutionClient, nodeAddres "The current balance of the SD utility pool", nil, nil, ), - SDUtilizationPosition: prometheus.NewDesc(prometheus.BuildFQName(namespace, subsystem, "sd_utility_positon"), - "The current balance of the SD utility pool", + TotalSDUtilized: prometheus.NewDesc(prometheus.BuildFQName(namespace, subsystem, "total_sd_utilized"), + "The total the SD utilized in network", nil, nil, ), - SDSelfBond: prometheus.NewDesc(prometheus.BuildFQName(namespace, subsystem, "sd_self_bond"), - "The current balance of the SD utility pool", + TotalTVLSDUtilization: prometheus.NewDesc(prometheus.BuildFQName(namespace, subsystem, "sd_utilization_tvl"), + "The total value locked for SD utilization in network", nil, nil, ), bc: bc, @@ -185,8 +184,8 @@ func (collector *NetworkCollector) Describe(channel chan<- *prometheus.Desc) { channel <- collector.MinEthThreshold channel <- collector.MaxEthThreshold channel <- collector.SdUtilityPoolBalance - channel <- collector.SDUtilizationPosition - channel <- collector.SDSelfBond + channel <- collector.TotalSDUtilized + channel <- collector.TotalTVLSDUtilization } // Collect the latest metric values and pass them to Prometheus @@ -227,8 +226,8 @@ func (collector *NetworkCollector) Collect(channel chan<- prometheus.Metric) { channel <- prometheus.MustNewConstMetric( collector.MaxEthThreshold, prometheus.GaugeValue, state.StaderNetworkDetails.MaxEthThreshold) channel <- prometheus.MustNewConstMetric(collector.SdUtilityPoolBalance, prometheus.GaugeValue, state.StaderNetworkDetails.SdUtilityPoolBalance) - channel <- prometheus.MustNewConstMetric(collector.SDUtilizationPosition, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorSDUtilizationPosition) - channel <- prometheus.MustNewConstMetric(collector.SDSelfBond, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorSDSelfBond) + channel <- prometheus.MustNewConstMetric(collector.TotalSDUtilized, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorSDUtilizationPosition) + channel <- prometheus.MustNewConstMetric(collector.TotalSDUtilized, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorSDSelfBond) } // Log error messages diff --git a/stader/guardian/collector/operator-collector.go b/stader/guardian/collector/operator-collector.go index 366098214..70b9253fa 100644 --- a/stader/guardian/collector/operator-collector.go +++ b/stader/guardian/collector/operator-collector.go @@ -43,6 +43,10 @@ type OperatorCollector struct { LiquidationStatus *prometheus.Desc ClaimVaultBalance *prometheus.Desc + SDUtilizationPosition *prometheus.Desc + + SDSelfBond *prometheus.Desc + // The beacon client bc beacon.Client @@ -139,6 +143,14 @@ func NewOperatorCollector( prometheus.BuildFQName(namespace, OperatorSub, LiquidationStatus), "", nil, nil), ClaimVaultBalance: prometheus.NewDesc( prometheus.BuildFQName(namespace, OperatorSub, ClaimVaultBalance), "", nil, nil), + SDUtilizationPosition: prometheus.NewDesc(prometheus.BuildFQName(namespace, OperatorSub, "sd_utility_positon"), + "The current balance of the SD utility pool", + nil, nil, + ), + SDSelfBond: prometheus.NewDesc(prometheus.BuildFQName(namespace, OperatorSub, "sd_self_bond"), + "The current balance of the SD utility pool", + nil, nil, + ), bc: bc, ec: ec, nodeAddress: nodeAddress, @@ -178,6 +190,8 @@ func (collector *OperatorCollector) Describe(channel chan<- *prometheus.Desc) { channel <- collector.TotalSDSelfBond channel <- collector.LiquidationStatus channel <- collector.ClaimVaultBalance + channel <- collector.SDUtilizationPosition + channel <- collector.SDSelfBond } // Collect the latest metric values and pass them to Prometheus @@ -214,6 +228,8 @@ func (collector *OperatorCollector) Collect(channel chan<- prometheus.Metric) { channel <- prometheus.MustNewConstMetric(collector.TotalSDSelfBond, prometheus.GaugeValue, float64(state.StaderNetworkDetails.OperatorSDSelfBond)) channel <- prometheus.MustNewConstMetric(collector.LiquidationStatus, prometheus.GaugeValue, state.StaderNetworkDetails.LiquidationStatus) channel <- prometheus.MustNewConstMetric(collector.ClaimVaultBalance, prometheus.GaugeValue, state.StaderNetworkDetails.ClaimVaultBalance) + channel <- prometheus.MustNewConstMetric(collector.SDUtilizationPosition, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorSDUtilizationPosition) + channel <- prometheus.MustNewConstMetric(collector.SDSelfBond, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorSDSelfBond) } // Log error messages From f1c373d7e566f289f92e9b7ed37cae33555560a9 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Tue, 30 Jan 2024 12:22:11 +0700 Subject: [PATCH 152/159] Update metrics's name --- shared/services/state/network-state.go | 11 ++++++----- stader/guardian/collector/network-collector.go | 16 ++++++++++------ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/shared/services/state/network-state.go b/shared/services/state/network-state.go index 53693fad5..86527f297 100644 --- a/shared/services/state/network-state.go +++ b/shared/services/state/network-state.go @@ -67,7 +67,7 @@ type MetricDetails struct { TotalSDUtilized float64 // done - TotalSDUtilizationTVL float64 + SDUtilizationTVL float64 // Validator specific info @@ -512,12 +512,12 @@ func CreateMetricsCache( return nil, err } - totalSDUtilized, err := sdutility.GetTotalTVL(sdu, nil) + totalSDUtilized, err := sdutility.GetTotalUtilized(sdu, nil) if err != nil { return nil, err } - totalSDUtilizationTVL, err := sdutility.GetTotalTVL(sdu, nil) + sDUtilizationTVL, err := sdutility.GetTotalTVL(sdu, nil) if err != nil { return nil, err } @@ -620,8 +620,9 @@ func CreateMetricsCache( metricsDetails.LiquidationStatus = float64(liquidIndex.Int64()) metricsDetails.ClaimVaultBalance = math.RoundDown(eth.WeiToEth(operatorClaimVaultBalance), SixDecimalRound) - metricsDetails.TotalSDUtilized = float64(totalSDUtilized.Int64()) - metricsDetails.TotalSDUtilizationTVL = float64(totalSDUtilizationTVL.Int64()) + metricsDetails.TotalSDUtilized = math.RoundDown(eth.WeiToEth(totalSDUtilized), SixDecimalRound) + + metricsDetails.SDUtilizationTVL = math.RoundDown(eth.WeiToEth(sDUtilizationTVL), SixDecimalRound) state.StaderNetworkDetails = metricsDetails diff --git a/stader/guardian/collector/network-collector.go b/stader/guardian/collector/network-collector.go index 0bb761150..0a01e286f 100644 --- a/stader/guardian/collector/network-collector.go +++ b/stader/guardian/collector/network-collector.go @@ -62,9 +62,10 @@ type NetworkCollector struct { // The utilize amount + fee SdUtilityPoolBalance *prometheus.Desc + //Total amount of outstanding SD utilized TotalSDUtilized *prometheus.Desc - TotalTVLSDUtilization *prometheus.Desc + TotalValueLocledSDUtilization *prometheus.Desc // The beacon client bc beacon.Client @@ -150,11 +151,12 @@ func NewNetworkCollector(bc beacon.Client, ec stader.ExecutionClient, nodeAddres "The current balance of the SD utility pool", nil, nil, ), - TotalSDUtilized: prometheus.NewDesc(prometheus.BuildFQName(namespace, subsystem, "total_sd_utilized"), + //Total amount of outstanding SD utilized + TotalSDUtilized: prometheus.NewDesc(prometheus.BuildFQName(namespace, subsystem, "total_outstanding_sd_utilized"), "The total the SD utilized in network", nil, nil, ), - TotalTVLSDUtilization: prometheus.NewDesc(prometheus.BuildFQName(namespace, subsystem, "sd_utilization_tvl"), + TotalValueLocledSDUtilization: prometheus.NewDesc(prometheus.BuildFQName(namespace, subsystem, "sd_utilization_tvl"), "The total value locked for SD utilization in network", nil, nil, ), @@ -185,7 +187,7 @@ func (collector *NetworkCollector) Describe(channel chan<- *prometheus.Desc) { channel <- collector.MaxEthThreshold channel <- collector.SdUtilityPoolBalance channel <- collector.TotalSDUtilized - channel <- collector.TotalTVLSDUtilization + channel <- collector.TotalValueLocledSDUtilization } // Collect the latest metric values and pass them to Prometheus @@ -226,8 +228,10 @@ func (collector *NetworkCollector) Collect(channel chan<- prometheus.Metric) { channel <- prometheus.MustNewConstMetric( collector.MaxEthThreshold, prometheus.GaugeValue, state.StaderNetworkDetails.MaxEthThreshold) channel <- prometheus.MustNewConstMetric(collector.SdUtilityPoolBalance, prometheus.GaugeValue, state.StaderNetworkDetails.SdUtilityPoolBalance) - channel <- prometheus.MustNewConstMetric(collector.TotalSDUtilized, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorSDUtilizationPosition) - channel <- prometheus.MustNewConstMetric(collector.TotalSDUtilized, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorSDSelfBond) + + channel <- prometheus.MustNewConstMetric(collector.TotalSDUtilized, prometheus.GaugeValue, state.StaderNetworkDetails.TotalSDUtilized) + + channel <- prometheus.MustNewConstMetric(collector.TotalValueLocledSDUtilization, prometheus.GaugeValue, state.StaderNetworkDetails.SDUtilizationTVL) } // Log error messages From 0f8796da0b8b8f5dae26f367c9c56d47be5d86a0 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Tue, 30 Jan 2024 13:13:25 +0530 Subject: [PATCH 153/159] if there are no active validators, then pay interest from self bonded position --- shared/types/api/node.go | 13 +++++++------ stader-cli/node/claim-rewards.go | 27 ++++++++++++++++---------- stader/api/node/claim-rewards.go | 33 +++++++++++++++++++++++++++++++- 3 files changed, 56 insertions(+), 17 deletions(-) diff --git a/shared/types/api/node.go b/shared/types/api/node.go index 50f72ff29..fccfe010d 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -398,12 +398,13 @@ type NodeSignResponse struct { } type CanClaimRewards struct { - Status string `json:"status"` - Error string `json:"error"` - NoRewards bool `json:"noRewards"` - WithdrawableInEth *big.Int `json:"withdrawableInEth"` - ClaimsBalance *big.Int `json:"claimsBalance"` - GasInfo stader.GasInfo `json:"gasInfo"` + Status string `json:"status"` + Error string `json:"error"` + NoRewards bool `json:"noRewards"` + WithdrawableInEth *big.Int `json:"withdrawableInEth"` + ClaimsBalance *big.Int `json:"claimsBalance"` + NonTerminalValidators uint64 `json:"nonTerminalValidators"` + GasInfo stader.GasInfo `json:"gasInfo"` } type ClaimRewards struct { diff --git a/stader-cli/node/claim-rewards.go b/stader-cli/node/claim-rewards.go index 53312b9c9..f503202b4 100644 --- a/stader-cli/node/claim-rewards.go +++ b/stader-cli/node/claim-rewards.go @@ -44,20 +44,27 @@ func ClaimRewards(c *cli.Context) error { sdStatus := sdStatusResponse.SDStatus - // if withdrawableInEth < claimsBalance, then there is an existing utilization position - if canClaimRewardsResponse.ClaimsBalance.Cmp(canClaimRewardsResponse.WithdrawableInEth) != 0 { - if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { - totalFee := sdStatus.AccumulatedInterest + totalFee := sdStatus.AccumulatedInterest - fmt.Printf("You need to first pay %s and close the utilization position to get back your funds. Execute the following command to repay your utilized SD stader-cli repay-sd --amount \n", eth.DisplayAmountInUnits(totalFee, "sd")) + if canClaimRewardsResponse.NonTerminalValidators == 0 { + if sdStatus.SdCollateralCurrentAmount.Cmp(totalFee) < 0 { + fmt.Printf("Since you exited all your validators, you require to have at least %s SD in your self bonded position to claim your rewards.", eth.DisplayAmountInUnits(totalFee, "sd")) + return nil + } + } else { + // if withdrawableInEth < claimsBalance, then there is an existing utilization position + if canClaimRewardsResponse.ClaimsBalance.Cmp(canClaimRewardsResponse.WithdrawableInEth) != 0 { + if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { + fmt.Printf("You need to first pay %s and close the utilization position to get back your funds. Execute the following command to repay your utilized SD stader-cli repay-sd --amount \n", eth.DisplayAmountInUnits(totalFee, "sd")) - fmt.Printf("Based on the current Health Factor, you can claim upto %s.\n", eth.DisplayAmountInUnits(canClaimRewardsResponse.WithdrawableInEth, "eth")) + fmt.Printf("Based on the current Health Factor, you can claim upto %s.\n", eth.DisplayAmountInUnits(canClaimRewardsResponse.WithdrawableInEth, "eth")) - fmt.Printf("Note: Please repay your utilized SD by using the following command to claim the remaining ETH: stader-cli sd repay --amount .\n") + fmt.Printf("Note: Please repay your utilized SD by using the following command to claim the remaining ETH: stader-cli sd repay --amount .\n") - if !cliutils.Confirm("Are you sure you want to proceed?\n\n") { - fmt.Println("Cancelled.") - return nil + if !cliutils.Confirm("Are you sure you want to proceed?\n\n") { + fmt.Println("Cancelled.") + return nil + } } } } diff --git a/stader/api/node/claim-rewards.go b/stader/api/node/claim-rewards.go index e06a85671..193187c54 100644 --- a/stader/api/node/claim-rewards.go +++ b/stader/api/node/claim-rewards.go @@ -24,6 +24,10 @@ func CanClaimRewards(c *cli.Context) (*api.CanClaimRewards, error) { if err != nil { return nil, err } + pnr, err := services.GetPermissionlessNodeRegistry(c) + if err != nil { + return nil, err + } nodeAccount, err := w.GetNodeAccount() if err != nil { return nil, err @@ -31,6 +35,23 @@ func CanClaimRewards(c *cli.Context) (*api.CanClaimRewards, error) { response := api.CanClaimRewards{} + operatorId, err := node.GetOperatorId(pnr, nodeAccount.Address, nil) + if err != nil { + return nil, err + } + + totalValidatorKeys, err := node.GetTotalValidatorKeys(pnr, operatorId, nil) + if err != nil { + return nil, err + } + + nonTerminalValidatorKeys, err := node.GetTotalNonTerminalValidatorKeys(pnr, nodeAccount.Address, totalValidatorKeys, nil) + if err != nil { + return nil, err + } + + response.NonTerminalValidators = nonTerminalValidatorKeys + operatorClaimVaultBalance, err := node.GetOperatorRewardsCollectorBalance(orc, nodeAccount.Address, nil) if err != nil { return nil, err @@ -124,8 +145,18 @@ func ClaimRewards(c *cli.Context) (*api.ClaimRewards, error) { return nil, err } + totalValidatorKeys, err := node.GetTotalValidatorKeys(pnr, operatorId, nil) + if err != nil { + return nil, err + } + + nonTerminalValidatorKeys, err := node.GetTotalNonTerminalValidatorKeys(pnr, nodeAccount.Address, totalValidatorKeys, nil) + if err != nil { + return nil, err + } + totalWithdrawableEth := operatorRewardsBalance - if operatorRewardsBalance.Cmp(withdrawableInEth) > 0 { + if operatorRewardsBalance.Cmp(withdrawableInEth) > 0 && nonTerminalValidatorKeys != 0 { totalWithdrawableEth = withdrawableInEth } From ee4830d10db1c8d10ce36f53311c18b45a052428 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Thu, 1 Feb 2024 21:22:47 +0530 Subject: [PATCH 154/159] changes --- abis/SDUtilityPool.abi.json | 3271 +++++++++++++++---------- abis/SdCollateral.abi.json | 83 +- shared/types/api/node.go | 13 +- stader-cli/node/claim-rewards.go | 25 +- stader-cli/node/status.go | 9 +- stader-lib/contracts/sd-collateral.go | 338 +-- stader-lib/contracts/sd-utility.go | 3260 ++++++++++++++++++++---- stader-lib/sdutility/sd-utility.go | 8 + stader/api/node/claim-rewards.go | 33 +- stader/api/node/repay-sd.go | 36 +- stader/api/node/status.go | 17 - 11 files changed, 5037 insertions(+), 2056 deletions(-) diff --git a/abis/SDUtilityPool.abi.json b/abis/SDUtilityPool.abi.json index 4c9eef785..09d5b84b3 100644 --- a/abis/SDUtilityPool.abi.json +++ b/abis/SDUtilityPool.abi.json @@ -1,1273 +1,2000 @@ [ - { - "inputs": [], - "name": "AlreadyClaimed", - "type": "error" - }, - { - "inputs": [], - "name": "AlreadyLiquidated", - "type": "error" - }, - { - "inputs": [], - "name": "CallerNotAuthorizedToRedeem", - "type": "error" - }, - { - "inputs": [], - "name": "CannotFindRequestId", - "type": "error" - }, - { - "inputs": [], - "name": "InsufficientPoolBalance", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidAmountOfWithdraw", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidInput", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidWithdrawAmount", - "type": "error" - }, - { - "inputs": [], - "name": "MaxLimitOnWithdrawRequestCountReached", - "type": "error" - }, - { - "inputs": [], - "name": "NotClaimable", - "type": "error" - }, - { - "inputs": [], - "name": "NotLiquidatable", - "type": "error" - }, - { - "inputs": [], - "name": "NotLiquidator", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "requestId", - "type": "uint256" - } - ], - "name": "RequestIdNotFinalized", - "type": "error" - }, - { - "inputs": [], - "name": "SDTransferFailed", - "type": "error" - }, - { - "inputs": [], - "name": "SDUtilizeLimitReached", - "type": "error" - }, - { - "inputs": [], - "name": "UnHealthyPosition", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "feeAccumulated", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalProtocolFee", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalUtilizedSD", - "type": "uint256" - } - ], - "name": "AccruedFees", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "CompleteLiquidation", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "delegator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sdAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sdXToMint", - "type": "uint256" - } - ], - "name": "Delegated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "nextRequestIdToFinalize", - "type": "uint256" - } - ], - "name": "FinalizedWithdrawRequest", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalLiquidationAmountInEth", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "liquidationBonusInEth", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "liquidationFeeInEth", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "address", - "name": "liquidator", - "type": "address" - } - ], - "name": "LiquidationCall", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "protocolFeeFactor", - "type": "uint256" - } - ], - "name": "ProtocolFeeFactorUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "delegator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sdAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sdXAmount", - "type": "uint256" - } - ], - "name": "Redeemed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "utilizer", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "repayAmount", - "type": "uint256" - } - ], - "name": "Repaid", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "caller", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sdToTransfer", - "type": "uint256" - } - ], - "name": "RequestRedeemed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "liquidationThreshold", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "liquidationBonusPercent", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "liquidationFeePercent", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "ltv", - "type": "uint256" - } - ], - "name": "RiskConfigUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "utilizer", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "utilizeAmount", - "type": "uint256" - } - ], - "name": "SDUtilized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "conservativeEthPerKey", - "type": "uint256" - } - ], - "name": "UpdatedConservativeEthPerKey", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "finalizationBatchLimit", - "type": "uint256" - } - ], - "name": "UpdatedFinalizationBatchLimit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "maxETHWorthOfSDPerValidator", - "type": "uint256" - } - ], - "name": "UpdatedMaxETHWorthOfSDPerValidator", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "count", - "type": "uint256" - } - ], - "name": "UpdatedMaxNonRedeemedDelegatorRequestCount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "minBlockDelayToFinalizeRequest", - "type": "uint256" - } - ], - "name": "UpdatedMinBlockDelayToFinalizeRequest", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_staderConfig", - "type": "address" - } - ], - "name": "UpdatedStaderConfig", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "utilizationRatePerBlock", - "type": "uint256" - } - ], - "name": "UtilizationRatePerBlockUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "caller", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "nextRequestId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sdAmountToWithdraw", - "type": "uint256" - } - ], - "name": "WithdrawRequestReceived", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "WithdrawnProtocolFee", - "type": "event" - }, - { - "inputs": [], - "name": "accrueFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "accumulatedProtocolFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "cTokenTotalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "requestId", - "type": "uint256" - } - ], - "name": "claim", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "completeLiquidation", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "sdAmount", - "type": "uint256" - } - ], - "name": "delegate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "delegatorCTokenBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "delegatorWithdrawRequestedCTokenCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "delegatorWithdrawRequests", - "outputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amountOfCToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sdExpected", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sdFinalized", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "requestBlock", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "exchangeRateCurrent", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "exchangeRateStored", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "finalizeDelegatorWithdrawalRequest", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "getDelegationRatePerBlock", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_delegator", - "type": "address" - } - ], - "name": "getDelegatorLatestSDBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getLatestExchangeRate", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getLiquidationThreshold", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "getOperatorLiquidation", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "totalAmountInEth", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBonusInEth", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalFeeInEth", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isRepaid", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isClaimed", - "type": "bool" - }, - { - "internalType": "address", - "name": "liquidator", - "type": "address" - } - ], - "internalType": "struct OperatorLiquidation", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPoolAvailableSDBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_owner", - "type": "address" - } - ], - "name": "getRequestIdsByDelegator", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "getUserData", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "totalInterestSD", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalCollateralInEth", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "healthFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lockedEth", - "type": "uint256" - } - ], - "internalType": "struct UserData", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_utilizer", - "type": "address" - } - ], - "name": "getUtilizerLatestBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "liquidationCall", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "liquidationIndexByOperator", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxApproveSD", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "maxETHWorthOfSDPerValidator", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "poolUtilization", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "repayAmount", - "type": "uint256" - } - ], - "name": "repay", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "utilizer", - "type": "address" - }, - { - "internalType": "uint256", - "name": "repayAmount", - "type": "uint256" - } - ], - "name": "repayOnBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "requestIdsByDelegatorAddress", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "cTokenAmount", - "type": "uint256" - } - ], - "name": "requestWithdraw", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "sdAmount", - "type": "uint256" - } - ], - "name": "requestWithdrawWithSDAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "sdRequestedForWithdraw", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalUtilizedSD", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_newEthPerKey", - "type": "uint256" - } - ], - "name": "updateConservativeEthPerKey", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_finalizationBatchLimit", - "type": "uint256" - } - ], - "name": "updateFinalizationBatchLimit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_maxETHWorthOfSDPerValidator", - "type": "uint256" - } - ], - "name": "updateMaxETHWorthOfSDPerValidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_count", - "type": "uint256" - } - ], - "name": "updateMaxNonRedeemedDelegatorRequestCount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_minBlockDelayToFinalizeRequest", - "type": "uint256" - } - ], - "name": "updateMinBlockDelayToFinalizeRequest", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_protocolFee", - "type": "uint256" - } - ], - "name": "updateProtocolFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_staderConfig", - "type": "address" - } - ], - "name": "updateStaderConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_utilizationRatePerBlock", - "type": "uint256" - } - ], - "name": "updateUtilizationRatePerBlock", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "utilizationRatePerBlock", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "utilizeAmount", - "type": "uint256" - } - ], - "name": "utilize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "uint256", - "name": "utilizeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "nonTerminalKeyCount", - "type": "uint256" - } - ], - "name": "utilizeWhileAddingKeys", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "utilizerBalanceCurrent", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "utilizerBalanceStored", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "utilizerData", - "outputs": [ - { - "internalType": "uint256", - "name": "principal", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "utilizeIndex", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "withdrawProtocolFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ] \ No newline at end of file + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AlreadyClaimed", + "type": "error" + }, + { + "inputs": [], + "name": "AlreadyLiquidated", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotAuthorizedToRedeem", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotManager", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotStaderContract", + "type": "error" + }, + { + "inputs": [], + "name": "CannotFindRequestId", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientPoolBalance", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAmountOfWithdraw", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidInput", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidWithdrawAmount", + "type": "error" + }, + { + "inputs": [], + "name": "MaxLimitOnWithdrawRequestCountReached", + "type": "error" + }, + { + "inputs": [], + "name": "NotClaimable", + "type": "error" + }, + { + "inputs": [], + "name": "NotLiquidatable", + "type": "error" + }, + { + "inputs": [], + "name": "NotLiquidator", + "type": "error" + }, + { + "inputs": [], + "name": "OperatorUtilizedSDBalanceNonZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + } + ], + "name": "RequestIdNotFinalized", + "type": "error" + }, + { + "inputs": [], + "name": "SDTransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "SDUtilizeLimitReached", + "type": "error" + }, + { + "inputs": [], + "name": "UnHealthyPosition", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "feeAccumulated", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalProtocolFee", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalUtilizedSD", + "type": "uint256" + } + ], + "name": "AccruedFees", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "utilizer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdInterest", + "type": "uint256" + } + ], + "name": "ClearedUtilizerInterest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "CompleteLiquidation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdXToMint", + "type": "uint256" + } + ], + "name": "Delegated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "nextRequestIdToFinalize", + "type": "uint256" + } + ], + "name": "FinalizedWithdrawRequest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalLiquidationAmountInEth", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidationBonusInEth", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidationFeeInEth", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "liquidator", + "type": "address" + } + ], + "name": "LiquidationCall", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "protocolFeeFactor", + "type": "uint256" + } + ], + "name": "ProtocolFeeFactorUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdXAmount", + "type": "uint256" + } + ], + "name": "Redeemed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "utilizer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "Repaid", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "utilizer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "utilizedSDAmount", + "type": "uint256" + } + ], + "name": "RepaidUtilizedSDBalance", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdToTransfer", + "type": "uint256" + } + ], + "name": "RequestRedeemed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "liquidationThreshold", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidationBonusPercent", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidationFeePercent", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "ltv", + "type": "uint256" + } + ], + "name": "RiskConfigUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "utilizer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "utilizeAmount", + "type": "uint256" + } + ], + "name": "SDUtilized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "conservativeEthPerKey", + "type": "uint256" + } + ], + "name": "UpdatedConservativeEthPerKey", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "finalizationBatchLimit", + "type": "uint256" + } + ], + "name": "UpdatedFinalizationBatchLimit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "maxETHWorthOfSDPerValidator", + "type": "uint256" + } + ], + "name": "UpdatedMaxETHWorthOfSDPerValidator", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "count", + "type": "uint256" + } + ], + "name": "UpdatedMaxNonRedeemedDelegatorRequestCount", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "minBlockDelayToFinalizeRequest", + "type": "uint256" + } + ], + "name": "UpdatedMinBlockDelayToFinalizeRequest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_staderConfig", + "type": "address" + } + ], + "name": "UpdatedStaderConfig", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "utilizationRatePerBlock", + "type": "uint256" + } + ], + "name": "UtilizationRatePerBlockUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "nextRequestId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdAmountToWithdraw", + "type": "uint256" + } + ], + "name": "WithdrawRequestReceived", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "WithdrawnProtocolFee", + "type": "event" + }, + { + "inputs": [], + "name": "DECIMAL", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_PROTOCOL_FEE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_UTILIZATION_RATE_PER_BLOCK", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MIN_SD_DELEGATE_LIMIT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MIN_SD_WITHDRAW_LIMIT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "accrualBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "accrueFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "accumulatedProtocolFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "cTokenTotalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_requestId", + "type": "uint256" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_utilizer", + "type": "address" + } + ], + "name": "clearUtilizerInterest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "completeLiquidation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "conservativeEthPerKey", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "sdAmount", + "type": "uint256" + } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "delegatorCTokenBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "delegatorWithdrawRequestedCTokenCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "delegatorWithdrawRequests", + "outputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountOfCToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "sdExpected", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "sdFinalized", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestBlock", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "exchangeRateCurrent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "exchangeRateStored", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "finalizationBatchLimit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "finalizeDelegatorWithdrawalRequest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getDelegationRatePerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_delegator", + "type": "address" + } + ], + "name": "getDelegatorLatestSDBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getLatestExchangeRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getLiquidationThreshold", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getOperatorLiquidation", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "totalAmountInEth", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBonusInEth", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalFeeInEth", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isRepaid", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isClaimed", + "type": "bool" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + } + ], + "internalType": "struct OperatorLiquidation", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "getOperatorTotalEth", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPoolAvailableSDBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_delegator", + "type": "address" + } + ], + "name": "getRequestIdsByDelegator", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getUserData", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "totalInterestSD", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalCollateralInEth", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "healthFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lockedEth", + "type": "uint256" + } + ], + "internalType": "struct UserData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_utilizer", + "type": "address" + } + ], + "name": "getUtilizerLatestBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_admin", + "type": "address" + }, + { + "internalType": "address", + "name": "_staderConfig", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "liquidationCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "liquidationIndexByOperator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "liquidations", + "outputs": [ + { + "internalType": "uint256", + "name": "totalAmountInEth", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBonusInEth", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalFeeInEth", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isRepaid", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isClaimed", + "type": "bool" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxApproveSD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "maxETHWorthOfSDPerValidator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxNonRedeemedDelegatorRequestCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minBlockDelayToFinalizeRequest", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextRequestId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextRequestIdToFinalize", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poolUtilization", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "protocolFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repay", + "outputs": [ + { + "internalType": "uint256", + "name": "repaidAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feePaid", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "repayFullAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "repaidAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feePaid", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "utilizer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repayOnBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "repaidAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feePaid", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_utilizer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "repayUtilizedSDBalance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "requestIdsByDelegatorAddress", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_cTokenAmount", + "type": "uint256" + } + ], + "name": "requestWithdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "_requestId", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_sdAmount", + "type": "uint256" + } + ], + "name": "requestWithdrawWithSDAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "_requestId", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "riskConfig", + "outputs": [ + { + "internalType": "uint256", + "name": "liquidationThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationBonusPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationFeePercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "ltv", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "sdRequestedForWithdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "sdReservedForClaim", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "staderConfig", + "outputs": [ + { + "internalType": "contract IStaderConfig", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalUtilizedSD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_newEthPerKey", + "type": "uint256" + } + ], + "name": "updateConservativeEthPerKey", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_finalizationBatchLimit", + "type": "uint256" + } + ], + "name": "updateFinalizationBatchLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_maxETHWorthOfSDPerValidator", + "type": "uint256" + } + ], + "name": "updateMaxETHWorthOfSDPerValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_count", + "type": "uint256" + } + ], + "name": "updateMaxNonRedeemedDelegatorRequestCount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_minBlockDelayToFinalizeRequest", + "type": "uint256" + } + ], + "name": "updateMinBlockDelayToFinalizeRequest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_protocolFee", + "type": "uint256" + } + ], + "name": "updateProtocolFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "liquidationThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationBonusPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationFeePercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "ltv", + "type": "uint256" + } + ], + "name": "updateRiskConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staderConfig", + "type": "address" + } + ], + "name": "updateStaderConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_utilizationRatePerBlock", + "type": "uint256" + } + ], + "name": "updateUtilizationRatePerBlock", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "utilizationRatePerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "utilizeAmount", + "type": "uint256" + } + ], + "name": "utilize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "utilizeIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "utilizeAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nonTerminalKeyCount", + "type": "uint256" + } + ], + "name": "utilizeWhileAddingKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "utilizerBalanceCurrent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "utilizerBalanceStored", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "utilizerData", + "outputs": [ + { + "internalType": "uint256", + "name": "principal", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "utilizeIndex", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "withdrawProtocolFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/abis/SdCollateral.abi.json b/abis/SdCollateral.abi.json index f0af7613a..6307e63d9 100644 --- a/abis/SdCollateral.abi.json +++ b/abis/SdCollateral.abi.json @@ -30,6 +30,11 @@ "name": "InsufficientSDToWithdraw", "type": "error" }, + { + "inputs": [], + "name": "InsufficientSelfBondToRepay", + "type": "error" + }, { "inputs": [], "name": "InvalidPoolId", @@ -45,6 +50,11 @@ "name": "NoStateChange", "type": "error" }, + { + "inputs": [], + "name": "NonTerminalKeysNotZero", + "type": "error" + }, { "inputs": [], "name": "SDTransferFailed", @@ -225,25 +235,6 @@ "name": "SDSlashed", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sdSlashFromUtilized", - "type": "uint256" - } - ], - "name": "SDSlashedFromUtilize", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -339,6 +330,25 @@ "name": "UtilizedSDDeposited", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sdSlashFromUtilized", + "type": "uint256" + } + ], + "name": "UtilizedSDSlashed", + "type": "event" + }, { "inputs": [], "name": "DEFAULT_ADMIN_ROLE", @@ -434,7 +444,7 @@ "type": "uint256" } ], - "name": "depositUtilizedSD", + "name": "depositSDFromUtilityPool", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -850,6 +860,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "transferBackUtilizedSD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -908,5 +931,23 @@ "outputs": [], "stateMutability": "nonpayable", "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_requestedSD", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "withdrawOnBehalf", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" } -] +] \ No newline at end of file diff --git a/shared/types/api/node.go b/shared/types/api/node.go index fccfe010d..50f72ff29 100644 --- a/shared/types/api/node.go +++ b/shared/types/api/node.go @@ -398,13 +398,12 @@ type NodeSignResponse struct { } type CanClaimRewards struct { - Status string `json:"status"` - Error string `json:"error"` - NoRewards bool `json:"noRewards"` - WithdrawableInEth *big.Int `json:"withdrawableInEth"` - ClaimsBalance *big.Int `json:"claimsBalance"` - NonTerminalValidators uint64 `json:"nonTerminalValidators"` - GasInfo stader.GasInfo `json:"gasInfo"` + Status string `json:"status"` + Error string `json:"error"` + NoRewards bool `json:"noRewards"` + WithdrawableInEth *big.Int `json:"withdrawableInEth"` + ClaimsBalance *big.Int `json:"claimsBalance"` + GasInfo stader.GasInfo `json:"gasInfo"` } type ClaimRewards struct { diff --git a/stader-cli/node/claim-rewards.go b/stader-cli/node/claim-rewards.go index f503202b4..3161cd8d0 100644 --- a/stader-cli/node/claim-rewards.go +++ b/stader-cli/node/claim-rewards.go @@ -46,25 +46,18 @@ func ClaimRewards(c *cli.Context) error { totalFee := sdStatus.AccumulatedInterest - if canClaimRewardsResponse.NonTerminalValidators == 0 { - if sdStatus.SdCollateralCurrentAmount.Cmp(totalFee) < 0 { - fmt.Printf("Since you exited all your validators, you require to have at least %s SD in your self bonded position to claim your rewards.", eth.DisplayAmountInUnits(totalFee, "sd")) - return nil - } - } else { - // if withdrawableInEth < claimsBalance, then there is an existing utilization position - if canClaimRewardsResponse.ClaimsBalance.Cmp(canClaimRewardsResponse.WithdrawableInEth) != 0 { - if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { - fmt.Printf("You need to first pay %s and close the utilization position to get back your funds. Execute the following command to repay your utilized SD stader-cli repay-sd --amount \n", eth.DisplayAmountInUnits(totalFee, "sd")) + // if withdrawableInEth < claimsBalance, then there is an existing utilization position + if canClaimRewardsResponse.ClaimsBalance.Cmp(canClaimRewardsResponse.WithdrawableInEth) != 0 { + if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { + fmt.Printf("You need to first pay %s and close the utilization position to get back your funds. Execute the following command to repay your utilized SD stader-cli repay-sd --amount \n", eth.DisplayAmountInUnits(totalFee, "sd")) - fmt.Printf("Based on the current Health Factor, you can claim upto %s.\n", eth.DisplayAmountInUnits(canClaimRewardsResponse.WithdrawableInEth, "eth")) + fmt.Printf("Based on the current Health Factor, you can claim upto %s.\n", eth.DisplayAmountInUnits(canClaimRewardsResponse.WithdrawableInEth, "eth")) - fmt.Printf("Note: Please repay your utilized SD by using the following command to claim the remaining ETH: stader-cli sd repay --amount .\n") + fmt.Printf("Note: Please repay your utilized SD by using the following command to claim the remaining ETH: stader-cli sd repay --amount .\n") - if !cliutils.Confirm("Are you sure you want to proceed?\n\n") { - fmt.Println("Cancelled.") - return nil - } + if !cliutils.Confirm("Are you sure you want to proceed?\n\n") { + fmt.Println("Cancelled.") + return nil } } } diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 19cac4262..5fd0e6bc3 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -113,10 +113,15 @@ func getNodeStatus(c *cli.Context) error { fmt.Printf("2. Use the %sstader-cli node claim-rewards%s command to claim the EL rewards from the claim vault to your operator reward address\n\n", log.ColorGreen, log.ColorReset) } - if status.OperatorRewardCollectorBalance.Cmp(big.NewInt(0)) > 0 { + operatorWithdrawableAmount := status.OperatorRewardCollectorBalance + if status.OperatorWithdrawableEth.Cmp(operatorWithdrawableAmount) < 0 { + operatorWithdrawableAmount = status.OperatorWithdrawableEth + } + + if operatorWithdrawableAmount.Cmp(big.NewInt(0)) > 0 { fmt.Printf( "The Operator has aggregated total claims of %s in the claim vault\n", - eth.DisplayAmountInUnits(status.OperatorWithdrawableEth, "eth")) + eth.DisplayAmountInUnits(operatorWithdrawableAmount, "eth")) fmt.Printf("To transfer the claims to your operator reward address use the %sstader-cli node claim-rewards%s command\n\n", log.ColorGreen, log.ColorReset) } diff --git a/stader-lib/contracts/sd-collateral.go b/stader-lib/contracts/sd-collateral.go index d731cb25d..2708f5ccc 100644 --- a/stader-lib/contracts/sd-collateral.go +++ b/stader-lib/contracts/sd-collateral.go @@ -31,7 +31,7 @@ var ( // SdCollateralMetaData contains all meta data concerning the SdCollateral contract. var SdCollateralMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CallerNotManager\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotStaderContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotWithdrawVault\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"operatorSDCollateral\",\"type\":\"uint256\"}],\"name\":\"InsufficientSDToWithdraw\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPoolId\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPoolLimit\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoStateChange\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"ReducedUtilizedPosition\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"SDDeposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"SDRepaid\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"auction\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdSlashed\",\"type\":\"uint256\"}],\"name\":\"SDSlashed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdSlashFromUtilized\",\"type\":\"uint256\"}],\"name\":\"SDSlashedFromUtilize\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"SDWithdrawn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"poolId\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"UpdatedPoolIdForOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"poolId\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minThreshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"withdrawThreshold\",\"type\":\"uint256\"}],\"name\":\"UpdatedPoolThreshold\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"UtilizedSDDeposited\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_ethAmount\",\"type\":\"uint256\"}],\"name\":\"convertETHToSD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_sdAmount\",\"type\":\"uint256\"}],\"name\":\"convertSDToETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_sdAmount\",\"type\":\"uint256\"}],\"name\":\"depositSDAsCollateral\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_sdAmount\",\"type\":\"uint256\"}],\"name\":\"depositSDAsCollateralOnBehalf\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_sdAmount\",\"type\":\"uint256\"}],\"name\":\"depositUtilizedSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"_poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_numValidator\",\"type\":\"uint256\"}],\"name\":\"getMinimumSDToBond\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_minSDToBond\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"}],\"name\":\"getOperatorInfo\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"_poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_validatorCount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"}],\"name\":\"getOperatorWithdrawThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"operatorWithdrawThreshold\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"_poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_numValidator\",\"type\":\"uint256\"}],\"name\":\"getRemainingSDToBond\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"}],\"name\":\"getRewardEligibleSD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_rewardEligibleSD\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"_poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_numValidator\",\"type\":\"uint256\"}],\"name\":\"hasEnoughSDCollateral\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxApproveSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"operatorSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"operatorUtilizedSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"name\":\"poolThresholdbyPoolId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"minThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawThreshold\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"units\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_sdAmount\",\"type\":\"uint256\"}],\"name\":\"reduceUtilizedSDPosition\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_validatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"_poolId\",\"type\":\"uint8\"}],\"name\":\"slashValidatorSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"staderConfig\",\"outputs\":[{\"internalType\":\"contractIStaderConfig\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"_poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_minThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_withdrawThreshold\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_units\",\"type\":\"string\"}],\"name\":\"updatePoolThreshold\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_requestedSD\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CallerNotManager\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotStaderContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotWithdrawVault\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"operatorSDCollateral\",\"type\":\"uint256\"}],\"name\":\"InsufficientSDToWithdraw\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientSelfBondToRepay\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPoolId\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPoolLimit\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoStateChange\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonTerminalKeysNotZero\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"ReducedUtilizedPosition\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"SDDeposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"SDRepaid\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"auction\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdSlashed\",\"type\":\"uint256\"}],\"name\":\"SDSlashed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"SDWithdrawn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"poolId\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"UpdatedPoolIdForOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"poolId\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minThreshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"withdrawThreshold\",\"type\":\"uint256\"}],\"name\":\"UpdatedPoolThreshold\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"UtilizedSDDeposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdSlashFromUtilized\",\"type\":\"uint256\"}],\"name\":\"UtilizedSDSlashed\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_ethAmount\",\"type\":\"uint256\"}],\"name\":\"convertETHToSD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_sdAmount\",\"type\":\"uint256\"}],\"name\":\"convertSDToETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_sdAmount\",\"type\":\"uint256\"}],\"name\":\"depositSDAsCollateral\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_sdAmount\",\"type\":\"uint256\"}],\"name\":\"depositSDAsCollateralOnBehalf\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_sdAmount\",\"type\":\"uint256\"}],\"name\":\"depositSDFromUtilityPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"_poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_numValidator\",\"type\":\"uint256\"}],\"name\":\"getMinimumSDToBond\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_minSDToBond\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"}],\"name\":\"getOperatorInfo\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"_poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_operatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_validatorCount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"}],\"name\":\"getOperatorWithdrawThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"operatorWithdrawThreshold\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"_poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_numValidator\",\"type\":\"uint256\"}],\"name\":\"getRemainingSDToBond\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"}],\"name\":\"getRewardEligibleSD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_rewardEligibleSD\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"_poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_numValidator\",\"type\":\"uint256\"}],\"name\":\"hasEnoughSDCollateral\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxApproveSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"operatorSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"operatorUtilizedSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"name\":\"poolThresholdbyPoolId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"minThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawThreshold\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"units\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_sdAmount\",\"type\":\"uint256\"}],\"name\":\"reduceUtilizedSDPosition\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_validatorId\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"_poolId\",\"type\":\"uint8\"}],\"name\":\"slashValidatorSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"staderConfig\",\"outputs\":[{\"internalType\":\"contractIStaderConfig\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"}],\"name\":\"transferBackUtilizedSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"_poolId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_minThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_withdrawThreshold\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_units\",\"type\":\"string\"}],\"name\":\"updatePoolThreshold\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_requestedSD\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_requestedSD\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"}],\"name\":\"withdrawOnBehalf\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // SdCollateralABI is the input ABI used to generate the binding from. @@ -761,25 +761,25 @@ func (_SdCollateral *SdCollateralTransactorSession) DepositSDAsCollateralOnBehal return _SdCollateral.Contract.DepositSDAsCollateralOnBehalf(&_SdCollateral.TransactOpts, _operator, _sdAmount) } -// DepositUtilizedSD is a paid mutator transaction binding the contract method 0xd52eb99e. +// DepositSDFromUtilityPool is a paid mutator transaction binding the contract method 0xc85e8dde. // -// Solidity: function depositUtilizedSD(address _operator, uint256 _sdAmount) returns() -func (_SdCollateral *SdCollateralTransactor) DepositUtilizedSD(opts *bind.TransactOpts, _operator common.Address, _sdAmount *big.Int) (*types.Transaction, error) { - return _SdCollateral.contract.Transact(opts, "depositUtilizedSD", _operator, _sdAmount) +// Solidity: function depositSDFromUtilityPool(address _operator, uint256 _sdAmount) returns() +func (_SdCollateral *SdCollateralTransactor) DepositSDFromUtilityPool(opts *bind.TransactOpts, _operator common.Address, _sdAmount *big.Int) (*types.Transaction, error) { + return _SdCollateral.contract.Transact(opts, "depositSDFromUtilityPool", _operator, _sdAmount) } -// DepositUtilizedSD is a paid mutator transaction binding the contract method 0xd52eb99e. +// DepositSDFromUtilityPool is a paid mutator transaction binding the contract method 0xc85e8dde. // -// Solidity: function depositUtilizedSD(address _operator, uint256 _sdAmount) returns() -func (_SdCollateral *SdCollateralSession) DepositUtilizedSD(_operator common.Address, _sdAmount *big.Int) (*types.Transaction, error) { - return _SdCollateral.Contract.DepositUtilizedSD(&_SdCollateral.TransactOpts, _operator, _sdAmount) +// Solidity: function depositSDFromUtilityPool(address _operator, uint256 _sdAmount) returns() +func (_SdCollateral *SdCollateralSession) DepositSDFromUtilityPool(_operator common.Address, _sdAmount *big.Int) (*types.Transaction, error) { + return _SdCollateral.Contract.DepositSDFromUtilityPool(&_SdCollateral.TransactOpts, _operator, _sdAmount) } -// DepositUtilizedSD is a paid mutator transaction binding the contract method 0xd52eb99e. +// DepositSDFromUtilityPool is a paid mutator transaction binding the contract method 0xc85e8dde. // -// Solidity: function depositUtilizedSD(address _operator, uint256 _sdAmount) returns() -func (_SdCollateral *SdCollateralTransactorSession) DepositUtilizedSD(_operator common.Address, _sdAmount *big.Int) (*types.Transaction, error) { - return _SdCollateral.Contract.DepositUtilizedSD(&_SdCollateral.TransactOpts, _operator, _sdAmount) +// Solidity: function depositSDFromUtilityPool(address _operator, uint256 _sdAmount) returns() +func (_SdCollateral *SdCollateralTransactorSession) DepositSDFromUtilityPool(_operator common.Address, _sdAmount *big.Int) (*types.Transaction, error) { + return _SdCollateral.Contract.DepositSDFromUtilityPool(&_SdCollateral.TransactOpts, _operator, _sdAmount) } // GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. @@ -929,6 +929,27 @@ func (_SdCollateral *SdCollateralTransactorSession) SlashValidatorSD(_validatorI return _SdCollateral.Contract.SlashValidatorSD(&_SdCollateral.TransactOpts, _validatorId, _poolId) } +// TransferBackUtilizedSD is a paid mutator transaction binding the contract method 0xf4f27bbe. +// +// Solidity: function transferBackUtilizedSD(address _operator) returns() +func (_SdCollateral *SdCollateralTransactor) TransferBackUtilizedSD(opts *bind.TransactOpts, _operator common.Address) (*types.Transaction, error) { + return _SdCollateral.contract.Transact(opts, "transferBackUtilizedSD", _operator) +} + +// TransferBackUtilizedSD is a paid mutator transaction binding the contract method 0xf4f27bbe. +// +// Solidity: function transferBackUtilizedSD(address _operator) returns() +func (_SdCollateral *SdCollateralSession) TransferBackUtilizedSD(_operator common.Address) (*types.Transaction, error) { + return _SdCollateral.Contract.TransferBackUtilizedSD(&_SdCollateral.TransactOpts, _operator) +} + +// TransferBackUtilizedSD is a paid mutator transaction binding the contract method 0xf4f27bbe. +// +// Solidity: function transferBackUtilizedSD(address _operator) returns() +func (_SdCollateral *SdCollateralTransactorSession) TransferBackUtilizedSD(_operator common.Address) (*types.Transaction, error) { + return _SdCollateral.Contract.TransferBackUtilizedSD(&_SdCollateral.TransactOpts, _operator) +} + // UpdatePoolThreshold is a paid mutator transaction binding the contract method 0xe0412f0e. // // Solidity: function updatePoolThreshold(uint8 _poolId, uint256 _minThreshold, uint256 _maxThreshold, uint256 _withdrawThreshold, string _units) returns() @@ -992,6 +1013,27 @@ func (_SdCollateral *SdCollateralTransactorSession) Withdraw(_requestedSD *big.I return _SdCollateral.Contract.Withdraw(&_SdCollateral.TransactOpts, _requestedSD) } +// WithdrawOnBehalf is a paid mutator transaction binding the contract method 0x53e9bf1d. +// +// Solidity: function withdrawOnBehalf(uint256 _requestedSD, address _operator) returns() +func (_SdCollateral *SdCollateralTransactor) WithdrawOnBehalf(opts *bind.TransactOpts, _requestedSD *big.Int, _operator common.Address) (*types.Transaction, error) { + return _SdCollateral.contract.Transact(opts, "withdrawOnBehalf", _requestedSD, _operator) +} + +// WithdrawOnBehalf is a paid mutator transaction binding the contract method 0x53e9bf1d. +// +// Solidity: function withdrawOnBehalf(uint256 _requestedSD, address _operator) returns() +func (_SdCollateral *SdCollateralSession) WithdrawOnBehalf(_requestedSD *big.Int, _operator common.Address) (*types.Transaction, error) { + return _SdCollateral.Contract.WithdrawOnBehalf(&_SdCollateral.TransactOpts, _requestedSD, _operator) +} + +// WithdrawOnBehalf is a paid mutator transaction binding the contract method 0x53e9bf1d. +// +// Solidity: function withdrawOnBehalf(uint256 _requestedSD, address _operator) returns() +func (_SdCollateral *SdCollateralTransactorSession) WithdrawOnBehalf(_requestedSD *big.Int, _operator common.Address) (*types.Transaction, error) { + return _SdCollateral.Contract.WithdrawOnBehalf(&_SdCollateral.TransactOpts, _requestedSD, _operator) +} + // SdCollateralInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the SdCollateral contract. type SdCollateralInitializedIterator struct { Event *SdCollateralInitialized // Event containing the contract specifics and raw log @@ -2191,141 +2233,6 @@ func (_SdCollateral *SdCollateralFilterer) ParseSDSlashed(log types.Log) (*SdCol return event, nil } -// SdCollateralSDSlashedFromUtilizeIterator is returned from FilterSDSlashedFromUtilize and is used to iterate over the raw logs and unpacked data for SDSlashedFromUtilize events raised by the SdCollateral contract. -type SdCollateralSDSlashedFromUtilizeIterator struct { - Event *SdCollateralSDSlashedFromUtilize // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SdCollateralSDSlashedFromUtilizeIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SdCollateralSDSlashedFromUtilize) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SdCollateralSDSlashedFromUtilize) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SdCollateralSDSlashedFromUtilizeIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SdCollateralSDSlashedFromUtilizeIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SdCollateralSDSlashedFromUtilize represents a SDSlashedFromUtilize event raised by the SdCollateral contract. -type SdCollateralSDSlashedFromUtilize struct { - Operator common.Address - SdSlashFromUtilized *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterSDSlashedFromUtilize is a free log retrieval operation binding the contract event 0xe0674d9d9473524ba6cf67d596e4357df10898dc3feaf4edf2a7fb9ffdb41802. -// -// Solidity: event SDSlashedFromUtilize(address operator, uint256 sdSlashFromUtilized) -func (_SdCollateral *SdCollateralFilterer) FilterSDSlashedFromUtilize(opts *bind.FilterOpts) (*SdCollateralSDSlashedFromUtilizeIterator, error) { - - logs, sub, err := _SdCollateral.contract.FilterLogs(opts, "SDSlashedFromUtilize") - if err != nil { - return nil, err - } - return &SdCollateralSDSlashedFromUtilizeIterator{contract: _SdCollateral.contract, event: "SDSlashedFromUtilize", logs: logs, sub: sub}, nil -} - -// WatchSDSlashedFromUtilize is a free log subscription operation binding the contract event 0xe0674d9d9473524ba6cf67d596e4357df10898dc3feaf4edf2a7fb9ffdb41802. -// -// Solidity: event SDSlashedFromUtilize(address operator, uint256 sdSlashFromUtilized) -func (_SdCollateral *SdCollateralFilterer) WatchSDSlashedFromUtilize(opts *bind.WatchOpts, sink chan<- *SdCollateralSDSlashedFromUtilize) (event.Subscription, error) { - - logs, sub, err := _SdCollateral.contract.WatchLogs(opts, "SDSlashedFromUtilize") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SdCollateralSDSlashedFromUtilize) - if err := _SdCollateral.contract.UnpackLog(event, "SDSlashedFromUtilize", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseSDSlashedFromUtilize is a log parse operation binding the contract event 0xe0674d9d9473524ba6cf67d596e4357df10898dc3feaf4edf2a7fb9ffdb41802. -// -// Solidity: event SDSlashedFromUtilize(address operator, uint256 sdSlashFromUtilized) -func (_SdCollateral *SdCollateralFilterer) ParseSDSlashedFromUtilize(log types.Log) (*SdCollateralSDSlashedFromUtilize, error) { - event := new(SdCollateralSDSlashedFromUtilize) - if err := _SdCollateral.contract.UnpackLog(event, "SDSlashedFromUtilize", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - // SdCollateralSDWithdrawnIterator is returned from FilterSDWithdrawn and is used to iterate over the raw logs and unpacked data for SDWithdrawn events raised by the SdCollateral contract. type SdCollateralSDWithdrawnIterator struct { Event *SdCollateralSDWithdrawn // Event containing the contract specifics and raw log @@ -3030,3 +2937,138 @@ func (_SdCollateral *SdCollateralFilterer) ParseUtilizedSDDeposited(log types.Lo event.Raw = log return event, nil } + +// SdCollateralUtilizedSDSlashedIterator is returned from FilterUtilizedSDSlashed and is used to iterate over the raw logs and unpacked data for UtilizedSDSlashed events raised by the SdCollateral contract. +type SdCollateralUtilizedSDSlashedIterator struct { + Event *SdCollateralUtilizedSDSlashed // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SdCollateralUtilizedSDSlashedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SdCollateralUtilizedSDSlashed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SdCollateralUtilizedSDSlashed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SdCollateralUtilizedSDSlashedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SdCollateralUtilizedSDSlashedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SdCollateralUtilizedSDSlashed represents a UtilizedSDSlashed event raised by the SdCollateral contract. +type SdCollateralUtilizedSDSlashed struct { + Operator common.Address + SdSlashFromUtilized *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUtilizedSDSlashed is a free log retrieval operation binding the contract event 0x9433ba4f4ec373196c2daafa9177256a3da6b568048401763164b2d5a724fca1. +// +// Solidity: event UtilizedSDSlashed(address operator, uint256 sdSlashFromUtilized) +func (_SdCollateral *SdCollateralFilterer) FilterUtilizedSDSlashed(opts *bind.FilterOpts) (*SdCollateralUtilizedSDSlashedIterator, error) { + + logs, sub, err := _SdCollateral.contract.FilterLogs(opts, "UtilizedSDSlashed") + if err != nil { + return nil, err + } + return &SdCollateralUtilizedSDSlashedIterator{contract: _SdCollateral.contract, event: "UtilizedSDSlashed", logs: logs, sub: sub}, nil +} + +// WatchUtilizedSDSlashed is a free log subscription operation binding the contract event 0x9433ba4f4ec373196c2daafa9177256a3da6b568048401763164b2d5a724fca1. +// +// Solidity: event UtilizedSDSlashed(address operator, uint256 sdSlashFromUtilized) +func (_SdCollateral *SdCollateralFilterer) WatchUtilizedSDSlashed(opts *bind.WatchOpts, sink chan<- *SdCollateralUtilizedSDSlashed) (event.Subscription, error) { + + logs, sub, err := _SdCollateral.contract.WatchLogs(opts, "UtilizedSDSlashed") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SdCollateralUtilizedSDSlashed) + if err := _SdCollateral.contract.UnpackLog(event, "UtilizedSDSlashed", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUtilizedSDSlashed is a log parse operation binding the contract event 0x9433ba4f4ec373196c2daafa9177256a3da6b568048401763164b2d5a724fca1. +// +// Solidity: event UtilizedSDSlashed(address operator, uint256 sdSlashFromUtilized) +func (_SdCollateral *SdCollateralFilterer) ParseUtilizedSDSlashed(log types.Log) (*SdCollateralUtilizedSDSlashed, error) { + event := new(SdCollateralUtilizedSDSlashed) + if err := _SdCollateral.contract.UnpackLog(event, "UtilizedSDSlashed", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/stader-lib/contracts/sd-utility.go b/stader-lib/contracts/sd-utility.go index 3b0f387b4..09dfa06b2 100644 --- a/stader-lib/contracts/sd-utility.go +++ b/stader-lib/contracts/sd-utility.go @@ -49,7 +49,7 @@ type UserData struct { // SDUtilityPoolMetaData contains all meta data concerning the SDUtilityPool contract. var SDUtilityPoolMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"AlreadyClaimed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyLiquidated\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotAuthorizedToRedeem\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotFindRequestId\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientPoolBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAmountOfWithdraw\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInput\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidWithdrawAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxLimitOnWithdrawRequestCountReached\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotClaimable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotLiquidatable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotLiquidator\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"RequestIdNotFinalized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDUtilizeLimitReached\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnHealthyPosition\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAccumulated\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalProtocolFee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalUtilizedSD\",\"type\":\"uint256\"}],\"name\":\"AccruedFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"CompleteLiquidation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXToMint\",\"type\":\"uint256\"}],\"name\":\"Delegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestIdToFinalize\",\"type\":\"uint256\"}],\"name\":\"FinalizedWithdrawRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalLiquidationAmountInEth\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationBonusInEth\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationFeeInEth\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"name\":\"LiquidationCall\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"protocolFeeFactor\",\"type\":\"uint256\"}],\"name\":\"ProtocolFeeFactorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXAmount\",\"type\":\"uint256\"}],\"name\":\"Redeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"Repaid\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdToTransfer\",\"type\":\"uint256\"}],\"name\":\"RequestRedeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationThreshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationBonusPercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationFeePercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ltv\",\"type\":\"uint256\"}],\"name\":\"RiskConfigUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"SDUtilized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"conservativeEthPerKey\",\"type\":\"uint256\"}],\"name\":\"UpdatedConservativeEthPerKey\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"finalizationBatchLimit\",\"type\":\"uint256\"}],\"name\":\"UpdatedFinalizationBatchLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxETHWorthOfSDPerValidator\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxETHWorthOfSDPerValidator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxNonRedeemedDelegatorRequestCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minBlockDelayToFinalizeRequest\",\"type\":\"uint256\"}],\"name\":\"UpdatedMinBlockDelayToFinalizeRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizationRatePerBlock\",\"type\":\"uint256\"}],\"name\":\"UtilizationRatePerBlockUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmountToWithdraw\",\"type\":\"uint256\"}],\"name\":\"WithdrawRequestReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"WithdrawnProtocolFee\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"accrueFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accumulatedProtocolFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cTokenTotalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"completeLiquidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"delegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"delegatorCTokenBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"delegatorWithdrawRequestedCTokenCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"delegatorWithdrawRequests\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountOfCToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdExpected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdFinalized\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finalizeDelegatorWithdrawalRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDelegationRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_delegator\",\"type\":\"address\"}],\"name\":\"getDelegatorLatestSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLatestExchangeRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLiquidationThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"getOperatorLiquidation\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"totalAmountInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalBonusInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalFeeInEth\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isRepaid\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"isClaimed\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"internalType\":\"structOperatorLiquidation\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPoolAvailableSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"getRequestIdsByDelegator\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getUserData\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"totalInterestSD\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalCollateralInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"healthFactor\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lockedEth\",\"type\":\"uint256\"}],\"internalType\":\"structUserData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_utilizer\",\"type\":\"address\"}],\"name\":\"getUtilizerLatestBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"liquidationCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"liquidationIndexByOperator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxApproveSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxETHWorthOfSDPerValidator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"poolUtilization\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repay\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repayOnBehalf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"requestIdsByDelegatorAddress\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"cTokenAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdrawWithSDAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sdRequestedForWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalUtilizedSD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newEthPerKey\",\"type\":\"uint256\"}],\"name\":\"updateConservativeEthPerKey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_finalizationBatchLimit\",\"type\":\"uint256\"}],\"name\":\"updateFinalizationBatchLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxETHWorthOfSDPerValidator\",\"type\":\"uint256\"}],\"name\":\"updateMaxETHWorthOfSDPerValidator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"name\":\"updateMaxNonRedeemedDelegatorRequestCount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minBlockDelayToFinalizeRequest\",\"type\":\"uint256\"}],\"name\":\"updateMinBlockDelayToFinalizeRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_protocolFee\",\"type\":\"uint256\"}],\"name\":\"updateProtocolFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_utilizationRatePerBlock\",\"type\":\"uint256\"}],\"name\":\"updateUtilizationRatePerBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"utilizationRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"utilize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonTerminalKeyCount\",\"type\":\"uint256\"}],\"name\":\"utilizeWhileAddingKeys\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"utilizerData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"principal\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"utilizeIndex\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdrawProtocolFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AlreadyClaimed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyLiquidated\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotAuthorizedToRedeem\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotManager\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotStaderContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotFindRequestId\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientPoolBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAmountOfWithdraw\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInput\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidWithdrawAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxLimitOnWithdrawRequestCountReached\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotClaimable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotLiquidatable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotLiquidator\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OperatorUtilizedSDBalanceNonZero\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"RequestIdNotFinalized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SDUtilizeLimitReached\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnHealthyPosition\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAccumulated\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalProtocolFee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalUtilizedSD\",\"type\":\"uint256\"}],\"name\":\"AccruedFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdInterest\",\"type\":\"uint256\"}],\"name\":\"ClearedUtilizerInterest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"CompleteLiquidation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXToMint\",\"type\":\"uint256\"}],\"name\":\"Delegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestIdToFinalize\",\"type\":\"uint256\"}],\"name\":\"FinalizedWithdrawRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalLiquidationAmountInEth\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationBonusInEth\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationFeeInEth\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"name\":\"LiquidationCall\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"protocolFeeFactor\",\"type\":\"uint256\"}],\"name\":\"ProtocolFeeFactorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdXAmount\",\"type\":\"uint256\"}],\"name\":\"Redeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"Repaid\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizedSDAmount\",\"type\":\"uint256\"}],\"name\":\"RepaidUtilizedSDBalance\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdToTransfer\",\"type\":\"uint256\"}],\"name\":\"RequestRedeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationThreshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationBonusPercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"liquidationFeePercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ltv\",\"type\":\"uint256\"}],\"name\":\"RiskConfigUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"SDUtilized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"conservativeEthPerKey\",\"type\":\"uint256\"}],\"name\":\"UpdatedConservativeEthPerKey\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"finalizationBatchLimit\",\"type\":\"uint256\"}],\"name\":\"UpdatedFinalizationBatchLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxETHWorthOfSDPerValidator\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxETHWorthOfSDPerValidator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"}],\"name\":\"UpdatedMaxNonRedeemedDelegatorRequestCount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minBlockDelayToFinalizeRequest\",\"type\":\"uint256\"}],\"name\":\"UpdatedMinBlockDelayToFinalizeRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"utilizationRatePerBlock\",\"type\":\"uint256\"}],\"name\":\"UtilizationRatePerBlockUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nextRequestId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"sdAmountToWithdraw\",\"type\":\"uint256\"}],\"name\":\"WithdrawRequestReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"WithdrawnProtocolFee\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DECIMAL\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_PROTOCOL_FEE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_UTILIZATION_RATE_PER_BLOCK\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MIN_SD_DELEGATE_LIMIT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MIN_SD_WITHDRAW_LIMIT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accrualBlockNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accrueFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accumulatedProtocolFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cTokenTotalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_requestId\",\"type\":\"uint256\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_utilizer\",\"type\":\"address\"}],\"name\":\"clearUtilizerInterest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"completeLiquidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"conservativeEthPerKey\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"sdAmount\",\"type\":\"uint256\"}],\"name\":\"delegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"delegatorCTokenBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"delegatorWithdrawRequestedCTokenCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"delegatorWithdrawRequests\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountOfCToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdExpected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sdFinalized\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exchangeRateStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finalizationBatchLimit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finalizeDelegatorWithdrawalRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDelegationRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_delegator\",\"type\":\"address\"}],\"name\":\"getDelegatorLatestSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLatestExchangeRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLiquidationThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getOperatorLiquidation\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"totalAmountInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalBonusInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalFeeInEth\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isRepaid\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"isClaimed\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"internalType\":\"structOperatorLiquidation\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"getOperatorTotalEth\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPoolAvailableSDBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_delegator\",\"type\":\"address\"}],\"name\":\"getRequestIdsByDelegator\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getUserData\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"totalInterestSD\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalCollateralInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"healthFactor\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lockedEth\",\"type\":\"uint256\"}],\"internalType\":\"structUserData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_utilizer\",\"type\":\"address\"}],\"name\":\"getUtilizerLatestBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"liquidationCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"liquidationIndexByOperator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"liquidations\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"totalAmountInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalBonusInEth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalFeeInEth\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isRepaid\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"isClaimed\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxApproveSD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxETHWorthOfSDPerValidator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxNonRedeemedDelegatorRequestCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minBlockDelayToFinalizeRequest\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextRequestId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextRequestIdToFinalize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"poolUtilization\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"protocolFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repay\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"repaidAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feePaid\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"repayFullAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"repaidAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feePaid\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"utilizer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repayOnBehalf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"repaidAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feePaid\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_utilizer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"repayUtilizedSDBalance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"requestIdsByDelegatorAddress\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_cTokenAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_requestId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_sdAmount\",\"type\":\"uint256\"}],\"name\":\"requestWithdrawWithSDAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_requestId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"riskConfig\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"liquidationThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"liquidationBonusPercent\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"liquidationFeePercent\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"ltv\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sdRequestedForWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sdReservedForClaim\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"staderConfig\",\"outputs\":[{\"internalType\":\"contractIStaderConfig\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalUtilizedSD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newEthPerKey\",\"type\":\"uint256\"}],\"name\":\"updateConservativeEthPerKey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_finalizationBatchLimit\",\"type\":\"uint256\"}],\"name\":\"updateFinalizationBatchLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxETHWorthOfSDPerValidator\",\"type\":\"uint256\"}],\"name\":\"updateMaxETHWorthOfSDPerValidator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"name\":\"updateMaxNonRedeemedDelegatorRequestCount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minBlockDelayToFinalizeRequest\",\"type\":\"uint256\"}],\"name\":\"updateMinBlockDelayToFinalizeRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_protocolFee\",\"type\":\"uint256\"}],\"name\":\"updateProtocolFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"liquidationThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"liquidationBonusPercent\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"liquidationFeePercent\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"ltv\",\"type\":\"uint256\"}],\"name\":\"updateRiskConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_utilizationRatePerBlock\",\"type\":\"uint256\"}],\"name\":\"updateUtilizationRatePerBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"utilizationRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"}],\"name\":\"utilize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"utilizeIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"utilizeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonTerminalKeyCount\",\"type\":\"uint256\"}],\"name\":\"utilizeWhileAddingKeys\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"utilizerBalanceStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"utilizerData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"principal\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"utilizeIndex\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdrawProtocolFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // SDUtilityPoolABI is the input ABI used to generate the binding from. @@ -198,6 +198,223 @@ func (_SDUtilityPool *SDUtilityPoolTransactorRaw) Transact(opts *bind.TransactOp return _SDUtilityPool.Contract.contract.Transact(opts, method, params...) } +// DECIMAL is a free data retrieval call binding the contract method 0x6ab55fd9. +// +// Solidity: function DECIMAL() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) DECIMAL(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "DECIMAL") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// DECIMAL is a free data retrieval call binding the contract method 0x6ab55fd9. +// +// Solidity: function DECIMAL() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) DECIMAL() (*big.Int, error) { + return _SDUtilityPool.Contract.DECIMAL(&_SDUtilityPool.CallOpts) +} + +// DECIMAL is a free data retrieval call binding the contract method 0x6ab55fd9. +// +// Solidity: function DECIMAL() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) DECIMAL() (*big.Int, error) { + return _SDUtilityPool.Contract.DECIMAL(&_SDUtilityPool.CallOpts) +} + +// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. +// +// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) +func (_SDUtilityPool *SDUtilityPoolCaller) DEFAULTADMINROLE(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "DEFAULT_ADMIN_ROLE") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. +// +// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) +func (_SDUtilityPool *SDUtilityPoolSession) DEFAULTADMINROLE() ([32]byte, error) { + return _SDUtilityPool.Contract.DEFAULTADMINROLE(&_SDUtilityPool.CallOpts) +} + +// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. +// +// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) +func (_SDUtilityPool *SDUtilityPoolCallerSession) DEFAULTADMINROLE() ([32]byte, error) { + return _SDUtilityPool.Contract.DEFAULTADMINROLE(&_SDUtilityPool.CallOpts) +} + +// MAXPROTOCOLFEE is a free data retrieval call binding the contract method 0xb8ca3b83. +// +// Solidity: function MAX_PROTOCOL_FEE() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) MAXPROTOCOLFEE(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "MAX_PROTOCOL_FEE") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MAXPROTOCOLFEE is a free data retrieval call binding the contract method 0xb8ca3b83. +// +// Solidity: function MAX_PROTOCOL_FEE() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) MAXPROTOCOLFEE() (*big.Int, error) { + return _SDUtilityPool.Contract.MAXPROTOCOLFEE(&_SDUtilityPool.CallOpts) +} + +// MAXPROTOCOLFEE is a free data retrieval call binding the contract method 0xb8ca3b83. +// +// Solidity: function MAX_PROTOCOL_FEE() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) MAXPROTOCOLFEE() (*big.Int, error) { + return _SDUtilityPool.Contract.MAXPROTOCOLFEE(&_SDUtilityPool.CallOpts) +} + +// MAXUTILIZATIONRATEPERBLOCK is a free data retrieval call binding the contract method 0x4e7878ee. +// +// Solidity: function MAX_UTILIZATION_RATE_PER_BLOCK() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) MAXUTILIZATIONRATEPERBLOCK(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "MAX_UTILIZATION_RATE_PER_BLOCK") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MAXUTILIZATIONRATEPERBLOCK is a free data retrieval call binding the contract method 0x4e7878ee. +// +// Solidity: function MAX_UTILIZATION_RATE_PER_BLOCK() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) MAXUTILIZATIONRATEPERBLOCK() (*big.Int, error) { + return _SDUtilityPool.Contract.MAXUTILIZATIONRATEPERBLOCK(&_SDUtilityPool.CallOpts) +} + +// MAXUTILIZATIONRATEPERBLOCK is a free data retrieval call binding the contract method 0x4e7878ee. +// +// Solidity: function MAX_UTILIZATION_RATE_PER_BLOCK() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) MAXUTILIZATIONRATEPERBLOCK() (*big.Int, error) { + return _SDUtilityPool.Contract.MAXUTILIZATIONRATEPERBLOCK(&_SDUtilityPool.CallOpts) +} + +// MINSDDELEGATELIMIT is a free data retrieval call binding the contract method 0xb4c1273b. +// +// Solidity: function MIN_SD_DELEGATE_LIMIT() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) MINSDDELEGATELIMIT(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "MIN_SD_DELEGATE_LIMIT") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MINSDDELEGATELIMIT is a free data retrieval call binding the contract method 0xb4c1273b. +// +// Solidity: function MIN_SD_DELEGATE_LIMIT() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) MINSDDELEGATELIMIT() (*big.Int, error) { + return _SDUtilityPool.Contract.MINSDDELEGATELIMIT(&_SDUtilityPool.CallOpts) +} + +// MINSDDELEGATELIMIT is a free data retrieval call binding the contract method 0xb4c1273b. +// +// Solidity: function MIN_SD_DELEGATE_LIMIT() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) MINSDDELEGATELIMIT() (*big.Int, error) { + return _SDUtilityPool.Contract.MINSDDELEGATELIMIT(&_SDUtilityPool.CallOpts) +} + +// MINSDWITHDRAWLIMIT is a free data retrieval call binding the contract method 0x531810bc. +// +// Solidity: function MIN_SD_WITHDRAW_LIMIT() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) MINSDWITHDRAWLIMIT(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "MIN_SD_WITHDRAW_LIMIT") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MINSDWITHDRAWLIMIT is a free data retrieval call binding the contract method 0x531810bc. +// +// Solidity: function MIN_SD_WITHDRAW_LIMIT() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) MINSDWITHDRAWLIMIT() (*big.Int, error) { + return _SDUtilityPool.Contract.MINSDWITHDRAWLIMIT(&_SDUtilityPool.CallOpts) +} + +// MINSDWITHDRAWLIMIT is a free data retrieval call binding the contract method 0x531810bc. +// +// Solidity: function MIN_SD_WITHDRAW_LIMIT() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) MINSDWITHDRAWLIMIT() (*big.Int, error) { + return _SDUtilityPool.Contract.MINSDWITHDRAWLIMIT(&_SDUtilityPool.CallOpts) +} + +// AccrualBlockNumber is a free data retrieval call binding the contract method 0x6c540baf. +// +// Solidity: function accrualBlockNumber() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) AccrualBlockNumber(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "accrualBlockNumber") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// AccrualBlockNumber is a free data retrieval call binding the contract method 0x6c540baf. +// +// Solidity: function accrualBlockNumber() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) AccrualBlockNumber() (*big.Int, error) { + return _SDUtilityPool.Contract.AccrualBlockNumber(&_SDUtilityPool.CallOpts) +} + +// AccrualBlockNumber is a free data retrieval call binding the contract method 0x6c540baf. +// +// Solidity: function accrualBlockNumber() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) AccrualBlockNumber() (*big.Int, error) { + return _SDUtilityPool.Contract.AccrualBlockNumber(&_SDUtilityPool.CallOpts) +} + // AccumulatedProtocolFee is a free data retrieval call binding the contract method 0xa544a62c. // // Solidity: function accumulatedProtocolFee() view returns(uint256) @@ -260,6 +477,37 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) CTokenTotalSupply() (*big.Int, return _SDUtilityPool.Contract.CTokenTotalSupply(&_SDUtilityPool.CallOpts) } +// ConservativeEthPerKey is a free data retrieval call binding the contract method 0x232d70c3. +// +// Solidity: function conservativeEthPerKey() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) ConservativeEthPerKey(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "conservativeEthPerKey") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// ConservativeEthPerKey is a free data retrieval call binding the contract method 0x232d70c3. +// +// Solidity: function conservativeEthPerKey() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) ConservativeEthPerKey() (*big.Int, error) { + return _SDUtilityPool.Contract.ConservativeEthPerKey(&_SDUtilityPool.CallOpts) +} + +// ConservativeEthPerKey is a free data retrieval call binding the contract method 0x232d70c3. +// +// Solidity: function conservativeEthPerKey() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) ConservativeEthPerKey() (*big.Int, error) { + return _SDUtilityPool.Contract.ConservativeEthPerKey(&_SDUtilityPool.CallOpts) +} + // DelegatorCTokenBalance is a free data retrieval call binding the contract method 0xabf9db02. // // Solidity: function delegatorCTokenBalance(address ) view returns(uint256) @@ -413,6 +661,37 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) ExchangeRateStored() (*big.Int return _SDUtilityPool.Contract.ExchangeRateStored(&_SDUtilityPool.CallOpts) } +// FinalizationBatchLimit is a free data retrieval call binding the contract method 0x6f2bd0b2. +// +// Solidity: function finalizationBatchLimit() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) FinalizationBatchLimit(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "finalizationBatchLimit") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// FinalizationBatchLimit is a free data retrieval call binding the contract method 0x6f2bd0b2. +// +// Solidity: function finalizationBatchLimit() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) FinalizationBatchLimit() (*big.Int, error) { + return _SDUtilityPool.Contract.FinalizationBatchLimit(&_SDUtilityPool.CallOpts) +} + +// FinalizationBatchLimit is a free data retrieval call binding the contract method 0x6f2bd0b2. +// +// Solidity: function finalizationBatchLimit() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) FinalizationBatchLimit() (*big.Int, error) { + return _SDUtilityPool.Contract.FinalizationBatchLimit(&_SDUtilityPool.CallOpts) +} + // GetDelegationRatePerBlock is a free data retrieval call binding the contract method 0x6d00679c. // // Solidity: function getDelegationRatePerBlock() view returns(uint256) @@ -539,10 +818,10 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) GetLiquidationThreshold() (*bi // GetOperatorLiquidation is a free data retrieval call binding the contract method 0x12372ffe. // -// Solidity: function getOperatorLiquidation(address ) view returns((uint256,uint256,uint256,bool,bool,address)) -func (_SDUtilityPool *SDUtilityPoolCaller) GetOperatorLiquidation(opts *bind.CallOpts, arg0 common.Address) (OperatorLiquidation, error) { +// Solidity: function getOperatorLiquidation(address account) view returns((uint256,uint256,uint256,bool,bool,address)) +func (_SDUtilityPool *SDUtilityPoolCaller) GetOperatorLiquidation(opts *bind.CallOpts, account common.Address) (OperatorLiquidation, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "getOperatorLiquidation", arg0) + err := _SDUtilityPool.contract.Call(opts, &out, "getOperatorLiquidation", account) if err != nil { return *new(OperatorLiquidation), err @@ -556,16 +835,47 @@ func (_SDUtilityPool *SDUtilityPoolCaller) GetOperatorLiquidation(opts *bind.Cal // GetOperatorLiquidation is a free data retrieval call binding the contract method 0x12372ffe. // -// Solidity: function getOperatorLiquidation(address ) view returns((uint256,uint256,uint256,bool,bool,address)) -func (_SDUtilityPool *SDUtilityPoolSession) GetOperatorLiquidation(arg0 common.Address) (OperatorLiquidation, error) { - return _SDUtilityPool.Contract.GetOperatorLiquidation(&_SDUtilityPool.CallOpts, arg0) +// Solidity: function getOperatorLiquidation(address account) view returns((uint256,uint256,uint256,bool,bool,address)) +func (_SDUtilityPool *SDUtilityPoolSession) GetOperatorLiquidation(account common.Address) (OperatorLiquidation, error) { + return _SDUtilityPool.Contract.GetOperatorLiquidation(&_SDUtilityPool.CallOpts, account) } // GetOperatorLiquidation is a free data retrieval call binding the contract method 0x12372ffe. // -// Solidity: function getOperatorLiquidation(address ) view returns((uint256,uint256,uint256,bool,bool,address)) -func (_SDUtilityPool *SDUtilityPoolCallerSession) GetOperatorLiquidation(arg0 common.Address) (OperatorLiquidation, error) { - return _SDUtilityPool.Contract.GetOperatorLiquidation(&_SDUtilityPool.CallOpts, arg0) +// Solidity: function getOperatorLiquidation(address account) view returns((uint256,uint256,uint256,bool,bool,address)) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetOperatorLiquidation(account common.Address) (OperatorLiquidation, error) { + return _SDUtilityPool.Contract.GetOperatorLiquidation(&_SDUtilityPool.CallOpts, account) +} + +// GetOperatorTotalEth is a free data retrieval call binding the contract method 0x2170c14c. +// +// Solidity: function getOperatorTotalEth(address operator) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) GetOperatorTotalEth(opts *bind.CallOpts, operator common.Address) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "getOperatorTotalEth", operator) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetOperatorTotalEth is a free data retrieval call binding the contract method 0x2170c14c. +// +// Solidity: function getOperatorTotalEth(address operator) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) GetOperatorTotalEth(operator common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.GetOperatorTotalEth(&_SDUtilityPool.CallOpts, operator) +} + +// GetOperatorTotalEth is a free data retrieval call binding the contract method 0x2170c14c. +// +// Solidity: function getOperatorTotalEth(address operator) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetOperatorTotalEth(operator common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.GetOperatorTotalEth(&_SDUtilityPool.CallOpts, operator) } // GetPoolAvailableSDBalance is a free data retrieval call binding the contract method 0xda695857. @@ -601,10 +911,10 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) GetPoolAvailableSDBalance() (* // GetRequestIdsByDelegator is a free data retrieval call binding the contract method 0x99775f40. // -// Solidity: function getRequestIdsByDelegator(address _owner) view returns(uint256[]) -func (_SDUtilityPool *SDUtilityPoolCaller) GetRequestIdsByDelegator(opts *bind.CallOpts, _owner common.Address) ([]*big.Int, error) { +// Solidity: function getRequestIdsByDelegator(address _delegator) view returns(uint256[]) +func (_SDUtilityPool *SDUtilityPoolCaller) GetRequestIdsByDelegator(opts *bind.CallOpts, _delegator common.Address) ([]*big.Int, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "getRequestIdsByDelegator", _owner) + err := _SDUtilityPool.contract.Call(opts, &out, "getRequestIdsByDelegator", _delegator) if err != nil { return *new([]*big.Int), err @@ -618,16 +928,47 @@ func (_SDUtilityPool *SDUtilityPoolCaller) GetRequestIdsByDelegator(opts *bind.C // GetRequestIdsByDelegator is a free data retrieval call binding the contract method 0x99775f40. // -// Solidity: function getRequestIdsByDelegator(address _owner) view returns(uint256[]) -func (_SDUtilityPool *SDUtilityPoolSession) GetRequestIdsByDelegator(_owner common.Address) ([]*big.Int, error) { - return _SDUtilityPool.Contract.GetRequestIdsByDelegator(&_SDUtilityPool.CallOpts, _owner) +// Solidity: function getRequestIdsByDelegator(address _delegator) view returns(uint256[]) +func (_SDUtilityPool *SDUtilityPoolSession) GetRequestIdsByDelegator(_delegator common.Address) ([]*big.Int, error) { + return _SDUtilityPool.Contract.GetRequestIdsByDelegator(&_SDUtilityPool.CallOpts, _delegator) } // GetRequestIdsByDelegator is a free data retrieval call binding the contract method 0x99775f40. // -// Solidity: function getRequestIdsByDelegator(address _owner) view returns(uint256[]) -func (_SDUtilityPool *SDUtilityPoolCallerSession) GetRequestIdsByDelegator(_owner common.Address) ([]*big.Int, error) { - return _SDUtilityPool.Contract.GetRequestIdsByDelegator(&_SDUtilityPool.CallOpts, _owner) +// Solidity: function getRequestIdsByDelegator(address _delegator) view returns(uint256[]) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetRequestIdsByDelegator(_delegator common.Address) ([]*big.Int, error) { + return _SDUtilityPool.Contract.GetRequestIdsByDelegator(&_SDUtilityPool.CallOpts, _delegator) +} + +// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. +// +// Solidity: function getRoleAdmin(bytes32 role) view returns(bytes32) +func (_SDUtilityPool *SDUtilityPoolCaller) GetRoleAdmin(opts *bind.CallOpts, role [32]byte) ([32]byte, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "getRoleAdmin", role) + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. +// +// Solidity: function getRoleAdmin(bytes32 role) view returns(bytes32) +func (_SDUtilityPool *SDUtilityPoolSession) GetRoleAdmin(role [32]byte) ([32]byte, error) { + return _SDUtilityPool.Contract.GetRoleAdmin(&_SDUtilityPool.CallOpts, role) +} + +// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. +// +// Solidity: function getRoleAdmin(bytes32 role) view returns(bytes32) +func (_SDUtilityPool *SDUtilityPoolCallerSession) GetRoleAdmin(role [32]byte) ([32]byte, error) { + return _SDUtilityPool.Contract.GetRoleAdmin(&_SDUtilityPool.CallOpts, role) } // GetUserData is a free data retrieval call binding the contract method 0xffc9896b. @@ -692,6 +1033,37 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) GetUtilizerLatestBalance(_util return _SDUtilityPool.Contract.GetUtilizerLatestBalance(&_SDUtilityPool.CallOpts, _utilizer) } +// HasRole is a free data retrieval call binding the contract method 0x91d14854. +// +// Solidity: function hasRole(bytes32 role, address account) view returns(bool) +func (_SDUtilityPool *SDUtilityPoolCaller) HasRole(opts *bind.CallOpts, role [32]byte, account common.Address) (bool, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "hasRole", role, account) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// HasRole is a free data retrieval call binding the contract method 0x91d14854. +// +// Solidity: function hasRole(bytes32 role, address account) view returns(bool) +func (_SDUtilityPool *SDUtilityPoolSession) HasRole(role [32]byte, account common.Address) (bool, error) { + return _SDUtilityPool.Contract.HasRole(&_SDUtilityPool.CallOpts, role, account) +} + +// HasRole is a free data retrieval call binding the contract method 0x91d14854. +// +// Solidity: function hasRole(bytes32 role, address account) view returns(bool) +func (_SDUtilityPool *SDUtilityPoolCallerSession) HasRole(role [32]byte, account common.Address) (bool, error) { + return _SDUtilityPool.Contract.HasRole(&_SDUtilityPool.CallOpts, role, account) +} + // LiquidationIndexByOperator is a free data retrieval call binding the contract method 0x673ab3fa. // // Solidity: function liquidationIndexByOperator(address ) view returns(uint256) @@ -723,36 +1095,256 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) LiquidationIndexByOperator(arg return _SDUtilityPool.Contract.LiquidationIndexByOperator(&_SDUtilityPool.CallOpts, arg0) } -// MaxETHWorthOfSDPerValidator is a free data retrieval call binding the contract method 0x2807c313. +// Liquidations is a free data retrieval call binding the contract method 0xa66c84f4. // -// Solidity: function maxETHWorthOfSDPerValidator() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) MaxETHWorthOfSDPerValidator(opts *bind.CallOpts) (*big.Int, error) { +// Solidity: function liquidations(uint256 ) view returns(uint256 totalAmountInEth, uint256 totalBonusInEth, uint256 totalFeeInEth, bool isRepaid, bool isClaimed, address liquidator) +func (_SDUtilityPool *SDUtilityPoolCaller) Liquidations(opts *bind.CallOpts, arg0 *big.Int) (struct { + TotalAmountInEth *big.Int + TotalBonusInEth *big.Int + TotalFeeInEth *big.Int + IsRepaid bool + IsClaimed bool + Liquidator common.Address +}, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "maxETHWorthOfSDPerValidator") + err := _SDUtilityPool.contract.Call(opts, &out, "liquidations", arg0) + outstruct := new(struct { + TotalAmountInEth *big.Int + TotalBonusInEth *big.Int + TotalFeeInEth *big.Int + IsRepaid bool + IsClaimed bool + Liquidator common.Address + }) if err != nil { - return *new(*big.Int), err + return *outstruct, err } - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.TotalAmountInEth = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.TotalBonusInEth = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.TotalFeeInEth = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + outstruct.IsRepaid = *abi.ConvertType(out[3], new(bool)).(*bool) + outstruct.IsClaimed = *abi.ConvertType(out[4], new(bool)).(*bool) + outstruct.Liquidator = *abi.ConvertType(out[5], new(common.Address)).(*common.Address) - return out0, err + return *outstruct, err } -// MaxETHWorthOfSDPerValidator is a free data retrieval call binding the contract method 0x2807c313. +// Liquidations is a free data retrieval call binding the contract method 0xa66c84f4. // -// Solidity: function maxETHWorthOfSDPerValidator() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) MaxETHWorthOfSDPerValidator() (*big.Int, error) { - return _SDUtilityPool.Contract.MaxETHWorthOfSDPerValidator(&_SDUtilityPool.CallOpts) +// Solidity: function liquidations(uint256 ) view returns(uint256 totalAmountInEth, uint256 totalBonusInEth, uint256 totalFeeInEth, bool isRepaid, bool isClaimed, address liquidator) +func (_SDUtilityPool *SDUtilityPoolSession) Liquidations(arg0 *big.Int) (struct { + TotalAmountInEth *big.Int + TotalBonusInEth *big.Int + TotalFeeInEth *big.Int + IsRepaid bool + IsClaimed bool + Liquidator common.Address +}, error) { + return _SDUtilityPool.Contract.Liquidations(&_SDUtilityPool.CallOpts, arg0) } -// MaxETHWorthOfSDPerValidator is a free data retrieval call binding the contract method 0x2807c313. +// Liquidations is a free data retrieval call binding the contract method 0xa66c84f4. // -// Solidity: function maxETHWorthOfSDPerValidator() view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) MaxETHWorthOfSDPerValidator() (*big.Int, error) { - return _SDUtilityPool.Contract.MaxETHWorthOfSDPerValidator(&_SDUtilityPool.CallOpts) -} +// Solidity: function liquidations(uint256 ) view returns(uint256 totalAmountInEth, uint256 totalBonusInEth, uint256 totalFeeInEth, bool isRepaid, bool isClaimed, address liquidator) +func (_SDUtilityPool *SDUtilityPoolCallerSession) Liquidations(arg0 *big.Int) (struct { + TotalAmountInEth *big.Int + TotalBonusInEth *big.Int + TotalFeeInEth *big.Int + IsRepaid bool + IsClaimed bool + Liquidator common.Address +}, error) { + return _SDUtilityPool.Contract.Liquidations(&_SDUtilityPool.CallOpts, arg0) +} + +// MaxETHWorthOfSDPerValidator is a free data retrieval call binding the contract method 0x2807c313. +// +// Solidity: function maxETHWorthOfSDPerValidator() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) MaxETHWorthOfSDPerValidator(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "maxETHWorthOfSDPerValidator") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MaxETHWorthOfSDPerValidator is a free data retrieval call binding the contract method 0x2807c313. +// +// Solidity: function maxETHWorthOfSDPerValidator() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) MaxETHWorthOfSDPerValidator() (*big.Int, error) { + return _SDUtilityPool.Contract.MaxETHWorthOfSDPerValidator(&_SDUtilityPool.CallOpts) +} + +// MaxETHWorthOfSDPerValidator is a free data retrieval call binding the contract method 0x2807c313. +// +// Solidity: function maxETHWorthOfSDPerValidator() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) MaxETHWorthOfSDPerValidator() (*big.Int, error) { + return _SDUtilityPool.Contract.MaxETHWorthOfSDPerValidator(&_SDUtilityPool.CallOpts) +} + +// MaxNonRedeemedDelegatorRequestCount is a free data retrieval call binding the contract method 0xc083f3e6. +// +// Solidity: function maxNonRedeemedDelegatorRequestCount() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) MaxNonRedeemedDelegatorRequestCount(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "maxNonRedeemedDelegatorRequestCount") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MaxNonRedeemedDelegatorRequestCount is a free data retrieval call binding the contract method 0xc083f3e6. +// +// Solidity: function maxNonRedeemedDelegatorRequestCount() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) MaxNonRedeemedDelegatorRequestCount() (*big.Int, error) { + return _SDUtilityPool.Contract.MaxNonRedeemedDelegatorRequestCount(&_SDUtilityPool.CallOpts) +} + +// MaxNonRedeemedDelegatorRequestCount is a free data retrieval call binding the contract method 0xc083f3e6. +// +// Solidity: function maxNonRedeemedDelegatorRequestCount() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) MaxNonRedeemedDelegatorRequestCount() (*big.Int, error) { + return _SDUtilityPool.Contract.MaxNonRedeemedDelegatorRequestCount(&_SDUtilityPool.CallOpts) +} + +// MinBlockDelayToFinalizeRequest is a free data retrieval call binding the contract method 0xbc1428f6. +// +// Solidity: function minBlockDelayToFinalizeRequest() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) MinBlockDelayToFinalizeRequest(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "minBlockDelayToFinalizeRequest") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MinBlockDelayToFinalizeRequest is a free data retrieval call binding the contract method 0xbc1428f6. +// +// Solidity: function minBlockDelayToFinalizeRequest() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) MinBlockDelayToFinalizeRequest() (*big.Int, error) { + return _SDUtilityPool.Contract.MinBlockDelayToFinalizeRequest(&_SDUtilityPool.CallOpts) +} + +// MinBlockDelayToFinalizeRequest is a free data retrieval call binding the contract method 0xbc1428f6. +// +// Solidity: function minBlockDelayToFinalizeRequest() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) MinBlockDelayToFinalizeRequest() (*big.Int, error) { + return _SDUtilityPool.Contract.MinBlockDelayToFinalizeRequest(&_SDUtilityPool.CallOpts) +} + +// NextRequestId is a free data retrieval call binding the contract method 0x6a84a985. +// +// Solidity: function nextRequestId() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) NextRequestId(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "nextRequestId") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// NextRequestId is a free data retrieval call binding the contract method 0x6a84a985. +// +// Solidity: function nextRequestId() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) NextRequestId() (*big.Int, error) { + return _SDUtilityPool.Contract.NextRequestId(&_SDUtilityPool.CallOpts) +} + +// NextRequestId is a free data retrieval call binding the contract method 0x6a84a985. +// +// Solidity: function nextRequestId() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) NextRequestId() (*big.Int, error) { + return _SDUtilityPool.Contract.NextRequestId(&_SDUtilityPool.CallOpts) +} + +// NextRequestIdToFinalize is a free data retrieval call binding the contract method 0xbbb84362. +// +// Solidity: function nextRequestIdToFinalize() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) NextRequestIdToFinalize(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "nextRequestIdToFinalize") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// NextRequestIdToFinalize is a free data retrieval call binding the contract method 0xbbb84362. +// +// Solidity: function nextRequestIdToFinalize() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) NextRequestIdToFinalize() (*big.Int, error) { + return _SDUtilityPool.Contract.NextRequestIdToFinalize(&_SDUtilityPool.CallOpts) +} + +// NextRequestIdToFinalize is a free data retrieval call binding the contract method 0xbbb84362. +// +// Solidity: function nextRequestIdToFinalize() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) NextRequestIdToFinalize() (*big.Int, error) { + return _SDUtilityPool.Contract.NextRequestIdToFinalize(&_SDUtilityPool.CallOpts) +} + +// Paused is a free data retrieval call binding the contract method 0x5c975abb. +// +// Solidity: function paused() view returns(bool) +func (_SDUtilityPool *SDUtilityPoolCaller) Paused(opts *bind.CallOpts) (bool, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "paused") + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// Paused is a free data retrieval call binding the contract method 0x5c975abb. +// +// Solidity: function paused() view returns(bool) +func (_SDUtilityPool *SDUtilityPoolSession) Paused() (bool, error) { + return _SDUtilityPool.Contract.Paused(&_SDUtilityPool.CallOpts) +} + +// Paused is a free data retrieval call binding the contract method 0x5c975abb. +// +// Solidity: function paused() view returns(bool) +func (_SDUtilityPool *SDUtilityPoolCallerSession) Paused() (bool, error) { + return _SDUtilityPool.Contract.Paused(&_SDUtilityPool.CallOpts) +} // PoolUtilization is a free data retrieval call binding the contract method 0x9a3263ee. // @@ -785,6 +1377,37 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) PoolUtilization() (*big.Int, e return _SDUtilityPool.Contract.PoolUtilization(&_SDUtilityPool.CallOpts) } +// ProtocolFee is a free data retrieval call binding the contract method 0xb0e21e8a. +// +// Solidity: function protocolFee() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) ProtocolFee(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "protocolFee") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// ProtocolFee is a free data retrieval call binding the contract method 0xb0e21e8a. +// +// Solidity: function protocolFee() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) ProtocolFee() (*big.Int, error) { + return _SDUtilityPool.Contract.ProtocolFee(&_SDUtilityPool.CallOpts) +} + +// ProtocolFee is a free data retrieval call binding the contract method 0xb0e21e8a. +// +// Solidity: function protocolFee() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) ProtocolFee() (*big.Int, error) { + return _SDUtilityPool.Contract.ProtocolFee(&_SDUtilityPool.CallOpts) +} + // RequestIdsByDelegatorAddress is a free data retrieval call binding the contract method 0x7844e3af. // // Solidity: function requestIdsByDelegatorAddress(address , uint256 ) view returns(uint256) @@ -816,6 +1439,61 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) RequestIdsByDelegatorAddress(a return _SDUtilityPool.Contract.RequestIdsByDelegatorAddress(&_SDUtilityPool.CallOpts, arg0, arg1) } +// RiskConfig is a free data retrieval call binding the contract method 0x7c90a6ca. +// +// Solidity: function riskConfig() view returns(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) +func (_SDUtilityPool *SDUtilityPoolCaller) RiskConfig(opts *bind.CallOpts) (struct { + LiquidationThreshold *big.Int + LiquidationBonusPercent *big.Int + LiquidationFeePercent *big.Int + Ltv *big.Int +}, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "riskConfig") + + outstruct := new(struct { + LiquidationThreshold *big.Int + LiquidationBonusPercent *big.Int + LiquidationFeePercent *big.Int + Ltv *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.LiquidationThreshold = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.LiquidationBonusPercent = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.LiquidationFeePercent = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + outstruct.Ltv = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) + + return *outstruct, err + +} + +// RiskConfig is a free data retrieval call binding the contract method 0x7c90a6ca. +// +// Solidity: function riskConfig() view returns(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) +func (_SDUtilityPool *SDUtilityPoolSession) RiskConfig() (struct { + LiquidationThreshold *big.Int + LiquidationBonusPercent *big.Int + LiquidationFeePercent *big.Int + Ltv *big.Int +}, error) { + return _SDUtilityPool.Contract.RiskConfig(&_SDUtilityPool.CallOpts) +} + +// RiskConfig is a free data retrieval call binding the contract method 0x7c90a6ca. +// +// Solidity: function riskConfig() view returns(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) +func (_SDUtilityPool *SDUtilityPoolCallerSession) RiskConfig() (struct { + LiquidationThreshold *big.Int + LiquidationBonusPercent *big.Int + LiquidationFeePercent *big.Int + Ltv *big.Int +}, error) { + return _SDUtilityPool.Contract.RiskConfig(&_SDUtilityPool.CallOpts) +} + // SdRequestedForWithdraw is a free data retrieval call binding the contract method 0x3b92e3cf. // // Solidity: function sdRequestedForWithdraw() view returns(uint256) @@ -847,6 +1525,99 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) SdRequestedForWithdraw() (*big return _SDUtilityPool.Contract.SdRequestedForWithdraw(&_SDUtilityPool.CallOpts) } +// SdReservedForClaim is a free data retrieval call binding the contract method 0x2b886941. +// +// Solidity: function sdReservedForClaim() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) SdReservedForClaim(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "sdReservedForClaim") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// SdReservedForClaim is a free data retrieval call binding the contract method 0x2b886941. +// +// Solidity: function sdReservedForClaim() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) SdReservedForClaim() (*big.Int, error) { + return _SDUtilityPool.Contract.SdReservedForClaim(&_SDUtilityPool.CallOpts) +} + +// SdReservedForClaim is a free data retrieval call binding the contract method 0x2b886941. +// +// Solidity: function sdReservedForClaim() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) SdReservedForClaim() (*big.Int, error) { + return _SDUtilityPool.Contract.SdReservedForClaim(&_SDUtilityPool.CallOpts) +} + +// StaderConfig is a free data retrieval call binding the contract method 0x490ffa35. +// +// Solidity: function staderConfig() view returns(address) +func (_SDUtilityPool *SDUtilityPoolCaller) StaderConfig(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "staderConfig") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// StaderConfig is a free data retrieval call binding the contract method 0x490ffa35. +// +// Solidity: function staderConfig() view returns(address) +func (_SDUtilityPool *SDUtilityPoolSession) StaderConfig() (common.Address, error) { + return _SDUtilityPool.Contract.StaderConfig(&_SDUtilityPool.CallOpts) +} + +// StaderConfig is a free data retrieval call binding the contract method 0x490ffa35. +// +// Solidity: function staderConfig() view returns(address) +func (_SDUtilityPool *SDUtilityPoolCallerSession) StaderConfig() (common.Address, error) { + return _SDUtilityPool.Contract.StaderConfig(&_SDUtilityPool.CallOpts) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_SDUtilityPool *SDUtilityPoolCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "supportsInterface", interfaceId) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_SDUtilityPool *SDUtilityPoolSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _SDUtilityPool.Contract.SupportsInterface(&_SDUtilityPool.CallOpts, interfaceId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_SDUtilityPool *SDUtilityPoolCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _SDUtilityPool.Contract.SupportsInterface(&_SDUtilityPool.CallOpts, interfaceId) +} + // TotalUtilizedSD is a free data retrieval call binding the contract method 0x8763a328. // // Solidity: function totalUtilizedSD() view returns(uint256) @@ -909,12 +1680,12 @@ func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizationRatePerBlock() (*bi return _SDUtilityPool.Contract.UtilizationRatePerBlock(&_SDUtilityPool.CallOpts) } -// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. +// UtilizeIndex is a free data retrieval call binding the contract method 0x634c48c7. // -// Solidity: function utilizerBalanceStored(address account) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCaller) UtilizerBalanceStored(opts *bind.CallOpts, account common.Address) (*big.Int, error) { +// Solidity: function utilizeIndex() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) UtilizeIndex(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _SDUtilityPool.contract.Call(opts, &out, "utilizerBalanceStored", account) + err := _SDUtilityPool.contract.Call(opts, &out, "utilizeIndex") if err != nil { return *new(*big.Int), err @@ -926,25 +1697,56 @@ func (_SDUtilityPool *SDUtilityPoolCaller) UtilizerBalanceStored(opts *bind.Call } -// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. +// UtilizeIndex is a free data retrieval call binding the contract method 0x634c48c7. // -// Solidity: function utilizerBalanceStored(address account) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) UtilizerBalanceStored(account common.Address) (*big.Int, error) { - return _SDUtilityPool.Contract.UtilizerBalanceStored(&_SDUtilityPool.CallOpts, account) +// Solidity: function utilizeIndex() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) UtilizeIndex() (*big.Int, error) { + return _SDUtilityPool.Contract.UtilizeIndex(&_SDUtilityPool.CallOpts) } -// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. +// UtilizeIndex is a free data retrieval call binding the contract method 0x634c48c7. // -// Solidity: function utilizerBalanceStored(address account) view returns(uint256) -func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizerBalanceStored(account common.Address) (*big.Int, error) { - return _SDUtilityPool.Contract.UtilizerBalanceStored(&_SDUtilityPool.CallOpts, account) +// Solidity: function utilizeIndex() view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizeIndex() (*big.Int, error) { + return _SDUtilityPool.Contract.UtilizeIndex(&_SDUtilityPool.CallOpts) } -// UtilizerData is a free data retrieval call binding the contract method 0x9e070088. +// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. // -// Solidity: function utilizerData(address ) view returns(uint256 principal, uint256 utilizeIndex) -func (_SDUtilityPool *SDUtilityPoolCaller) UtilizerData(opts *bind.CallOpts, arg0 common.Address) (struct { - Principal *big.Int +// Solidity: function utilizerBalanceStored(address account) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCaller) UtilizerBalanceStored(opts *bind.CallOpts, account common.Address) (*big.Int, error) { + var out []interface{} + err := _SDUtilityPool.contract.Call(opts, &out, "utilizerBalanceStored", account) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. +// +// Solidity: function utilizerBalanceStored(address account) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) UtilizerBalanceStored(account common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.UtilizerBalanceStored(&_SDUtilityPool.CallOpts, account) +} + +// UtilizerBalanceStored is a free data retrieval call binding the contract method 0x6e236aee. +// +// Solidity: function utilizerBalanceStored(address account) view returns(uint256) +func (_SDUtilityPool *SDUtilityPoolCallerSession) UtilizerBalanceStored(account common.Address) (*big.Int, error) { + return _SDUtilityPool.Contract.UtilizerBalanceStored(&_SDUtilityPool.CallOpts, account) +} + +// UtilizerData is a free data retrieval call binding the contract method 0x9e070088. +// +// Solidity: function utilizerData(address ) view returns(uint256 principal, uint256 utilizeIndex) +func (_SDUtilityPool *SDUtilityPoolCaller) UtilizerData(opts *bind.CallOpts, arg0 common.Address) (struct { + Principal *big.Int UtilizeIndex *big.Int }, error) { var out []interface{} @@ -1008,23 +1810,44 @@ func (_SDUtilityPool *SDUtilityPoolTransactorSession) AccrueFee() (*types.Transa // Claim is a paid mutator transaction binding the contract method 0x379607f5. // -// Solidity: function claim(uint256 requestId) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) Claim(opts *bind.TransactOpts, requestId *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "claim", requestId) +// Solidity: function claim(uint256 _requestId) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) Claim(opts *bind.TransactOpts, _requestId *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "claim", _requestId) } // Claim is a paid mutator transaction binding the contract method 0x379607f5. // -// Solidity: function claim(uint256 requestId) returns() -func (_SDUtilityPool *SDUtilityPoolSession) Claim(requestId *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Claim(&_SDUtilityPool.TransactOpts, requestId) +// Solidity: function claim(uint256 _requestId) returns() +func (_SDUtilityPool *SDUtilityPoolSession) Claim(_requestId *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Claim(&_SDUtilityPool.TransactOpts, _requestId) } // Claim is a paid mutator transaction binding the contract method 0x379607f5. // -// Solidity: function claim(uint256 requestId) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) Claim(requestId *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Claim(&_SDUtilityPool.TransactOpts, requestId) +// Solidity: function claim(uint256 _requestId) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Claim(_requestId *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Claim(&_SDUtilityPool.TransactOpts, _requestId) +} + +// ClearUtilizerInterest is a paid mutator transaction binding the contract method 0x606f0945. +// +// Solidity: function clearUtilizerInterest(address _utilizer) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) ClearUtilizerInterest(opts *bind.TransactOpts, _utilizer common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "clearUtilizerInterest", _utilizer) +} + +// ClearUtilizerInterest is a paid mutator transaction binding the contract method 0x606f0945. +// +// Solidity: function clearUtilizerInterest(address _utilizer) returns() +func (_SDUtilityPool *SDUtilityPoolSession) ClearUtilizerInterest(_utilizer common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.ClearUtilizerInterest(&_SDUtilityPool.TransactOpts, _utilizer) +} + +// ClearUtilizerInterest is a paid mutator transaction binding the contract method 0x606f0945. +// +// Solidity: function clearUtilizerInterest(address _utilizer) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) ClearUtilizerInterest(_utilizer common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.ClearUtilizerInterest(&_SDUtilityPool.TransactOpts, _utilizer) } // CompleteLiquidation is a paid mutator transaction binding the contract method 0xd844cb6c. @@ -1111,6 +1934,48 @@ func (_SDUtilityPool *SDUtilityPoolTransactorSession) FinalizeDelegatorWithdrawa return _SDUtilityPool.Contract.FinalizeDelegatorWithdrawalRequest(&_SDUtilityPool.TransactOpts) } +// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. +// +// Solidity: function grantRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) GrantRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "grantRole", role, account) +} + +// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. +// +// Solidity: function grantRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolSession) GrantRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.GrantRole(&_SDUtilityPool.TransactOpts, role, account) +} + +// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. +// +// Solidity: function grantRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) GrantRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.GrantRole(&_SDUtilityPool.TransactOpts, role, account) +} + +// Initialize is a paid mutator transaction binding the contract method 0x485cc955. +// +// Solidity: function initialize(address _admin, address _staderConfig) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) Initialize(opts *bind.TransactOpts, _admin common.Address, _staderConfig common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "initialize", _admin, _staderConfig) +} + +// Initialize is a paid mutator transaction binding the contract method 0x485cc955. +// +// Solidity: function initialize(address _admin, address _staderConfig) returns() +func (_SDUtilityPool *SDUtilityPoolSession) Initialize(_admin common.Address, _staderConfig common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Initialize(&_SDUtilityPool.TransactOpts, _admin, _staderConfig) +} + +// Initialize is a paid mutator transaction binding the contract method 0x485cc955. +// +// Solidity: function initialize(address _admin, address _staderConfig) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Initialize(_admin common.Address, _staderConfig common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Initialize(&_SDUtilityPool.TransactOpts, _admin, _staderConfig) +} + // LiquidationCall is a paid mutator transaction binding the contract method 0xd2ac4a3d. // // Solidity: function liquidationCall(address account) returns() @@ -1153,88 +2018,214 @@ func (_SDUtilityPool *SDUtilityPoolTransactorSession) MaxApproveSD() (*types.Tra return _SDUtilityPool.Contract.MaxApproveSD(&_SDUtilityPool.TransactOpts) } +// Pause is a paid mutator transaction binding the contract method 0x8456cb59. +// +// Solidity: function pause() returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "pause") +} + +// Pause is a paid mutator transaction binding the contract method 0x8456cb59. +// +// Solidity: function pause() returns() +func (_SDUtilityPool *SDUtilityPoolSession) Pause() (*types.Transaction, error) { + return _SDUtilityPool.Contract.Pause(&_SDUtilityPool.TransactOpts) +} + +// Pause is a paid mutator transaction binding the contract method 0x8456cb59. +// +// Solidity: function pause() returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Pause() (*types.Transaction, error) { + return _SDUtilityPool.Contract.Pause(&_SDUtilityPool.TransactOpts) +} + +// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. +// +// Solidity: function renounceRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) RenounceRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "renounceRole", role, account) +} + +// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. +// +// Solidity: function renounceRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolSession) RenounceRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RenounceRole(&_SDUtilityPool.TransactOpts, role, account) +} + +// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. +// +// Solidity: function renounceRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) RenounceRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RenounceRole(&_SDUtilityPool.TransactOpts, role, account) +} + // Repay is a paid mutator transaction binding the contract method 0x371fd8e6. // -// Solidity: function repay(uint256 repayAmount) returns(uint256, uint256) +// Solidity: function repay(uint256 repayAmount) returns(uint256 repaidAmount, uint256 feePaid) func (_SDUtilityPool *SDUtilityPoolTransactor) Repay(opts *bind.TransactOpts, repayAmount *big.Int) (*types.Transaction, error) { return _SDUtilityPool.contract.Transact(opts, "repay", repayAmount) } // Repay is a paid mutator transaction binding the contract method 0x371fd8e6. // -// Solidity: function repay(uint256 repayAmount) returns(uint256, uint256) +// Solidity: function repay(uint256 repayAmount) returns(uint256 repaidAmount, uint256 feePaid) func (_SDUtilityPool *SDUtilityPoolSession) Repay(repayAmount *big.Int) (*types.Transaction, error) { return _SDUtilityPool.Contract.Repay(&_SDUtilityPool.TransactOpts, repayAmount) } // Repay is a paid mutator transaction binding the contract method 0x371fd8e6. // -// Solidity: function repay(uint256 repayAmount) returns(uint256, uint256) +// Solidity: function repay(uint256 repayAmount) returns(uint256 repaidAmount, uint256 feePaid) func (_SDUtilityPool *SDUtilityPoolTransactorSession) Repay(repayAmount *big.Int) (*types.Transaction, error) { return _SDUtilityPool.Contract.Repay(&_SDUtilityPool.TransactOpts, repayAmount) } +// RepayFullAmount is a paid mutator transaction binding the contract method 0x20552a6e. +// +// Solidity: function repayFullAmount() returns(uint256 repaidAmount, uint256 feePaid) +func (_SDUtilityPool *SDUtilityPoolTransactor) RepayFullAmount(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "repayFullAmount") +} + +// RepayFullAmount is a paid mutator transaction binding the contract method 0x20552a6e. +// +// Solidity: function repayFullAmount() returns(uint256 repaidAmount, uint256 feePaid) +func (_SDUtilityPool *SDUtilityPoolSession) RepayFullAmount() (*types.Transaction, error) { + return _SDUtilityPool.Contract.RepayFullAmount(&_SDUtilityPool.TransactOpts) +} + +// RepayFullAmount is a paid mutator transaction binding the contract method 0x20552a6e. +// +// Solidity: function repayFullAmount() returns(uint256 repaidAmount, uint256 feePaid) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) RepayFullAmount() (*types.Transaction, error) { + return _SDUtilityPool.Contract.RepayFullAmount(&_SDUtilityPool.TransactOpts) +} + // RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. // -// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns(uint256, uint256) +// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns(uint256 repaidAmount, uint256 feePaid) func (_SDUtilityPool *SDUtilityPoolTransactor) RepayOnBehalf(opts *bind.TransactOpts, utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { return _SDUtilityPool.contract.Transact(opts, "repayOnBehalf", utilizer, repayAmount) } // RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. // -// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns(uint256, uint256) +// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns(uint256 repaidAmount, uint256 feePaid) func (_SDUtilityPool *SDUtilityPoolSession) RepayOnBehalf(utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { return _SDUtilityPool.Contract.RepayOnBehalf(&_SDUtilityPool.TransactOpts, utilizer, repayAmount) } // RepayOnBehalf is a paid mutator transaction binding the contract method 0x9f689e0b. // -// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns(uint256, uint256) +// Solidity: function repayOnBehalf(address utilizer, uint256 repayAmount) returns(uint256 repaidAmount, uint256 feePaid) func (_SDUtilityPool *SDUtilityPoolTransactorSession) RepayOnBehalf(utilizer common.Address, repayAmount *big.Int) (*types.Transaction, error) { return _SDUtilityPool.Contract.RepayOnBehalf(&_SDUtilityPool.TransactOpts, utilizer, repayAmount) } +// RepayUtilizedSDBalance is a paid mutator transaction binding the contract method 0x019f0aa9. +// +// Solidity: function repayUtilizedSDBalance(address _utilizer, uint256 amount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) RepayUtilizedSDBalance(opts *bind.TransactOpts, _utilizer common.Address, amount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "repayUtilizedSDBalance", _utilizer, amount) +} + +// RepayUtilizedSDBalance is a paid mutator transaction binding the contract method 0x019f0aa9. +// +// Solidity: function repayUtilizedSDBalance(address _utilizer, uint256 amount) returns() +func (_SDUtilityPool *SDUtilityPoolSession) RepayUtilizedSDBalance(_utilizer common.Address, amount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RepayUtilizedSDBalance(&_SDUtilityPool.TransactOpts, _utilizer, amount) +} + +// RepayUtilizedSDBalance is a paid mutator transaction binding the contract method 0x019f0aa9. +// +// Solidity: function repayUtilizedSDBalance(address _utilizer, uint256 amount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) RepayUtilizedSDBalance(_utilizer common.Address, amount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RepayUtilizedSDBalance(&_SDUtilityPool.TransactOpts, _utilizer, amount) +} + // RequestWithdraw is a paid mutator transaction binding the contract method 0x745400c9. // -// Solidity: function requestWithdraw(uint256 cTokenAmount) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactor) RequestWithdraw(opts *bind.TransactOpts, cTokenAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "requestWithdraw", cTokenAmount) +// Solidity: function requestWithdraw(uint256 _cTokenAmount) returns(uint256 _requestId) +func (_SDUtilityPool *SDUtilityPoolTransactor) RequestWithdraw(opts *bind.TransactOpts, _cTokenAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "requestWithdraw", _cTokenAmount) } // RequestWithdraw is a paid mutator transaction binding the contract method 0x745400c9. // -// Solidity: function requestWithdraw(uint256 cTokenAmount) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) RequestWithdraw(cTokenAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RequestWithdraw(&_SDUtilityPool.TransactOpts, cTokenAmount) +// Solidity: function requestWithdraw(uint256 _cTokenAmount) returns(uint256 _requestId) +func (_SDUtilityPool *SDUtilityPoolSession) RequestWithdraw(_cTokenAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RequestWithdraw(&_SDUtilityPool.TransactOpts, _cTokenAmount) } // RequestWithdraw is a paid mutator transaction binding the contract method 0x745400c9. // -// Solidity: function requestWithdraw(uint256 cTokenAmount) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactorSession) RequestWithdraw(cTokenAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RequestWithdraw(&_SDUtilityPool.TransactOpts, cTokenAmount) +// Solidity: function requestWithdraw(uint256 _cTokenAmount) returns(uint256 _requestId) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) RequestWithdraw(_cTokenAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RequestWithdraw(&_SDUtilityPool.TransactOpts, _cTokenAmount) } // RequestWithdrawWithSDAmount is a paid mutator transaction binding the contract method 0xc51cd1cc. // -// Solidity: function requestWithdrawWithSDAmount(uint256 sdAmount) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactor) RequestWithdrawWithSDAmount(opts *bind.TransactOpts, sdAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "requestWithdrawWithSDAmount", sdAmount) +// Solidity: function requestWithdrawWithSDAmount(uint256 _sdAmount) returns(uint256 _requestId) +func (_SDUtilityPool *SDUtilityPoolTransactor) RequestWithdrawWithSDAmount(opts *bind.TransactOpts, _sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "requestWithdrawWithSDAmount", _sdAmount) } // RequestWithdrawWithSDAmount is a paid mutator transaction binding the contract method 0xc51cd1cc. // -// Solidity: function requestWithdrawWithSDAmount(uint256 sdAmount) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) RequestWithdrawWithSDAmount(sdAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RequestWithdrawWithSDAmount(&_SDUtilityPool.TransactOpts, sdAmount) +// Solidity: function requestWithdrawWithSDAmount(uint256 _sdAmount) returns(uint256 _requestId) +func (_SDUtilityPool *SDUtilityPoolSession) RequestWithdrawWithSDAmount(_sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RequestWithdrawWithSDAmount(&_SDUtilityPool.TransactOpts, _sdAmount) } // RequestWithdrawWithSDAmount is a paid mutator transaction binding the contract method 0xc51cd1cc. // -// Solidity: function requestWithdrawWithSDAmount(uint256 sdAmount) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactorSession) RequestWithdrawWithSDAmount(sdAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.RequestWithdrawWithSDAmount(&_SDUtilityPool.TransactOpts, sdAmount) +// Solidity: function requestWithdrawWithSDAmount(uint256 _sdAmount) returns(uint256 _requestId) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) RequestWithdrawWithSDAmount(_sdAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RequestWithdrawWithSDAmount(&_SDUtilityPool.TransactOpts, _sdAmount) +} + +// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. +// +// Solidity: function revokeRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) RevokeRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "revokeRole", role, account) +} + +// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. +// +// Solidity: function revokeRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolSession) RevokeRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RevokeRole(&_SDUtilityPool.TransactOpts, role, account) +} + +// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. +// +// Solidity: function revokeRole(bytes32 role, address account) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) RevokeRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.RevokeRole(&_SDUtilityPool.TransactOpts, role, account) +} + +// Unpause is a paid mutator transaction binding the contract method 0x3f4ba83a. +// +// Solidity: function unpause() returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) Unpause(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "unpause") +} + +// Unpause is a paid mutator transaction binding the contract method 0x3f4ba83a. +// +// Solidity: function unpause() returns() +func (_SDUtilityPool *SDUtilityPoolSession) Unpause() (*types.Transaction, error) { + return _SDUtilityPool.Contract.Unpause(&_SDUtilityPool.TransactOpts) +} + +// Unpause is a paid mutator transaction binding the contract method 0x3f4ba83a. +// +// Solidity: function unpause() returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Unpause() (*types.Transaction, error) { + return _SDUtilityPool.Contract.Unpause(&_SDUtilityPool.TransactOpts) } // UpdateConservativeEthPerKey is a paid mutator transaction binding the contract method 0x1c557f05. @@ -1363,6 +2354,27 @@ func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateProtocolFee(_protoco return _SDUtilityPool.Contract.UpdateProtocolFee(&_SDUtilityPool.TransactOpts, _protocolFee) } +// UpdateRiskConfig is a paid mutator transaction binding the contract method 0x62569a51. +// +// Solidity: function updateRiskConfig(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateRiskConfig(opts *bind.TransactOpts, liquidationThreshold *big.Int, liquidationBonusPercent *big.Int, liquidationFeePercent *big.Int, ltv *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateRiskConfig", liquidationThreshold, liquidationBonusPercent, liquidationFeePercent, ltv) +} + +// UpdateRiskConfig is a paid mutator transaction binding the contract method 0x62569a51. +// +// Solidity: function updateRiskConfig(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateRiskConfig(liquidationThreshold *big.Int, liquidationBonusPercent *big.Int, liquidationFeePercent *big.Int, ltv *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateRiskConfig(&_SDUtilityPool.TransactOpts, liquidationThreshold, liquidationBonusPercent, liquidationFeePercent, ltv) +} + +// UpdateRiskConfig is a paid mutator transaction binding the contract method 0x62569a51. +// +// Solidity: function updateRiskConfig(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateRiskConfig(liquidationThreshold *big.Int, liquidationBonusPercent *big.Int, liquidationFeePercent *big.Int, ltv *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateRiskConfig(&_SDUtilityPool.TransactOpts, liquidationThreshold, liquidationBonusPercent, liquidationFeePercent, ltv) +} + // UpdateStaderConfig is a paid mutator transaction binding the contract method 0x9ee804cb. // // Solidity: function updateStaderConfig(address _staderConfig) returns() @@ -1377,121 +2389,1252 @@ func (_SDUtilityPool *SDUtilityPoolSession) UpdateStaderConfig(_staderConfig com return _SDUtilityPool.Contract.UpdateStaderConfig(&_SDUtilityPool.TransactOpts, _staderConfig) } -// UpdateStaderConfig is a paid mutator transaction binding the contract method 0x9ee804cb. +// UpdateStaderConfig is a paid mutator transaction binding the contract method 0x9ee804cb. +// +// Solidity: function updateStaderConfig(address _staderConfig) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateStaderConfig(_staderConfig common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateStaderConfig(&_SDUtilityPool.TransactOpts, _staderConfig) +} + +// UpdateUtilizationRatePerBlock is a paid mutator transaction binding the contract method 0xcb2d89dd. +// +// Solidity: function updateUtilizationRatePerBlock(uint256 _utilizationRatePerBlock) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateUtilizationRatePerBlock(opts *bind.TransactOpts, _utilizationRatePerBlock *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "updateUtilizationRatePerBlock", _utilizationRatePerBlock) +} + +// UpdateUtilizationRatePerBlock is a paid mutator transaction binding the contract method 0xcb2d89dd. +// +// Solidity: function updateUtilizationRatePerBlock(uint256 _utilizationRatePerBlock) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UpdateUtilizationRatePerBlock(_utilizationRatePerBlock *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateUtilizationRatePerBlock(&_SDUtilityPool.TransactOpts, _utilizationRatePerBlock) +} + +// UpdateUtilizationRatePerBlock is a paid mutator transaction binding the contract method 0xcb2d89dd. +// +// Solidity: function updateUtilizationRatePerBlock(uint256 _utilizationRatePerBlock) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateUtilizationRatePerBlock(_utilizationRatePerBlock *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UpdateUtilizationRatePerBlock(&_SDUtilityPool.TransactOpts, _utilizationRatePerBlock) +} + +// Utilize is a paid mutator transaction binding the contract method 0xec29c551. +// +// Solidity: function utilize(uint256 utilizeAmount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) Utilize(opts *bind.TransactOpts, utilizeAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "utilize", utilizeAmount) +} + +// Utilize is a paid mutator transaction binding the contract method 0xec29c551. +// +// Solidity: function utilize(uint256 utilizeAmount) returns() +func (_SDUtilityPool *SDUtilityPoolSession) Utilize(utilizeAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Utilize(&_SDUtilityPool.TransactOpts, utilizeAmount) +} + +// Utilize is a paid mutator transaction binding the contract method 0xec29c551. +// +// Solidity: function utilize(uint256 utilizeAmount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) Utilize(utilizeAmount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.Utilize(&_SDUtilityPool.TransactOpts, utilizeAmount) +} + +// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. +// +// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) UtilizeWhileAddingKeys(opts *bind.TransactOpts, operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "utilizeWhileAddingKeys", operator, utilizeAmount, nonTerminalKeyCount) +} + +// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. +// +// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() +func (_SDUtilityPool *SDUtilityPoolSession) UtilizeWhileAddingKeys(operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UtilizeWhileAddingKeys(&_SDUtilityPool.TransactOpts, operator, utilizeAmount, nonTerminalKeyCount) +} + +// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. +// +// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UtilizeWhileAddingKeys(operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UtilizeWhileAddingKeys(&_SDUtilityPool.TransactOpts, operator, utilizeAmount, nonTerminalKeyCount) +} + +// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. +// +// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactor) UtilizerBalanceCurrent(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "utilizerBalanceCurrent", account) +} + +// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. +// +// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolSession) UtilizerBalanceCurrent(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UtilizerBalanceCurrent(&_SDUtilityPool.TransactOpts, account) +} + +// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. +// +// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) +func (_SDUtilityPool *SDUtilityPoolTransactorSession) UtilizerBalanceCurrent(account common.Address) (*types.Transaction, error) { + return _SDUtilityPool.Contract.UtilizerBalanceCurrent(&_SDUtilityPool.TransactOpts, account) +} + +// WithdrawProtocolFee is a paid mutator transaction binding the contract method 0x424cd833. +// +// Solidity: function withdrawProtocolFee(uint256 _amount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactor) WithdrawProtocolFee(opts *bind.TransactOpts, _amount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.contract.Transact(opts, "withdrawProtocolFee", _amount) +} + +// WithdrawProtocolFee is a paid mutator transaction binding the contract method 0x424cd833. +// +// Solidity: function withdrawProtocolFee(uint256 _amount) returns() +func (_SDUtilityPool *SDUtilityPoolSession) WithdrawProtocolFee(_amount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.WithdrawProtocolFee(&_SDUtilityPool.TransactOpts, _amount) +} + +// WithdrawProtocolFee is a paid mutator transaction binding the contract method 0x424cd833. +// +// Solidity: function withdrawProtocolFee(uint256 _amount) returns() +func (_SDUtilityPool *SDUtilityPoolTransactorSession) WithdrawProtocolFee(_amount *big.Int) (*types.Transaction, error) { + return _SDUtilityPool.Contract.WithdrawProtocolFee(&_SDUtilityPool.TransactOpts, _amount) +} + +// SDUtilityPoolAccruedFeesIterator is returned from FilterAccruedFees and is used to iterate over the raw logs and unpacked data for AccruedFees events raised by the SDUtilityPool contract. +type SDUtilityPoolAccruedFeesIterator struct { + Event *SDUtilityPoolAccruedFees // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolAccruedFeesIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolAccruedFees) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolAccruedFees) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolAccruedFeesIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolAccruedFeesIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolAccruedFees represents a AccruedFees event raised by the SDUtilityPool contract. +type SDUtilityPoolAccruedFees struct { + FeeAccumulated *big.Int + TotalProtocolFee *big.Int + TotalUtilizedSD *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterAccruedFees is a free log retrieval operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. +// +// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterAccruedFees(opts *bind.FilterOpts) (*SDUtilityPoolAccruedFeesIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "AccruedFees") + if err != nil { + return nil, err + } + return &SDUtilityPoolAccruedFeesIterator{contract: _SDUtilityPool.contract, event: "AccruedFees", logs: logs, sub: sub}, nil +} + +// WatchAccruedFees is a free log subscription operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. +// +// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchAccruedFees(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolAccruedFees) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "AccruedFees") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolAccruedFees) + if err := _SDUtilityPool.contract.UnpackLog(event, "AccruedFees", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseAccruedFees is a log parse operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. +// +// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseAccruedFees(log types.Log) (*SDUtilityPoolAccruedFees, error) { + event := new(SDUtilityPoolAccruedFees) + if err := _SDUtilityPool.contract.UnpackLog(event, "AccruedFees", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolClearedUtilizerInterestIterator is returned from FilterClearedUtilizerInterest and is used to iterate over the raw logs and unpacked data for ClearedUtilizerInterest events raised by the SDUtilityPool contract. +type SDUtilityPoolClearedUtilizerInterestIterator struct { + Event *SDUtilityPoolClearedUtilizerInterest // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolClearedUtilizerInterestIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolClearedUtilizerInterest) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolClearedUtilizerInterest) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolClearedUtilizerInterestIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolClearedUtilizerInterestIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolClearedUtilizerInterest represents a ClearedUtilizerInterest event raised by the SDUtilityPool contract. +type SDUtilityPoolClearedUtilizerInterest struct { + Utilizer common.Address + SdInterest *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterClearedUtilizerInterest is a free log retrieval operation binding the contract event 0xe4e48d484ff3673a949d4949c3d1959419699d892dcdd4640d67f72b6d48cf24. +// +// Solidity: event ClearedUtilizerInterest(address indexed utilizer, uint256 sdInterest) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterClearedUtilizerInterest(opts *bind.FilterOpts, utilizer []common.Address) (*SDUtilityPoolClearedUtilizerInterestIterator, error) { + + var utilizerRule []interface{} + for _, utilizerItem := range utilizer { + utilizerRule = append(utilizerRule, utilizerItem) + } + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "ClearedUtilizerInterest", utilizerRule) + if err != nil { + return nil, err + } + return &SDUtilityPoolClearedUtilizerInterestIterator{contract: _SDUtilityPool.contract, event: "ClearedUtilizerInterest", logs: logs, sub: sub}, nil +} + +// WatchClearedUtilizerInterest is a free log subscription operation binding the contract event 0xe4e48d484ff3673a949d4949c3d1959419699d892dcdd4640d67f72b6d48cf24. +// +// Solidity: event ClearedUtilizerInterest(address indexed utilizer, uint256 sdInterest) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchClearedUtilizerInterest(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolClearedUtilizerInterest, utilizer []common.Address) (event.Subscription, error) { + + var utilizerRule []interface{} + for _, utilizerItem := range utilizer { + utilizerRule = append(utilizerRule, utilizerItem) + } + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "ClearedUtilizerInterest", utilizerRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolClearedUtilizerInterest) + if err := _SDUtilityPool.contract.UnpackLog(event, "ClearedUtilizerInterest", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseClearedUtilizerInterest is a log parse operation binding the contract event 0xe4e48d484ff3673a949d4949c3d1959419699d892dcdd4640d67f72b6d48cf24. +// +// Solidity: event ClearedUtilizerInterest(address indexed utilizer, uint256 sdInterest) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseClearedUtilizerInterest(log types.Log) (*SDUtilityPoolClearedUtilizerInterest, error) { + event := new(SDUtilityPoolClearedUtilizerInterest) + if err := _SDUtilityPool.contract.UnpackLog(event, "ClearedUtilizerInterest", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolCompleteLiquidationIterator is returned from FilterCompleteLiquidation and is used to iterate over the raw logs and unpacked data for CompleteLiquidation events raised by the SDUtilityPool contract. +type SDUtilityPoolCompleteLiquidationIterator struct { + Event *SDUtilityPoolCompleteLiquidation // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolCompleteLiquidationIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolCompleteLiquidation) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolCompleteLiquidation) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolCompleteLiquidationIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolCompleteLiquidationIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolCompleteLiquidation represents a CompleteLiquidation event raised by the SDUtilityPool contract. +type SDUtilityPoolCompleteLiquidation struct { + Index *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterCompleteLiquidation is a free log retrieval operation binding the contract event 0x2f0c36e8e230af6ceee7ecc30319e10800731fef4913c80afcf23f84b148df5d. +// +// Solidity: event CompleteLiquidation(uint256 indexed index) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterCompleteLiquidation(opts *bind.FilterOpts, index []*big.Int) (*SDUtilityPoolCompleteLiquidationIterator, error) { + + var indexRule []interface{} + for _, indexItem := range index { + indexRule = append(indexRule, indexItem) + } + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "CompleteLiquidation", indexRule) + if err != nil { + return nil, err + } + return &SDUtilityPoolCompleteLiquidationIterator{contract: _SDUtilityPool.contract, event: "CompleteLiquidation", logs: logs, sub: sub}, nil +} + +// WatchCompleteLiquidation is a free log subscription operation binding the contract event 0x2f0c36e8e230af6ceee7ecc30319e10800731fef4913c80afcf23f84b148df5d. +// +// Solidity: event CompleteLiquidation(uint256 indexed index) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchCompleteLiquidation(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolCompleteLiquidation, index []*big.Int) (event.Subscription, error) { + + var indexRule []interface{} + for _, indexItem := range index { + indexRule = append(indexRule, indexItem) + } + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "CompleteLiquidation", indexRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolCompleteLiquidation) + if err := _SDUtilityPool.contract.UnpackLog(event, "CompleteLiquidation", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseCompleteLiquidation is a log parse operation binding the contract event 0x2f0c36e8e230af6ceee7ecc30319e10800731fef4913c80afcf23f84b148df5d. +// +// Solidity: event CompleteLiquidation(uint256 indexed index) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseCompleteLiquidation(log types.Log) (*SDUtilityPoolCompleteLiquidation, error) { + event := new(SDUtilityPoolCompleteLiquidation) + if err := _SDUtilityPool.contract.UnpackLog(event, "CompleteLiquidation", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolDelegatedIterator is returned from FilterDelegated and is used to iterate over the raw logs and unpacked data for Delegated events raised by the SDUtilityPool contract. +type SDUtilityPoolDelegatedIterator struct { + Event *SDUtilityPoolDelegated // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolDelegatedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolDelegated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolDelegated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolDelegatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolDelegatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolDelegated represents a Delegated event raised by the SDUtilityPool contract. +type SDUtilityPoolDelegated struct { + Delegator common.Address + SdAmount *big.Int + SdXToMint *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterDelegated is a free log retrieval operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// +// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterDelegated(opts *bind.FilterOpts, delegator []common.Address) (*SDUtilityPoolDelegatedIterator, error) { + + var delegatorRule []interface{} + for _, delegatorItem := range delegator { + delegatorRule = append(delegatorRule, delegatorItem) + } + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Delegated", delegatorRule) + if err != nil { + return nil, err + } + return &SDUtilityPoolDelegatedIterator{contract: _SDUtilityPool.contract, event: "Delegated", logs: logs, sub: sub}, nil +} + +// WatchDelegated is a free log subscription operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// +// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchDelegated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolDelegated, delegator []common.Address) (event.Subscription, error) { + + var delegatorRule []interface{} + for _, delegatorItem := range delegator { + delegatorRule = append(delegatorRule, delegatorItem) + } + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Delegated", delegatorRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolDelegated) + if err := _SDUtilityPool.contract.UnpackLog(event, "Delegated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseDelegated is a log parse operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// +// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseDelegated(log types.Log) (*SDUtilityPoolDelegated, error) { + event := new(SDUtilityPoolDelegated) + if err := _SDUtilityPool.contract.UnpackLog(event, "Delegated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolFinalizedWithdrawRequestIterator is returned from FilterFinalizedWithdrawRequest and is used to iterate over the raw logs and unpacked data for FinalizedWithdrawRequest events raised by the SDUtilityPool contract. +type SDUtilityPoolFinalizedWithdrawRequestIterator struct { + Event *SDUtilityPoolFinalizedWithdrawRequest // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolFinalizedWithdrawRequest) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolFinalizedWithdrawRequest) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolFinalizedWithdrawRequest represents a FinalizedWithdrawRequest event raised by the SDUtilityPool contract. +type SDUtilityPoolFinalizedWithdrawRequest struct { + NextRequestIdToFinalize *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterFinalizedWithdrawRequest is a free log retrieval operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. +// +// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterFinalizedWithdrawRequest(opts *bind.FilterOpts) (*SDUtilityPoolFinalizedWithdrawRequestIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "FinalizedWithdrawRequest") + if err != nil { + return nil, err + } + return &SDUtilityPoolFinalizedWithdrawRequestIterator{contract: _SDUtilityPool.contract, event: "FinalizedWithdrawRequest", logs: logs, sub: sub}, nil +} + +// WatchFinalizedWithdrawRequest is a free log subscription operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. +// +// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchFinalizedWithdrawRequest(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolFinalizedWithdrawRequest) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "FinalizedWithdrawRequest") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolFinalizedWithdrawRequest) + if err := _SDUtilityPool.contract.UnpackLog(event, "FinalizedWithdrawRequest", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseFinalizedWithdrawRequest is a log parse operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. +// +// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseFinalizedWithdrawRequest(log types.Log) (*SDUtilityPoolFinalizedWithdrawRequest, error) { + event := new(SDUtilityPoolFinalizedWithdrawRequest) + if err := _SDUtilityPool.contract.UnpackLog(event, "FinalizedWithdrawRequest", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the SDUtilityPool contract. +type SDUtilityPoolInitializedIterator struct { + Event *SDUtilityPoolInitialized // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolInitializedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolInitialized) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolInitialized) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolInitializedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolInitializedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolInitialized represents a Initialized event raised by the SDUtilityPool contract. +type SDUtilityPoolInitialized struct { + Version uint8 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterInitialized is a free log retrieval operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterInitialized(opts *bind.FilterOpts) (*SDUtilityPoolInitializedIterator, error) { + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Initialized") + if err != nil { + return nil, err + } + return &SDUtilityPoolInitializedIterator{contract: _SDUtilityPool.contract, event: "Initialized", logs: logs, sub: sub}, nil +} + +// WatchInitialized is a free log subscription operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolInitialized) (event.Subscription, error) { + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Initialized") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolInitialized) + if err := _SDUtilityPool.contract.UnpackLog(event, "Initialized", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseInitialized is a log parse operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseInitialized(log types.Log) (*SDUtilityPoolInitialized, error) { + event := new(SDUtilityPoolInitialized) + if err := _SDUtilityPool.contract.UnpackLog(event, "Initialized", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SDUtilityPoolLiquidationCallIterator is returned from FilterLiquidationCall and is used to iterate over the raw logs and unpacked data for LiquidationCall events raised by the SDUtilityPool contract. +type SDUtilityPoolLiquidationCallIterator struct { + Event *SDUtilityPoolLiquidationCall // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolLiquidationCallIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolLiquidationCall) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolLiquidationCall) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolLiquidationCallIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolLiquidationCallIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SDUtilityPoolLiquidationCall represents a LiquidationCall event raised by the SDUtilityPool contract. +type SDUtilityPoolLiquidationCall struct { + Account common.Address + TotalLiquidationAmountInEth *big.Int + LiquidationBonusInEth *big.Int + LiquidationFeeInEth *big.Int + Liquidator common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterLiquidationCall is a free log retrieval operation binding the contract event 0xcc9de8be9ac1f02b70a8ca2612f451a769d6d160ad91de17dcc38e54c567a532. +// +// Solidity: event LiquidationCall(address indexed account, uint256 totalLiquidationAmountInEth, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth, address indexed liquidator) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterLiquidationCall(opts *bind.FilterOpts, account []common.Address, liquidator []common.Address) (*SDUtilityPoolLiquidationCallIterator, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + var liquidatorRule []interface{} + for _, liquidatorItem := range liquidator { + liquidatorRule = append(liquidatorRule, liquidatorItem) + } + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "LiquidationCall", accountRule, liquidatorRule) + if err != nil { + return nil, err + } + return &SDUtilityPoolLiquidationCallIterator{contract: _SDUtilityPool.contract, event: "LiquidationCall", logs: logs, sub: sub}, nil +} + +// WatchLiquidationCall is a free log subscription operation binding the contract event 0xcc9de8be9ac1f02b70a8ca2612f451a769d6d160ad91de17dcc38e54c567a532. +// +// Solidity: event LiquidationCall(address indexed account, uint256 totalLiquidationAmountInEth, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth, address indexed liquidator) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchLiquidationCall(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolLiquidationCall, account []common.Address, liquidator []common.Address) (event.Subscription, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + var liquidatorRule []interface{} + for _, liquidatorItem := range liquidator { + liquidatorRule = append(liquidatorRule, liquidatorItem) + } + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "LiquidationCall", accountRule, liquidatorRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolLiquidationCall) + if err := _SDUtilityPool.contract.UnpackLog(event, "LiquidationCall", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseLiquidationCall is a log parse operation binding the contract event 0xcc9de8be9ac1f02b70a8ca2612f451a769d6d160ad91de17dcc38e54c567a532. // -// Solidity: function updateStaderConfig(address _staderConfig) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateStaderConfig(_staderConfig common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateStaderConfig(&_SDUtilityPool.TransactOpts, _staderConfig) +// Solidity: event LiquidationCall(address indexed account, uint256 totalLiquidationAmountInEth, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth, address indexed liquidator) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseLiquidationCall(log types.Log) (*SDUtilityPoolLiquidationCall, error) { + event := new(SDUtilityPoolLiquidationCall) + if err := _SDUtilityPool.contract.UnpackLog(event, "LiquidationCall", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil } -// UpdateUtilizationRatePerBlock is a paid mutator transaction binding the contract method 0xcb2d89dd. -// -// Solidity: function updateUtilizationRatePerBlock(uint256 _utilizationRatePerBlock) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) UpdateUtilizationRatePerBlock(opts *bind.TransactOpts, _utilizationRatePerBlock *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "updateUtilizationRatePerBlock", _utilizationRatePerBlock) -} +// SDUtilityPoolPausedIterator is returned from FilterPaused and is used to iterate over the raw logs and unpacked data for Paused events raised by the SDUtilityPool contract. +type SDUtilityPoolPausedIterator struct { + Event *SDUtilityPoolPaused // Event containing the contract specifics and raw log -// UpdateUtilizationRatePerBlock is a paid mutator transaction binding the contract method 0xcb2d89dd. -// -// Solidity: function updateUtilizationRatePerBlock(uint256 _utilizationRatePerBlock) returns() -func (_SDUtilityPool *SDUtilityPoolSession) UpdateUtilizationRatePerBlock(_utilizationRatePerBlock *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateUtilizationRatePerBlock(&_SDUtilityPool.TransactOpts, _utilizationRatePerBlock) -} + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data -// UpdateUtilizationRatePerBlock is a paid mutator transaction binding the contract method 0xcb2d89dd. -// -// Solidity: function updateUtilizationRatePerBlock(uint256 _utilizationRatePerBlock) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UpdateUtilizationRatePerBlock(_utilizationRatePerBlock *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UpdateUtilizationRatePerBlock(&_SDUtilityPool.TransactOpts, _utilizationRatePerBlock) + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration } -// Utilize is a paid mutator transaction binding the contract method 0xec29c551. -// -// Solidity: function utilize(uint256 utilizeAmount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) Utilize(opts *bind.TransactOpts, utilizeAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "utilize", utilizeAmount) -} +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SDUtilityPoolPausedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolPaused) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true -// Utilize is a paid mutator transaction binding the contract method 0xec29c551. -// -// Solidity: function utilize(uint256 utilizeAmount) returns() -func (_SDUtilityPool *SDUtilityPoolSession) Utilize(utilizeAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Utilize(&_SDUtilityPool.TransactOpts, utilizeAmount) -} + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SDUtilityPoolPaused) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true -// Utilize is a paid mutator transaction binding the contract method 0xec29c551. -// -// Solidity: function utilize(uint256 utilizeAmount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) Utilize(utilizeAmount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.Utilize(&_SDUtilityPool.TransactOpts, utilizeAmount) + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } } -// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. -// -// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) UtilizeWhileAddingKeys(opts *bind.TransactOpts, operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "utilizeWhileAddingKeys", operator, utilizeAmount, nonTerminalKeyCount) +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SDUtilityPoolPausedIterator) Error() error { + return it.fail } -// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. -// -// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() -func (_SDUtilityPool *SDUtilityPoolSession) UtilizeWhileAddingKeys(operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UtilizeWhileAddingKeys(&_SDUtilityPool.TransactOpts, operator, utilizeAmount, nonTerminalKeyCount) +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SDUtilityPoolPausedIterator) Close() error { + it.sub.Unsubscribe() + return nil } -// UtilizeWhileAddingKeys is a paid mutator transaction binding the contract method 0x23c4ac1a. -// -// Solidity: function utilizeWhileAddingKeys(address operator, uint256 utilizeAmount, uint256 nonTerminalKeyCount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UtilizeWhileAddingKeys(operator common.Address, utilizeAmount *big.Int, nonTerminalKeyCount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UtilizeWhileAddingKeys(&_SDUtilityPool.TransactOpts, operator, utilizeAmount, nonTerminalKeyCount) +// SDUtilityPoolPaused represents a Paused event raised by the SDUtilityPool contract. +type SDUtilityPoolPaused struct { + Account common.Address + Raw types.Log // Blockchain specific contextual infos } -// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. +// FilterPaused is a free log retrieval operation binding the contract event 0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258. // -// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactor) UtilizerBalanceCurrent(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "utilizerBalanceCurrent", account) -} +// Solidity: event Paused(address account) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterPaused(opts *bind.FilterOpts) (*SDUtilityPoolPausedIterator, error) { -// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. -// -// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolSession) UtilizerBalanceCurrent(account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UtilizerBalanceCurrent(&_SDUtilityPool.TransactOpts, account) + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Paused") + if err != nil { + return nil, err + } + return &SDUtilityPoolPausedIterator{contract: _SDUtilityPool.contract, event: "Paused", logs: logs, sub: sub}, nil } -// UtilizerBalanceCurrent is a paid mutator transaction binding the contract method 0xe65efbe4. +// WatchPaused is a free log subscription operation binding the contract event 0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258. // -// Solidity: function utilizerBalanceCurrent(address account) returns(uint256) -func (_SDUtilityPool *SDUtilityPoolTransactorSession) UtilizerBalanceCurrent(account common.Address) (*types.Transaction, error) { - return _SDUtilityPool.Contract.UtilizerBalanceCurrent(&_SDUtilityPool.TransactOpts, account) -} +// Solidity: event Paused(address account) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchPaused(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolPaused) (event.Subscription, error) { -// WithdrawProtocolFee is a paid mutator transaction binding the contract method 0x424cd833. -// -// Solidity: function withdrawProtocolFee(uint256 _amount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactor) WithdrawProtocolFee(opts *bind.TransactOpts, _amount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.contract.Transact(opts, "withdrawProtocolFee", _amount) -} + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Paused") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SDUtilityPoolPaused) + if err := _SDUtilityPool.contract.UnpackLog(event, "Paused", log); err != nil { + return err + } + event.Raw = log -// WithdrawProtocolFee is a paid mutator transaction binding the contract method 0x424cd833. -// -// Solidity: function withdrawProtocolFee(uint256 _amount) returns() -func (_SDUtilityPool *SDUtilityPoolSession) WithdrawProtocolFee(_amount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.WithdrawProtocolFee(&_SDUtilityPool.TransactOpts, _amount) + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil } -// WithdrawProtocolFee is a paid mutator transaction binding the contract method 0x424cd833. +// ParsePaused is a log parse operation binding the contract event 0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258. // -// Solidity: function withdrawProtocolFee(uint256 _amount) returns() -func (_SDUtilityPool *SDUtilityPoolTransactorSession) WithdrawProtocolFee(_amount *big.Int) (*types.Transaction, error) { - return _SDUtilityPool.Contract.WithdrawProtocolFee(&_SDUtilityPool.TransactOpts, _amount) +// Solidity: event Paused(address account) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParsePaused(log types.Log) (*SDUtilityPoolPaused, error) { + event := new(SDUtilityPoolPaused) + if err := _SDUtilityPool.contract.UnpackLog(event, "Paused", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil } -// SDUtilityPoolAccruedFeesIterator is returned from FilterAccruedFees and is used to iterate over the raw logs and unpacked data for AccruedFees events raised by the SDUtilityPool contract. -type SDUtilityPoolAccruedFeesIterator struct { - Event *SDUtilityPoolAccruedFees // Event containing the contract specifics and raw log +// SDUtilityPoolProtocolFeeFactorUpdatedIterator is returned from FilterProtocolFeeFactorUpdated and is used to iterate over the raw logs and unpacked data for ProtocolFeeFactorUpdated events raised by the SDUtilityPool contract. +type SDUtilityPoolProtocolFeeFactorUpdatedIterator struct { + Event *SDUtilityPoolProtocolFeeFactorUpdated // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1505,7 +3648,7 @@ type SDUtilityPoolAccruedFeesIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolAccruedFeesIterator) Next() bool { +func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1514,7 +3657,7 @@ func (it *SDUtilityPoolAccruedFeesIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolAccruedFees) + it.Event = new(SDUtilityPoolProtocolFeeFactorUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1529,7 +3672,7 @@ func (it *SDUtilityPoolAccruedFeesIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolAccruedFees) + it.Event = new(SDUtilityPoolProtocolFeeFactorUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1545,43 +3688,41 @@ func (it *SDUtilityPoolAccruedFeesIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolAccruedFeesIterator) Error() error { +func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolAccruedFeesIterator) Close() error { +func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolAccruedFees represents a AccruedFees event raised by the SDUtilityPool contract. -type SDUtilityPoolAccruedFees struct { - FeeAccumulated *big.Int - TotalProtocolFee *big.Int - TotalUtilizedSD *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolProtocolFeeFactorUpdated represents a ProtocolFeeFactorUpdated event raised by the SDUtilityPool contract. +type SDUtilityPoolProtocolFeeFactorUpdated struct { + ProtocolFeeFactor *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterAccruedFees is a free log retrieval operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. +// FilterProtocolFeeFactorUpdated is a free log retrieval operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. // -// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterAccruedFees(opts *bind.FilterOpts) (*SDUtilityPoolAccruedFeesIterator, error) { +// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterProtocolFeeFactorUpdated(opts *bind.FilterOpts) (*SDUtilityPoolProtocolFeeFactorUpdatedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "AccruedFees") + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "ProtocolFeeFactorUpdated") if err != nil { return nil, err } - return &SDUtilityPoolAccruedFeesIterator{contract: _SDUtilityPool.contract, event: "AccruedFees", logs: logs, sub: sub}, nil + return &SDUtilityPoolProtocolFeeFactorUpdatedIterator{contract: _SDUtilityPool.contract, event: "ProtocolFeeFactorUpdated", logs: logs, sub: sub}, nil } -// WatchAccruedFees is a free log subscription operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. +// WatchProtocolFeeFactorUpdated is a free log subscription operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. // -// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchAccruedFees(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolAccruedFees) (event.Subscription, error) { +// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchProtocolFeeFactorUpdated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolProtocolFeeFactorUpdated) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "AccruedFees") + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "ProtocolFeeFactorUpdated") if err != nil { return nil, err } @@ -1591,8 +3732,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchAccruedFees(opts *bind.WatchOp select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolAccruedFees) - if err := _SDUtilityPool.contract.UnpackLog(event, "AccruedFees", log); err != nil { + event := new(SDUtilityPoolProtocolFeeFactorUpdated) + if err := _SDUtilityPool.contract.UnpackLog(event, "ProtocolFeeFactorUpdated", log); err != nil { return err } event.Raw = log @@ -1613,21 +3754,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchAccruedFees(opts *bind.WatchOp }), nil } -// ParseAccruedFees is a log parse operation binding the contract event 0x7119249986febcaf2eaa8565a4a5f37df51951d3933512847e77ad489aff89a5. +// ParseProtocolFeeFactorUpdated is a log parse operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. // -// Solidity: event AccruedFees(uint256 feeAccumulated, uint256 totalProtocolFee, uint256 totalUtilizedSD) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseAccruedFees(log types.Log) (*SDUtilityPoolAccruedFees, error) { - event := new(SDUtilityPoolAccruedFees) - if err := _SDUtilityPool.contract.UnpackLog(event, "AccruedFees", log); err != nil { +// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseProtocolFeeFactorUpdated(log types.Log) (*SDUtilityPoolProtocolFeeFactorUpdated, error) { + event := new(SDUtilityPoolProtocolFeeFactorUpdated) + if err := _SDUtilityPool.contract.UnpackLog(event, "ProtocolFeeFactorUpdated", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolCompleteLiquidationIterator is returned from FilterCompleteLiquidation and is used to iterate over the raw logs and unpacked data for CompleteLiquidation events raised by the SDUtilityPool contract. -type SDUtilityPoolCompleteLiquidationIterator struct { - Event *SDUtilityPoolCompleteLiquidation // Event containing the contract specifics and raw log +// SDUtilityPoolRedeemedIterator is returned from FilterRedeemed and is used to iterate over the raw logs and unpacked data for Redeemed events raised by the SDUtilityPool contract. +type SDUtilityPoolRedeemedIterator struct { + Event *SDUtilityPoolRedeemed // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1641,7 +3782,7 @@ type SDUtilityPoolCompleteLiquidationIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolCompleteLiquidationIterator) Next() bool { +func (it *SDUtilityPoolRedeemedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1650,7 +3791,7 @@ func (it *SDUtilityPoolCompleteLiquidationIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolCompleteLiquidation) + it.Event = new(SDUtilityPoolRedeemed) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1665,7 +3806,7 @@ func (it *SDUtilityPoolCompleteLiquidationIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolCompleteLiquidation) + it.Event = new(SDUtilityPoolRedeemed) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1681,51 +3822,53 @@ func (it *SDUtilityPoolCompleteLiquidationIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolCompleteLiquidationIterator) Error() error { +func (it *SDUtilityPoolRedeemedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolCompleteLiquidationIterator) Close() error { +func (it *SDUtilityPoolRedeemedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolCompleteLiquidation represents a CompleteLiquidation event raised by the SDUtilityPool contract. -type SDUtilityPoolCompleteLiquidation struct { - Index *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolRedeemed represents a Redeemed event raised by the SDUtilityPool contract. +type SDUtilityPoolRedeemed struct { + Delegator common.Address + SdAmount *big.Int + SdXAmount *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterCompleteLiquidation is a free log retrieval operation binding the contract event 0x2f0c36e8e230af6ceee7ecc30319e10800731fef4913c80afcf23f84b148df5d. +// FilterRedeemed is a free log retrieval operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. // -// Solidity: event CompleteLiquidation(uint256 indexed index) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterCompleteLiquidation(opts *bind.FilterOpts, index []*big.Int) (*SDUtilityPoolCompleteLiquidationIterator, error) { +// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRedeemed(opts *bind.FilterOpts, delegator []common.Address) (*SDUtilityPoolRedeemedIterator, error) { - var indexRule []interface{} - for _, indexItem := range index { - indexRule = append(indexRule, indexItem) + var delegatorRule []interface{} + for _, delegatorItem := range delegator { + delegatorRule = append(delegatorRule, delegatorItem) } - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "CompleteLiquidation", indexRule) + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Redeemed", delegatorRule) if err != nil { return nil, err } - return &SDUtilityPoolCompleteLiquidationIterator{contract: _SDUtilityPool.contract, event: "CompleteLiquidation", logs: logs, sub: sub}, nil + return &SDUtilityPoolRedeemedIterator{contract: _SDUtilityPool.contract, event: "Redeemed", logs: logs, sub: sub}, nil } -// WatchCompleteLiquidation is a free log subscription operation binding the contract event 0x2f0c36e8e230af6ceee7ecc30319e10800731fef4913c80afcf23f84b148df5d. +// WatchRedeemed is a free log subscription operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. // -// Solidity: event CompleteLiquidation(uint256 indexed index) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchCompleteLiquidation(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolCompleteLiquidation, index []*big.Int) (event.Subscription, error) { +// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRedeemed(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRedeemed, delegator []common.Address) (event.Subscription, error) { - var indexRule []interface{} - for _, indexItem := range index { - indexRule = append(indexRule, indexItem) + var delegatorRule []interface{} + for _, delegatorItem := range delegator { + delegatorRule = append(delegatorRule, delegatorItem) } - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "CompleteLiquidation", indexRule) + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Redeemed", delegatorRule) if err != nil { return nil, err } @@ -1735,8 +3878,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchCompleteLiquidation(opts *bind select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolCompleteLiquidation) - if err := _SDUtilityPool.contract.UnpackLog(event, "CompleteLiquidation", log); err != nil { + event := new(SDUtilityPoolRedeemed) + if err := _SDUtilityPool.contract.UnpackLog(event, "Redeemed", log); err != nil { return err } event.Raw = log @@ -1757,21 +3900,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchCompleteLiquidation(opts *bind }), nil } -// ParseCompleteLiquidation is a log parse operation binding the contract event 0x2f0c36e8e230af6ceee7ecc30319e10800731fef4913c80afcf23f84b148df5d. +// ParseRedeemed is a log parse operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. // -// Solidity: event CompleteLiquidation(uint256 indexed index) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseCompleteLiquidation(log types.Log) (*SDUtilityPoolCompleteLiquidation, error) { - event := new(SDUtilityPoolCompleteLiquidation) - if err := _SDUtilityPool.contract.UnpackLog(event, "CompleteLiquidation", log); err != nil { +// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRedeemed(log types.Log) (*SDUtilityPoolRedeemed, error) { + event := new(SDUtilityPoolRedeemed) + if err := _SDUtilityPool.contract.UnpackLog(event, "Redeemed", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolDelegatedIterator is returned from FilterDelegated and is used to iterate over the raw logs and unpacked data for Delegated events raised by the SDUtilityPool contract. -type SDUtilityPoolDelegatedIterator struct { - Event *SDUtilityPoolDelegated // Event containing the contract specifics and raw log +// SDUtilityPoolRepaidIterator is returned from FilterRepaid and is used to iterate over the raw logs and unpacked data for Repaid events raised by the SDUtilityPool contract. +type SDUtilityPoolRepaidIterator struct { + Event *SDUtilityPoolRepaid // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1785,7 +3928,7 @@ type SDUtilityPoolDelegatedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolDelegatedIterator) Next() bool { +func (it *SDUtilityPoolRepaidIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1794,7 +3937,7 @@ func (it *SDUtilityPoolDelegatedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolDelegated) + it.Event = new(SDUtilityPoolRepaid) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1809,7 +3952,7 @@ func (it *SDUtilityPoolDelegatedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolDelegated) + it.Event = new(SDUtilityPoolRepaid) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1825,53 +3968,52 @@ func (it *SDUtilityPoolDelegatedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolDelegatedIterator) Error() error { +func (it *SDUtilityPoolRepaidIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolDelegatedIterator) Close() error { +func (it *SDUtilityPoolRepaidIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolDelegated represents a Delegated event raised by the SDUtilityPool contract. -type SDUtilityPoolDelegated struct { - Delegator common.Address - SdAmount *big.Int - SdXToMint *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolRepaid represents a Repaid event raised by the SDUtilityPool contract. +type SDUtilityPoolRepaid struct { + Utilizer common.Address + RepayAmount *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterDelegated is a free log retrieval operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// FilterRepaid is a free log retrieval operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. // -// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterDelegated(opts *bind.FilterOpts, delegator []common.Address) (*SDUtilityPoolDelegatedIterator, error) { +// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRepaid(opts *bind.FilterOpts, utilizer []common.Address) (*SDUtilityPoolRepaidIterator, error) { - var delegatorRule []interface{} - for _, delegatorItem := range delegator { - delegatorRule = append(delegatorRule, delegatorItem) + var utilizerRule []interface{} + for _, utilizerItem := range utilizer { + utilizerRule = append(utilizerRule, utilizerItem) } - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Delegated", delegatorRule) + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Repaid", utilizerRule) if err != nil { return nil, err } - return &SDUtilityPoolDelegatedIterator{contract: _SDUtilityPool.contract, event: "Delegated", logs: logs, sub: sub}, nil + return &SDUtilityPoolRepaidIterator{contract: _SDUtilityPool.contract, event: "Repaid", logs: logs, sub: sub}, nil } -// WatchDelegated is a free log subscription operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// WatchRepaid is a free log subscription operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. // -// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchDelegated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolDelegated, delegator []common.Address) (event.Subscription, error) { +// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRepaid(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRepaid, utilizer []common.Address) (event.Subscription, error) { - var delegatorRule []interface{} - for _, delegatorItem := range delegator { - delegatorRule = append(delegatorRule, delegatorItem) + var utilizerRule []interface{} + for _, utilizerItem := range utilizer { + utilizerRule = append(utilizerRule, utilizerItem) } - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Delegated", delegatorRule) + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Repaid", utilizerRule) if err != nil { return nil, err } @@ -1881,8 +4023,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchDelegated(opts *bind.WatchOpts select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolDelegated) - if err := _SDUtilityPool.contract.UnpackLog(event, "Delegated", log); err != nil { + event := new(SDUtilityPoolRepaid) + if err := _SDUtilityPool.contract.UnpackLog(event, "Repaid", log); err != nil { return err } event.Raw = log @@ -1903,21 +4045,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchDelegated(opts *bind.WatchOpts }), nil } -// ParseDelegated is a log parse operation binding the contract event 0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb. +// ParseRepaid is a log parse operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. // -// Solidity: event Delegated(address indexed delegator, uint256 sdAmount, uint256 sdXToMint) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseDelegated(log types.Log) (*SDUtilityPoolDelegated, error) { - event := new(SDUtilityPoolDelegated) - if err := _SDUtilityPool.contract.UnpackLog(event, "Delegated", log); err != nil { +// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRepaid(log types.Log) (*SDUtilityPoolRepaid, error) { + event := new(SDUtilityPoolRepaid) + if err := _SDUtilityPool.contract.UnpackLog(event, "Repaid", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolFinalizedWithdrawRequestIterator is returned from FilterFinalizedWithdrawRequest and is used to iterate over the raw logs and unpacked data for FinalizedWithdrawRequest events raised by the SDUtilityPool contract. -type SDUtilityPoolFinalizedWithdrawRequestIterator struct { - Event *SDUtilityPoolFinalizedWithdrawRequest // Event containing the contract specifics and raw log +// SDUtilityPoolRepaidUtilizedSDBalanceIterator is returned from FilterRepaidUtilizedSDBalance and is used to iterate over the raw logs and unpacked data for RepaidUtilizedSDBalance events raised by the SDUtilityPool contract. +type SDUtilityPoolRepaidUtilizedSDBalanceIterator struct { + Event *SDUtilityPoolRepaidUtilizedSDBalance // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1931,7 +4073,7 @@ type SDUtilityPoolFinalizedWithdrawRequestIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Next() bool { +func (it *SDUtilityPoolRepaidUtilizedSDBalanceIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1940,7 +4082,7 @@ func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolFinalizedWithdrawRequest) + it.Event = new(SDUtilityPoolRepaidUtilizedSDBalance) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1955,7 +4097,7 @@ func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolFinalizedWithdrawRequest) + it.Event = new(SDUtilityPoolRepaidUtilizedSDBalance) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1971,41 +4113,52 @@ func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Error() error { +func (it *SDUtilityPoolRepaidUtilizedSDBalanceIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolFinalizedWithdrawRequestIterator) Close() error { +func (it *SDUtilityPoolRepaidUtilizedSDBalanceIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolFinalizedWithdrawRequest represents a FinalizedWithdrawRequest event raised by the SDUtilityPool contract. -type SDUtilityPoolFinalizedWithdrawRequest struct { - NextRequestIdToFinalize *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolRepaidUtilizedSDBalance represents a RepaidUtilizedSDBalance event raised by the SDUtilityPool contract. +type SDUtilityPoolRepaidUtilizedSDBalance struct { + Utilizer common.Address + UtilizedSDAmount *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterFinalizedWithdrawRequest is a free log retrieval operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. +// FilterRepaidUtilizedSDBalance is a free log retrieval operation binding the contract event 0x37057a3afa8d7c32b75c4534845b8e937e76c0f9cf30fbe71122af20c33646dd. // -// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterFinalizedWithdrawRequest(opts *bind.FilterOpts) (*SDUtilityPoolFinalizedWithdrawRequestIterator, error) { +// Solidity: event RepaidUtilizedSDBalance(address indexed utilizer, uint256 utilizedSDAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRepaidUtilizedSDBalance(opts *bind.FilterOpts, utilizer []common.Address) (*SDUtilityPoolRepaidUtilizedSDBalanceIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "FinalizedWithdrawRequest") + var utilizerRule []interface{} + for _, utilizerItem := range utilizer { + utilizerRule = append(utilizerRule, utilizerItem) + } + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RepaidUtilizedSDBalance", utilizerRule) if err != nil { return nil, err } - return &SDUtilityPoolFinalizedWithdrawRequestIterator{contract: _SDUtilityPool.contract, event: "FinalizedWithdrawRequest", logs: logs, sub: sub}, nil + return &SDUtilityPoolRepaidUtilizedSDBalanceIterator{contract: _SDUtilityPool.contract, event: "RepaidUtilizedSDBalance", logs: logs, sub: sub}, nil } -// WatchFinalizedWithdrawRequest is a free log subscription operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. +// WatchRepaidUtilizedSDBalance is a free log subscription operation binding the contract event 0x37057a3afa8d7c32b75c4534845b8e937e76c0f9cf30fbe71122af20c33646dd. // -// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchFinalizedWithdrawRequest(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolFinalizedWithdrawRequest) (event.Subscription, error) { +// Solidity: event RepaidUtilizedSDBalance(address indexed utilizer, uint256 utilizedSDAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRepaidUtilizedSDBalance(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRepaidUtilizedSDBalance, utilizer []common.Address) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "FinalizedWithdrawRequest") + var utilizerRule []interface{} + for _, utilizerItem := range utilizer { + utilizerRule = append(utilizerRule, utilizerItem) + } + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RepaidUtilizedSDBalance", utilizerRule) if err != nil { return nil, err } @@ -2015,8 +4168,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchFinalizedWithdrawRequest(opts select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolFinalizedWithdrawRequest) - if err := _SDUtilityPool.contract.UnpackLog(event, "FinalizedWithdrawRequest", log); err != nil { + event := new(SDUtilityPoolRepaidUtilizedSDBalance) + if err := _SDUtilityPool.contract.UnpackLog(event, "RepaidUtilizedSDBalance", log); err != nil { return err } event.Raw = log @@ -2037,21 +4190,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchFinalizedWithdrawRequest(opts }), nil } -// ParseFinalizedWithdrawRequest is a log parse operation binding the contract event 0x12a00f5e4c3614409f2dd90dc5be91b9b64ef89bac58a5b034ec0094376dbd37. +// ParseRepaidUtilizedSDBalance is a log parse operation binding the contract event 0x37057a3afa8d7c32b75c4534845b8e937e76c0f9cf30fbe71122af20c33646dd. // -// Solidity: event FinalizedWithdrawRequest(uint256 nextRequestIdToFinalize) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseFinalizedWithdrawRequest(log types.Log) (*SDUtilityPoolFinalizedWithdrawRequest, error) { - event := new(SDUtilityPoolFinalizedWithdrawRequest) - if err := _SDUtilityPool.contract.UnpackLog(event, "FinalizedWithdrawRequest", log); err != nil { +// Solidity: event RepaidUtilizedSDBalance(address indexed utilizer, uint256 utilizedSDAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRepaidUtilizedSDBalance(log types.Log) (*SDUtilityPoolRepaidUtilizedSDBalance, error) { + event := new(SDUtilityPoolRepaidUtilizedSDBalance) + if err := _SDUtilityPool.contract.UnpackLog(event, "RepaidUtilizedSDBalance", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolLiquidationCallIterator is returned from FilterLiquidationCall and is used to iterate over the raw logs and unpacked data for LiquidationCall events raised by the SDUtilityPool contract. -type SDUtilityPoolLiquidationCallIterator struct { - Event *SDUtilityPoolLiquidationCall // Event containing the contract specifics and raw log +// SDUtilityPoolRequestRedeemedIterator is returned from FilterRequestRedeemed and is used to iterate over the raw logs and unpacked data for RequestRedeemed events raised by the SDUtilityPool contract. +type SDUtilityPoolRequestRedeemedIterator struct { + Event *SDUtilityPoolRequestRedeemed // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -2065,7 +4218,7 @@ type SDUtilityPoolLiquidationCallIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolLiquidationCallIterator) Next() bool { +func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -2074,7 +4227,7 @@ func (it *SDUtilityPoolLiquidationCallIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolLiquidationCall) + it.Event = new(SDUtilityPoolRequestRedeemed) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2089,7 +4242,7 @@ func (it *SDUtilityPoolLiquidationCallIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolLiquidationCall) + it.Event = new(SDUtilityPoolRequestRedeemed) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2105,65 +4258,42 @@ func (it *SDUtilityPoolLiquidationCallIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolLiquidationCallIterator) Error() error { +func (it *SDUtilityPoolRequestRedeemedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolLiquidationCallIterator) Close() error { +func (it *SDUtilityPoolRequestRedeemedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolLiquidationCall represents a LiquidationCall event raised by the SDUtilityPool contract. -type SDUtilityPoolLiquidationCall struct { - Account common.Address - TotalLiquidationAmountInEth *big.Int - LiquidationBonusInEth *big.Int - LiquidationFeeInEth *big.Int - Liquidator common.Address - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolRequestRedeemed represents a RequestRedeemed event raised by the SDUtilityPool contract. +type SDUtilityPoolRequestRedeemed struct { + Caller common.Address + SdToTransfer *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterLiquidationCall is a free log retrieval operation binding the contract event 0xcc9de8be9ac1f02b70a8ca2612f451a769d6d160ad91de17dcc38e54c567a532. +// FilterRequestRedeemed is a free log retrieval operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. // -// Solidity: event LiquidationCall(address indexed account, uint256 totalLiquidationAmountInEth, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth, address indexed liquidator) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterLiquidationCall(opts *bind.FilterOpts, account []common.Address, liquidator []common.Address) (*SDUtilityPoolLiquidationCallIterator, error) { - - var accountRule []interface{} - for _, accountItem := range account { - accountRule = append(accountRule, accountItem) - } - - var liquidatorRule []interface{} - for _, liquidatorItem := range liquidator { - liquidatorRule = append(liquidatorRule, liquidatorItem) - } +// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRequestRedeemed(opts *bind.FilterOpts) (*SDUtilityPoolRequestRedeemedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "LiquidationCall", accountRule, liquidatorRule) + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RequestRedeemed") if err != nil { return nil, err } - return &SDUtilityPoolLiquidationCallIterator{contract: _SDUtilityPool.contract, event: "LiquidationCall", logs: logs, sub: sub}, nil + return &SDUtilityPoolRequestRedeemedIterator{contract: _SDUtilityPool.contract, event: "RequestRedeemed", logs: logs, sub: sub}, nil } -// WatchLiquidationCall is a free log subscription operation binding the contract event 0xcc9de8be9ac1f02b70a8ca2612f451a769d6d160ad91de17dcc38e54c567a532. +// WatchRequestRedeemed is a free log subscription operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. // -// Solidity: event LiquidationCall(address indexed account, uint256 totalLiquidationAmountInEth, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth, address indexed liquidator) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchLiquidationCall(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolLiquidationCall, account []common.Address, liquidator []common.Address) (event.Subscription, error) { - - var accountRule []interface{} - for _, accountItem := range account { - accountRule = append(accountRule, accountItem) - } - - var liquidatorRule []interface{} - for _, liquidatorItem := range liquidator { - liquidatorRule = append(liquidatorRule, liquidatorItem) - } +// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRequestRedeemed(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRequestRedeemed) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "LiquidationCall", accountRule, liquidatorRule) + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RequestRedeemed") if err != nil { return nil, err } @@ -2173,8 +4303,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchLiquidationCall(opts *bind.Wat select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolLiquidationCall) - if err := _SDUtilityPool.contract.UnpackLog(event, "LiquidationCall", log); err != nil { + event := new(SDUtilityPoolRequestRedeemed) + if err := _SDUtilityPool.contract.UnpackLog(event, "RequestRedeemed", log); err != nil { return err } event.Raw = log @@ -2195,21 +4325,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchLiquidationCall(opts *bind.Wat }), nil } -// ParseLiquidationCall is a log parse operation binding the contract event 0xcc9de8be9ac1f02b70a8ca2612f451a769d6d160ad91de17dcc38e54c567a532. +// ParseRequestRedeemed is a log parse operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. // -// Solidity: event LiquidationCall(address indexed account, uint256 totalLiquidationAmountInEth, uint256 liquidationBonusInEth, uint256 liquidationFeeInEth, address indexed liquidator) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseLiquidationCall(log types.Log) (*SDUtilityPoolLiquidationCall, error) { - event := new(SDUtilityPoolLiquidationCall) - if err := _SDUtilityPool.contract.UnpackLog(event, "LiquidationCall", log); err != nil { +// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRequestRedeemed(log types.Log) (*SDUtilityPoolRequestRedeemed, error) { + event := new(SDUtilityPoolRequestRedeemed) + if err := _SDUtilityPool.contract.UnpackLog(event, "RequestRedeemed", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolProtocolFeeFactorUpdatedIterator is returned from FilterProtocolFeeFactorUpdated and is used to iterate over the raw logs and unpacked data for ProtocolFeeFactorUpdated events raised by the SDUtilityPool contract. -type SDUtilityPoolProtocolFeeFactorUpdatedIterator struct { - Event *SDUtilityPoolProtocolFeeFactorUpdated // Event containing the contract specifics and raw log +// SDUtilityPoolRiskConfigUpdatedIterator is returned from FilterRiskConfigUpdated and is used to iterate over the raw logs and unpacked data for RiskConfigUpdated events raised by the SDUtilityPool contract. +type SDUtilityPoolRiskConfigUpdatedIterator struct { + Event *SDUtilityPoolRiskConfigUpdated // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -2223,7 +4353,7 @@ type SDUtilityPoolProtocolFeeFactorUpdatedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Next() bool { +func (it *SDUtilityPoolRiskConfigUpdatedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -2232,7 +4362,7 @@ func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolProtocolFeeFactorUpdated) + it.Event = new(SDUtilityPoolRiskConfigUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2247,7 +4377,7 @@ func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolProtocolFeeFactorUpdated) + it.Event = new(SDUtilityPoolRiskConfigUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2263,41 +4393,44 @@ func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Error() error { +func (it *SDUtilityPoolRiskConfigUpdatedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolProtocolFeeFactorUpdatedIterator) Close() error { +func (it *SDUtilityPoolRiskConfigUpdatedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolProtocolFeeFactorUpdated represents a ProtocolFeeFactorUpdated event raised by the SDUtilityPool contract. -type SDUtilityPoolProtocolFeeFactorUpdated struct { - ProtocolFeeFactor *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolRiskConfigUpdated represents a RiskConfigUpdated event raised by the SDUtilityPool contract. +type SDUtilityPoolRiskConfigUpdated struct { + LiquidationThreshold *big.Int + LiquidationBonusPercent *big.Int + LiquidationFeePercent *big.Int + Ltv *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterProtocolFeeFactorUpdated is a free log retrieval operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. +// FilterRiskConfigUpdated is a free log retrieval operation binding the contract event 0x62dd46f943681bd727e339f4baaa19fb66ea209fbe7d9b4a75aa74c33acc18f3. // -// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterProtocolFeeFactorUpdated(opts *bind.FilterOpts) (*SDUtilityPoolProtocolFeeFactorUpdatedIterator, error) { +// Solidity: event RiskConfigUpdated(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRiskConfigUpdated(opts *bind.FilterOpts) (*SDUtilityPoolRiskConfigUpdatedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "ProtocolFeeFactorUpdated") + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RiskConfigUpdated") if err != nil { return nil, err } - return &SDUtilityPoolProtocolFeeFactorUpdatedIterator{contract: _SDUtilityPool.contract, event: "ProtocolFeeFactorUpdated", logs: logs, sub: sub}, nil + return &SDUtilityPoolRiskConfigUpdatedIterator{contract: _SDUtilityPool.contract, event: "RiskConfigUpdated", logs: logs, sub: sub}, nil } -// WatchProtocolFeeFactorUpdated is a free log subscription operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. +// WatchRiskConfigUpdated is a free log subscription operation binding the contract event 0x62dd46f943681bd727e339f4baaa19fb66ea209fbe7d9b4a75aa74c33acc18f3. // -// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchProtocolFeeFactorUpdated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolProtocolFeeFactorUpdated) (event.Subscription, error) { +// Solidity: event RiskConfigUpdated(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRiskConfigUpdated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRiskConfigUpdated) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "ProtocolFeeFactorUpdated") + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RiskConfigUpdated") if err != nil { return nil, err } @@ -2307,8 +4440,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchProtocolFeeFactorUpdated(opts select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolProtocolFeeFactorUpdated) - if err := _SDUtilityPool.contract.UnpackLog(event, "ProtocolFeeFactorUpdated", log); err != nil { + event := new(SDUtilityPoolRiskConfigUpdated) + if err := _SDUtilityPool.contract.UnpackLog(event, "RiskConfigUpdated", log); err != nil { return err } event.Raw = log @@ -2329,21 +4462,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchProtocolFeeFactorUpdated(opts }), nil } -// ParseProtocolFeeFactorUpdated is a log parse operation binding the contract event 0xba813ee7ea736ec5148f515c7fe651c522fa84413c6c5ce693bd74abade775d3. +// ParseRiskConfigUpdated is a log parse operation binding the contract event 0x62dd46f943681bd727e339f4baaa19fb66ea209fbe7d9b4a75aa74c33acc18f3. // -// Solidity: event ProtocolFeeFactorUpdated(uint256 protocolFeeFactor) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseProtocolFeeFactorUpdated(log types.Log) (*SDUtilityPoolProtocolFeeFactorUpdated, error) { - event := new(SDUtilityPoolProtocolFeeFactorUpdated) - if err := _SDUtilityPool.contract.UnpackLog(event, "ProtocolFeeFactorUpdated", log); err != nil { +// Solidity: event RiskConfigUpdated(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRiskConfigUpdated(log types.Log) (*SDUtilityPoolRiskConfigUpdated, error) { + event := new(SDUtilityPoolRiskConfigUpdated) + if err := _SDUtilityPool.contract.UnpackLog(event, "RiskConfigUpdated", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolRedeemedIterator is returned from FilterRedeemed and is used to iterate over the raw logs and unpacked data for Redeemed events raised by the SDUtilityPool contract. -type SDUtilityPoolRedeemedIterator struct { - Event *SDUtilityPoolRedeemed // Event containing the contract specifics and raw log +// SDUtilityPoolRoleAdminChangedIterator is returned from FilterRoleAdminChanged and is used to iterate over the raw logs and unpacked data for RoleAdminChanged events raised by the SDUtilityPool contract. +type SDUtilityPoolRoleAdminChangedIterator struct { + Event *SDUtilityPoolRoleAdminChanged // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -2357,7 +4490,7 @@ type SDUtilityPoolRedeemedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolRedeemedIterator) Next() bool { +func (it *SDUtilityPoolRoleAdminChangedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -2366,7 +4499,7 @@ func (it *SDUtilityPoolRedeemedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRedeemed) + it.Event = new(SDUtilityPoolRoleAdminChanged) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2381,7 +4514,7 @@ func (it *SDUtilityPoolRedeemedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRedeemed) + it.Event = new(SDUtilityPoolRoleAdminChanged) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2397,53 +4530,69 @@ func (it *SDUtilityPoolRedeemedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolRedeemedIterator) Error() error { +func (it *SDUtilityPoolRoleAdminChangedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolRedeemedIterator) Close() error { +func (it *SDUtilityPoolRoleAdminChangedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolRedeemed represents a Redeemed event raised by the SDUtilityPool contract. -type SDUtilityPoolRedeemed struct { - Delegator common.Address - SdAmount *big.Int - SdXAmount *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolRoleAdminChanged represents a RoleAdminChanged event raised by the SDUtilityPool contract. +type SDUtilityPoolRoleAdminChanged struct { + Role [32]byte + PreviousAdminRole [32]byte + NewAdminRole [32]byte + Raw types.Log // Blockchain specific contextual infos } -// FilterRedeemed is a free log retrieval operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. +// FilterRoleAdminChanged is a free log retrieval operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. // -// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRedeemed(opts *bind.FilterOpts, delegator []common.Address) (*SDUtilityPoolRedeemedIterator, error) { +// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRoleAdminChanged(opts *bind.FilterOpts, role [][32]byte, previousAdminRole [][32]byte, newAdminRole [][32]byte) (*SDUtilityPoolRoleAdminChangedIterator, error) { - var delegatorRule []interface{} - for _, delegatorItem := range delegator { - delegatorRule = append(delegatorRule, delegatorItem) + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var previousAdminRoleRule []interface{} + for _, previousAdminRoleItem := range previousAdminRole { + previousAdminRoleRule = append(previousAdminRoleRule, previousAdminRoleItem) + } + var newAdminRoleRule []interface{} + for _, newAdminRoleItem := range newAdminRole { + newAdminRoleRule = append(newAdminRoleRule, newAdminRoleItem) } - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Redeemed", delegatorRule) + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RoleAdminChanged", roleRule, previousAdminRoleRule, newAdminRoleRule) if err != nil { return nil, err } - return &SDUtilityPoolRedeemedIterator{contract: _SDUtilityPool.contract, event: "Redeemed", logs: logs, sub: sub}, nil + return &SDUtilityPoolRoleAdminChangedIterator{contract: _SDUtilityPool.contract, event: "RoleAdminChanged", logs: logs, sub: sub}, nil } -// WatchRedeemed is a free log subscription operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. +// WatchRoleAdminChanged is a free log subscription operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. // -// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRedeemed(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRedeemed, delegator []common.Address) (event.Subscription, error) { +// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRoleAdminChanged(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRoleAdminChanged, role [][32]byte, previousAdminRole [][32]byte, newAdminRole [][32]byte) (event.Subscription, error) { - var delegatorRule []interface{} - for _, delegatorItem := range delegator { - delegatorRule = append(delegatorRule, delegatorItem) + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var previousAdminRoleRule []interface{} + for _, previousAdminRoleItem := range previousAdminRole { + previousAdminRoleRule = append(previousAdminRoleRule, previousAdminRoleItem) + } + var newAdminRoleRule []interface{} + for _, newAdminRoleItem := range newAdminRole { + newAdminRoleRule = append(newAdminRoleRule, newAdminRoleItem) } - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Redeemed", delegatorRule) + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RoleAdminChanged", roleRule, previousAdminRoleRule, newAdminRoleRule) if err != nil { return nil, err } @@ -2453,8 +4602,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRedeemed(opts *bind.WatchOpts, select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolRedeemed) - if err := _SDUtilityPool.contract.UnpackLog(event, "Redeemed", log); err != nil { + event := new(SDUtilityPoolRoleAdminChanged) + if err := _SDUtilityPool.contract.UnpackLog(event, "RoleAdminChanged", log); err != nil { return err } event.Raw = log @@ -2475,21 +4624,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRedeemed(opts *bind.WatchOpts, }), nil } -// ParseRedeemed is a log parse operation binding the contract event 0xf3a670cd3af7d64b488926880889d08a8585a138ff455227af6737339a1ec262. +// ParseRoleAdminChanged is a log parse operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. // -// Solidity: event Redeemed(address indexed delegator, uint256 sdAmount, uint256 sdXAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRedeemed(log types.Log) (*SDUtilityPoolRedeemed, error) { - event := new(SDUtilityPoolRedeemed) - if err := _SDUtilityPool.contract.UnpackLog(event, "Redeemed", log); err != nil { +// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRoleAdminChanged(log types.Log) (*SDUtilityPoolRoleAdminChanged, error) { + event := new(SDUtilityPoolRoleAdminChanged) + if err := _SDUtilityPool.contract.UnpackLog(event, "RoleAdminChanged", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolRepaidIterator is returned from FilterRepaid and is used to iterate over the raw logs and unpacked data for Repaid events raised by the SDUtilityPool contract. -type SDUtilityPoolRepaidIterator struct { - Event *SDUtilityPoolRepaid // Event containing the contract specifics and raw log +// SDUtilityPoolRoleGrantedIterator is returned from FilterRoleGranted and is used to iterate over the raw logs and unpacked data for RoleGranted events raised by the SDUtilityPool contract. +type SDUtilityPoolRoleGrantedIterator struct { + Event *SDUtilityPoolRoleGranted // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -2503,7 +4652,7 @@ type SDUtilityPoolRepaidIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolRepaidIterator) Next() bool { +func (it *SDUtilityPoolRoleGrantedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -2512,7 +4661,7 @@ func (it *SDUtilityPoolRepaidIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRepaid) + it.Event = new(SDUtilityPoolRoleGranted) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2527,7 +4676,7 @@ func (it *SDUtilityPoolRepaidIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRepaid) + it.Event = new(SDUtilityPoolRoleGranted) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2543,52 +4692,69 @@ func (it *SDUtilityPoolRepaidIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolRepaidIterator) Error() error { +func (it *SDUtilityPoolRoleGrantedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolRepaidIterator) Close() error { +func (it *SDUtilityPoolRoleGrantedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolRepaid represents a Repaid event raised by the SDUtilityPool contract. -type SDUtilityPoolRepaid struct { - Utilizer common.Address - RepayAmount *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolRoleGranted represents a RoleGranted event raised by the SDUtilityPool contract. +type SDUtilityPoolRoleGranted struct { + Role [32]byte + Account common.Address + Sender common.Address + Raw types.Log // Blockchain specific contextual infos } -// FilterRepaid is a free log retrieval operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. +// FilterRoleGranted is a free log retrieval operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. // -// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRepaid(opts *bind.FilterOpts, utilizer []common.Address) (*SDUtilityPoolRepaidIterator, error) { +// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRoleGranted(opts *bind.FilterOpts, role [][32]byte, account []common.Address, sender []common.Address) (*SDUtilityPoolRoleGrantedIterator, error) { - var utilizerRule []interface{} - for _, utilizerItem := range utilizer { - utilizerRule = append(utilizerRule, utilizerItem) + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) } - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Repaid", utilizerRule) + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RoleGranted", roleRule, accountRule, senderRule) if err != nil { return nil, err } - return &SDUtilityPoolRepaidIterator{contract: _SDUtilityPool.contract, event: "Repaid", logs: logs, sub: sub}, nil + return &SDUtilityPoolRoleGrantedIterator{contract: _SDUtilityPool.contract, event: "RoleGranted", logs: logs, sub: sub}, nil } -// WatchRepaid is a free log subscription operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. +// WatchRoleGranted is a free log subscription operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. // -// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRepaid(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRepaid, utilizer []common.Address) (event.Subscription, error) { +// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRoleGranted(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRoleGranted, role [][32]byte, account []common.Address, sender []common.Address) (event.Subscription, error) { - var utilizerRule []interface{} - for _, utilizerItem := range utilizer { - utilizerRule = append(utilizerRule, utilizerItem) + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) } - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Repaid", utilizerRule) + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RoleGranted", roleRule, accountRule, senderRule) if err != nil { return nil, err } @@ -2598,8 +4764,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRepaid(opts *bind.WatchOpts, s select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolRepaid) - if err := _SDUtilityPool.contract.UnpackLog(event, "Repaid", log); err != nil { + event := new(SDUtilityPoolRoleGranted) + if err := _SDUtilityPool.contract.UnpackLog(event, "RoleGranted", log); err != nil { return err } event.Raw = log @@ -2620,21 +4786,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRepaid(opts *bind.WatchOpts, s }), nil } -// ParseRepaid is a log parse operation binding the contract event 0x0516911bcc3a0a7412a44601057c0a0a1ec628bde049a84284bc428866534488. +// ParseRoleGranted is a log parse operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. // -// Solidity: event Repaid(address indexed utilizer, uint256 repayAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRepaid(log types.Log) (*SDUtilityPoolRepaid, error) { - event := new(SDUtilityPoolRepaid) - if err := _SDUtilityPool.contract.UnpackLog(event, "Repaid", log); err != nil { +// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRoleGranted(log types.Log) (*SDUtilityPoolRoleGranted, error) { + event := new(SDUtilityPoolRoleGranted) + if err := _SDUtilityPool.contract.UnpackLog(event, "RoleGranted", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolRequestRedeemedIterator is returned from FilterRequestRedeemed and is used to iterate over the raw logs and unpacked data for RequestRedeemed events raised by the SDUtilityPool contract. -type SDUtilityPoolRequestRedeemedIterator struct { - Event *SDUtilityPoolRequestRedeemed // Event containing the contract specifics and raw log +// SDUtilityPoolRoleRevokedIterator is returned from FilterRoleRevoked and is used to iterate over the raw logs and unpacked data for RoleRevoked events raised by the SDUtilityPool contract. +type SDUtilityPoolRoleRevokedIterator struct { + Event *SDUtilityPoolRoleRevoked // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -2648,7 +4814,7 @@ type SDUtilityPoolRequestRedeemedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { +func (it *SDUtilityPoolRoleRevokedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -2657,7 +4823,7 @@ func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRequestRedeemed) + it.Event = new(SDUtilityPoolRoleRevoked) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2672,7 +4838,7 @@ func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRequestRedeemed) + it.Event = new(SDUtilityPoolRoleRevoked) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2688,42 +4854,69 @@ func (it *SDUtilityPoolRequestRedeemedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolRequestRedeemedIterator) Error() error { +func (it *SDUtilityPoolRoleRevokedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolRequestRedeemedIterator) Close() error { +func (it *SDUtilityPoolRoleRevokedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolRequestRedeemed represents a RequestRedeemed event raised by the SDUtilityPool contract. -type SDUtilityPoolRequestRedeemed struct { - Caller common.Address - SdToTransfer *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolRoleRevoked represents a RoleRevoked event raised by the SDUtilityPool contract. +type SDUtilityPoolRoleRevoked struct { + Role [32]byte + Account common.Address + Sender common.Address + Raw types.Log // Blockchain specific contextual infos } -// FilterRequestRedeemed is a free log retrieval operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. +// FilterRoleRevoked is a free log retrieval operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. // -// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRequestRedeemed(opts *bind.FilterOpts) (*SDUtilityPoolRequestRedeemedIterator, error) { +// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRoleRevoked(opts *bind.FilterOpts, role [][32]byte, account []common.Address, sender []common.Address) (*SDUtilityPoolRoleRevokedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RequestRedeemed") + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RoleRevoked", roleRule, accountRule, senderRule) if err != nil { return nil, err } - return &SDUtilityPoolRequestRedeemedIterator{contract: _SDUtilityPool.contract, event: "RequestRedeemed", logs: logs, sub: sub}, nil + return &SDUtilityPoolRoleRevokedIterator{contract: _SDUtilityPool.contract, event: "RoleRevoked", logs: logs, sub: sub}, nil } -// WatchRequestRedeemed is a free log subscription operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. +// WatchRoleRevoked is a free log subscription operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. // -// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRequestRedeemed(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRequestRedeemed) (event.Subscription, error) { +// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRoleRevoked(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRoleRevoked, role [][32]byte, account []common.Address, sender []common.Address) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RequestRedeemed") + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RoleRevoked", roleRule, accountRule, senderRule) if err != nil { return nil, err } @@ -2733,8 +4926,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRequestRedeemed(opts *bind.Wat select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolRequestRedeemed) - if err := _SDUtilityPool.contract.UnpackLog(event, "RequestRedeemed", log); err != nil { + event := new(SDUtilityPoolRoleRevoked) + if err := _SDUtilityPool.contract.UnpackLog(event, "RoleRevoked", log); err != nil { return err } event.Raw = log @@ -2755,21 +4948,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRequestRedeemed(opts *bind.Wat }), nil } -// ParseRequestRedeemed is a log parse operation binding the contract event 0xf7aca15eb385953329daa8e235ce29ead201e26c1e36e1083d929821401bb7d2. +// ParseRoleRevoked is a log parse operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. // -// Solidity: event RequestRedeemed(address caller, uint256 sdToTransfer) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRequestRedeemed(log types.Log) (*SDUtilityPoolRequestRedeemed, error) { - event := new(SDUtilityPoolRequestRedeemed) - if err := _SDUtilityPool.contract.UnpackLog(event, "RequestRedeemed", log); err != nil { +// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRoleRevoked(log types.Log) (*SDUtilityPoolRoleRevoked, error) { + event := new(SDUtilityPoolRoleRevoked) + if err := _SDUtilityPool.contract.UnpackLog(event, "RoleRevoked", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolRiskConfigUpdatedIterator is returned from FilterRiskConfigUpdated and is used to iterate over the raw logs and unpacked data for RiskConfigUpdated events raised by the SDUtilityPool contract. -type SDUtilityPoolRiskConfigUpdatedIterator struct { - Event *SDUtilityPoolRiskConfigUpdated // Event containing the contract specifics and raw log +// SDUtilityPoolSDUtilizedIterator is returned from FilterSDUtilized and is used to iterate over the raw logs and unpacked data for SDUtilized events raised by the SDUtilityPool contract. +type SDUtilityPoolSDUtilizedIterator struct { + Event *SDUtilityPoolSDUtilized // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -2783,7 +4976,7 @@ type SDUtilityPoolRiskConfigUpdatedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolRiskConfigUpdatedIterator) Next() bool { +func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -2792,7 +4985,7 @@ func (it *SDUtilityPoolRiskConfigUpdatedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRiskConfigUpdated) + it.Event = new(SDUtilityPoolSDUtilized) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2807,7 +5000,7 @@ func (it *SDUtilityPoolRiskConfigUpdatedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolRiskConfigUpdated) + it.Event = new(SDUtilityPoolSDUtilized) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2823,44 +5016,42 @@ func (it *SDUtilityPoolRiskConfigUpdatedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolRiskConfigUpdatedIterator) Error() error { +func (it *SDUtilityPoolSDUtilizedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolRiskConfigUpdatedIterator) Close() error { +func (it *SDUtilityPoolSDUtilizedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolRiskConfigUpdated represents a RiskConfigUpdated event raised by the SDUtilityPool contract. -type SDUtilityPoolRiskConfigUpdated struct { - LiquidationThreshold *big.Int - LiquidationBonusPercent *big.Int - LiquidationFeePercent *big.Int - Ltv *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolSDUtilized represents a SDUtilized event raised by the SDUtilityPool contract. +type SDUtilityPoolSDUtilized struct { + Utilizer common.Address + UtilizeAmount *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterRiskConfigUpdated is a free log retrieval operation binding the contract event 0x62dd46f943681bd727e339f4baaa19fb66ea209fbe7d9b4a75aa74c33acc18f3. +// FilterSDUtilized is a free log retrieval operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. // -// Solidity: event RiskConfigUpdated(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterRiskConfigUpdated(opts *bind.FilterOpts) (*SDUtilityPoolRiskConfigUpdatedIterator, error) { +// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterSDUtilized(opts *bind.FilterOpts) (*SDUtilityPoolSDUtilizedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "RiskConfigUpdated") + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "SDUtilized") if err != nil { return nil, err } - return &SDUtilityPoolRiskConfigUpdatedIterator{contract: _SDUtilityPool.contract, event: "RiskConfigUpdated", logs: logs, sub: sub}, nil + return &SDUtilityPoolSDUtilizedIterator{contract: _SDUtilityPool.contract, event: "SDUtilized", logs: logs, sub: sub}, nil } -// WatchRiskConfigUpdated is a free log subscription operation binding the contract event 0x62dd46f943681bd727e339f4baaa19fb66ea209fbe7d9b4a75aa74c33acc18f3. +// WatchSDUtilized is a free log subscription operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. // -// Solidity: event RiskConfigUpdated(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRiskConfigUpdated(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolRiskConfigUpdated) (event.Subscription, error) { +// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchSDUtilized(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolSDUtilized) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "RiskConfigUpdated") + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "SDUtilized") if err != nil { return nil, err } @@ -2870,8 +5061,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRiskConfigUpdated(opts *bind.W select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolRiskConfigUpdated) - if err := _SDUtilityPool.contract.UnpackLog(event, "RiskConfigUpdated", log); err != nil { + event := new(SDUtilityPoolSDUtilized) + if err := _SDUtilityPool.contract.UnpackLog(event, "SDUtilized", log); err != nil { return err } event.Raw = log @@ -2892,21 +5083,21 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchRiskConfigUpdated(opts *bind.W }), nil } -// ParseRiskConfigUpdated is a log parse operation binding the contract event 0x62dd46f943681bd727e339f4baaa19fb66ea209fbe7d9b4a75aa74c33acc18f3. +// ParseSDUtilized is a log parse operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. // -// Solidity: event RiskConfigUpdated(uint256 liquidationThreshold, uint256 liquidationBonusPercent, uint256 liquidationFeePercent, uint256 ltv) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseRiskConfigUpdated(log types.Log) (*SDUtilityPoolRiskConfigUpdated, error) { - event := new(SDUtilityPoolRiskConfigUpdated) - if err := _SDUtilityPool.contract.UnpackLog(event, "RiskConfigUpdated", log); err != nil { +// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseSDUtilized(log types.Log) (*SDUtilityPoolSDUtilized, error) { + event := new(SDUtilityPoolSDUtilized) + if err := _SDUtilityPool.contract.UnpackLog(event, "SDUtilized", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SDUtilityPoolSDUtilizedIterator is returned from FilterSDUtilized and is used to iterate over the raw logs and unpacked data for SDUtilized events raised by the SDUtilityPool contract. -type SDUtilityPoolSDUtilizedIterator struct { - Event *SDUtilityPoolSDUtilized // Event containing the contract specifics and raw log +// SDUtilityPoolUnpausedIterator is returned from FilterUnpaused and is used to iterate over the raw logs and unpacked data for Unpaused events raised by the SDUtilityPool contract. +type SDUtilityPoolUnpausedIterator struct { + Event *SDUtilityPoolUnpaused // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -2920,7 +5111,7 @@ type SDUtilityPoolSDUtilizedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { +func (it *SDUtilityPoolUnpausedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -2929,7 +5120,7 @@ func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SDUtilityPoolSDUtilized) + it.Event = new(SDUtilityPoolUnpaused) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2944,7 +5135,7 @@ func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SDUtilityPoolSDUtilized) + it.Event = new(SDUtilityPoolUnpaused) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2960,42 +5151,41 @@ func (it *SDUtilityPoolSDUtilizedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SDUtilityPoolSDUtilizedIterator) Error() error { +func (it *SDUtilityPoolUnpausedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SDUtilityPoolSDUtilizedIterator) Close() error { +func (it *SDUtilityPoolUnpausedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SDUtilityPoolSDUtilized represents a SDUtilized event raised by the SDUtilityPool contract. -type SDUtilityPoolSDUtilized struct { - Utilizer common.Address - UtilizeAmount *big.Int - Raw types.Log // Blockchain specific contextual infos +// SDUtilityPoolUnpaused represents a Unpaused event raised by the SDUtilityPool contract. +type SDUtilityPoolUnpaused struct { + Account common.Address + Raw types.Log // Blockchain specific contextual infos } -// FilterSDUtilized is a free log retrieval operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. +// FilterUnpaused is a free log retrieval operation binding the contract event 0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa. // -// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) FilterSDUtilized(opts *bind.FilterOpts) (*SDUtilityPoolSDUtilizedIterator, error) { +// Solidity: event Unpaused(address account) +func (_SDUtilityPool *SDUtilityPoolFilterer) FilterUnpaused(opts *bind.FilterOpts) (*SDUtilityPoolUnpausedIterator, error) { - logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "SDUtilized") + logs, sub, err := _SDUtilityPool.contract.FilterLogs(opts, "Unpaused") if err != nil { return nil, err } - return &SDUtilityPoolSDUtilizedIterator{contract: _SDUtilityPool.contract, event: "SDUtilized", logs: logs, sub: sub}, nil + return &SDUtilityPoolUnpausedIterator{contract: _SDUtilityPool.contract, event: "Unpaused", logs: logs, sub: sub}, nil } -// WatchSDUtilized is a free log subscription operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. +// WatchUnpaused is a free log subscription operation binding the contract event 0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa. // -// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) WatchSDUtilized(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolSDUtilized) (event.Subscription, error) { +// Solidity: event Unpaused(address account) +func (_SDUtilityPool *SDUtilityPoolFilterer) WatchUnpaused(opts *bind.WatchOpts, sink chan<- *SDUtilityPoolUnpaused) (event.Subscription, error) { - logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "SDUtilized") + logs, sub, err := _SDUtilityPool.contract.WatchLogs(opts, "Unpaused") if err != nil { return nil, err } @@ -3005,8 +5195,8 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchSDUtilized(opts *bind.WatchOpt select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SDUtilityPoolSDUtilized) - if err := _SDUtilityPool.contract.UnpackLog(event, "SDUtilized", log); err != nil { + event := new(SDUtilityPoolUnpaused) + if err := _SDUtilityPool.contract.UnpackLog(event, "Unpaused", log); err != nil { return err } event.Raw = log @@ -3027,12 +5217,12 @@ func (_SDUtilityPool *SDUtilityPoolFilterer) WatchSDUtilized(opts *bind.WatchOpt }), nil } -// ParseSDUtilized is a log parse operation binding the contract event 0x29f5a3c94649e9fd569197488f431f12d8b1fe681596964128403511823a6386. +// ParseUnpaused is a log parse operation binding the contract event 0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa. // -// Solidity: event SDUtilized(address utilizer, uint256 utilizeAmount) -func (_SDUtilityPool *SDUtilityPoolFilterer) ParseSDUtilized(log types.Log) (*SDUtilityPoolSDUtilized, error) { - event := new(SDUtilityPoolSDUtilized) - if err := _SDUtilityPool.contract.UnpackLog(event, "SDUtilized", log); err != nil { +// Solidity: event Unpaused(address account) +func (_SDUtilityPool *SDUtilityPoolFilterer) ParseUnpaused(log types.Log) (*SDUtilityPoolUnpaused, error) { + event := new(SDUtilityPoolUnpaused) + if err := _SDUtilityPool.contract.UnpackLog(event, "Unpaused", log); err != nil { return nil, err } event.Raw = log diff --git a/stader-lib/sdutility/sd-utility.go b/stader-lib/sdutility/sd-utility.go index 4f3e96512..486481b81 100644 --- a/stader-lib/sdutility/sd-utility.go +++ b/stader-lib/sdutility/sd-utility.go @@ -66,10 +66,18 @@ func EstimateRepay(sp *stader.SDUtilityPoolContractManager, utilityAmount *big.I return sp.SDUtilityPoolContract.GetTransactionGasInfo(opts, "repay", utilityAmount) } +func EstimateRepayFullAmount(sp *stader.SDUtilityPoolContractManager, opts *bind.TransactOpts) (stader.GasInfo, error) { + return sp.SDUtilityPoolContract.GetTransactionGasInfo(opts, "repayFullAmount") +} + func Repay(sp *stader.SDUtilityPoolContractManager, utilityAmount *big.Int, opts *bind.TransactOpts) (*types.Transaction, error) { return sp.SDUtilityPool.Repay(opts, utilityAmount) } +func RepayFullAmount(sp *stader.SDUtilityPoolContractManager, opts *bind.TransactOpts) (*types.Transaction, error) { + return sp.SDUtilityPool.RepayFullAmount(opts) +} + func SDMaxUtilizableAmount(sp *stader.SDUtilityPoolContractManager, sdc *stader.SdCollateralContractManager, numValidators *big.Int, opts *bind.CallOpts) (*big.Int, error) { maxThreshold, err := sp.SDUtilityPool.MaxETHWorthOfSDPerValidator(opts) diff --git a/stader/api/node/claim-rewards.go b/stader/api/node/claim-rewards.go index 193187c54..e06a85671 100644 --- a/stader/api/node/claim-rewards.go +++ b/stader/api/node/claim-rewards.go @@ -24,10 +24,6 @@ func CanClaimRewards(c *cli.Context) (*api.CanClaimRewards, error) { if err != nil { return nil, err } - pnr, err := services.GetPermissionlessNodeRegistry(c) - if err != nil { - return nil, err - } nodeAccount, err := w.GetNodeAccount() if err != nil { return nil, err @@ -35,23 +31,6 @@ func CanClaimRewards(c *cli.Context) (*api.CanClaimRewards, error) { response := api.CanClaimRewards{} - operatorId, err := node.GetOperatorId(pnr, nodeAccount.Address, nil) - if err != nil { - return nil, err - } - - totalValidatorKeys, err := node.GetTotalValidatorKeys(pnr, operatorId, nil) - if err != nil { - return nil, err - } - - nonTerminalValidatorKeys, err := node.GetTotalNonTerminalValidatorKeys(pnr, nodeAccount.Address, totalValidatorKeys, nil) - if err != nil { - return nil, err - } - - response.NonTerminalValidators = nonTerminalValidatorKeys - operatorClaimVaultBalance, err := node.GetOperatorRewardsCollectorBalance(orc, nodeAccount.Address, nil) if err != nil { return nil, err @@ -145,18 +124,8 @@ func ClaimRewards(c *cli.Context) (*api.ClaimRewards, error) { return nil, err } - totalValidatorKeys, err := node.GetTotalValidatorKeys(pnr, operatorId, nil) - if err != nil { - return nil, err - } - - nonTerminalValidatorKeys, err := node.GetTotalNonTerminalValidatorKeys(pnr, nodeAccount.Address, totalValidatorKeys, nil) - if err != nil { - return nil, err - } - totalWithdrawableEth := operatorRewardsBalance - if operatorRewardsBalance.Cmp(withdrawableInEth) > 0 && nonTerminalValidatorKeys != 0 { + if operatorRewardsBalance.Cmp(withdrawableInEth) > 0 { totalWithdrawableEth = withdrawableInEth } diff --git a/stader/api/node/repay-sd.go b/stader/api/node/repay-sd.go index 1ac042490..15ebc3840 100644 --- a/stader/api/node/repay-sd.go +++ b/stader/api/node/repay-sd.go @@ -3,7 +3,10 @@ package node import ( "math/big" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/core/types" "github.com/stader-labs/stader-node/stader-lib/sdutility" + "github.com/stader-labs/stader-node/stader-lib/stader" "github.com/urfave/cli" @@ -30,15 +33,26 @@ func canRepaySD(c *cli.Context, amountWei *big.Int) (*api.CanRepaySDResponse, er return nil, err } + isAmountMaxUint256 := amountWei.Cmp(abi.MaxUint256) == 0 + // Get gas estimates opts, err := w.GetNodeAccountTransactor() if err != nil { return nil, err } - gasInfo, err := sdutility.EstimateRepay(sdu, amountWei, opts) - if err != nil { - return nil, err + var gasInfo stader.GasInfo + + if isAmountMaxUint256 { + gasInfo, err = sdutility.EstimateRepayFullAmount(sdu, opts) + if err != nil { + return nil, err + } + } else { + gasInfo, err = sdutility.EstimateRepay(sdu, amountWei, opts) + if err != nil { + return nil, err + } } response.GasInfo = gasInfo @@ -68,12 +82,22 @@ func repaySD(c *cli.Context, amountWei *big.Int) (*api.NodeRepaySDResponse, erro return nil, err } + isAmountMaxUint256 := amountWei.Cmp(abi.MaxUint256) == 0 + // Response response := api.NodeRepaySDResponse{} - tx, err := sdutility.Repay(sdu, amountWei, opts) - if err != nil { - return nil, err + var tx *types.Transaction + if isAmountMaxUint256 { + tx, err = sdutility.RepayFullAmount(sdu, opts) + if err != nil { + return nil, err + } + } else { + tx, err = sdutility.Repay(sdu, amountWei, opts) + if err != nil { + return nil, err + } } response.TxHash = tx.Hash() diff --git a/stader/api/node/status.go b/stader/api/node/status.go index b410a03a3..b75a0f141 100644 --- a/stader/api/node/status.go +++ b/stader/api/node/status.go @@ -114,7 +114,6 @@ func getStatus(c *cli.Context) (*api.NodeStatusResponse, error) { // Response response := api.NodeStatusResponse{} - //fmt.Printf("Getting node account...\n") nodeAccount, err := w.GetNodeAccount() if err != nil { return nil, err @@ -122,12 +121,10 @@ func getStatus(c *cli.Context) (*api.NodeStatusResponse, error) { response.AccountAddress = nodeAccount.Address - //fmt.Printf("Getting node account balances...\n") accountEthBalance, err := tokens.GetEthBalance(pnr.Client, nodeAccount.Address, nil) if err != nil { return nil, err } - //fmt.Printf("Getting node account SD balance...\n") accountSdBalance, err := tokens.BalanceOf(sdt, nodeAccount.Address, nil) if err != nil { return nil, err @@ -136,19 +133,16 @@ func getStatus(c *cli.Context) (*api.NodeStatusResponse, error) { response.AccountBalances.ETH = accountEthBalance response.AccountBalances.Sd = accountSdBalance - //fmt.Printf("Getting socializing pool address...\n") socializingPoolAddress, err := stader_config.GetSocializingPoolContractAddress(sdcfg, nil) if err != nil { return nil, err } response.SocializingPoolAddress = socializingPoolAddress - //fmt.Printf("Getting operator id...\n") operatorId, err := node.GetOperatorId(pnr, nodeAccount.Address, nil) if err != nil { return nil, err } - //fmt.Printf("Getting operator info...\n") operatorRegistry, err := node.GetOperatorInfo(pnr, operatorId, nil) if err != nil { return nil, err @@ -163,18 +157,15 @@ func getStatus(c *cli.Context) (*api.NodeStatusResponse, error) { response.OperatorRewardAddress = operatorRegistry.OperatorRewardAddress response.OptedInForSocializingPool = operatorRegistry.OptedForSocializingPool - //fmt.Printf("Getting operator node el reward balance\n") // non socializing pool fee recepient operatorElRewardAddress, err := node.GetNodeElRewardAddress(pnr, 1, operatorId, nil) if err != nil { return nil, err } - //fmt.Printf("Getting operator node el reward balance\n") elRewardAddressBalance, err := tokens.GetEthBalance(pnr.Client, operatorElRewardAddress, nil) if err != nil { return nil, err } - //fmt.Printf("Getting operator node el reward share\n") operatorElRewards, err := pool_utils.CalculateRewardShare(putils, 1, elRewardAddressBalance, nil) if err != nil { return nil, err @@ -194,14 +185,12 @@ func getStatus(c *cli.Context) (*api.NodeStatusResponse, error) { } response.OperatorWithdrawableEth = operatorWithdrawableEth - //fmt.Printf("Getting operator reward address balance\n") operatorReward, err := tokens.GetEthBalance(pnr.Client, operatorRegistry.OperatorRewardAddress, nil) if err != nil { return nil, err } response.OperatorRewardInETH = operatorReward - //fmt.Printf("getting operator sd collateral balance\n") // get operator deposited sd collateral operatorSdCollateral, err := sd_collateral.GetOperatorSdBalance(sdc, nodeAccount.Address, nil) if err != nil { @@ -209,7 +198,6 @@ func getStatus(c *cli.Context) (*api.NodeStatusResponse, error) { } response.DepositedSdCollateral = operatorSdCollateral - //fmt.Printf("getting operator sd collateral worth validators\n") // total registerable validators totalSdWorthValidators, err := sd_collateral.GetMaxValidatorSpawnable(sdc, operatorSdCollateral, 1, nil) if err != nil { @@ -217,7 +205,6 @@ func getStatus(c *cli.Context) (*api.NodeStatusResponse, error) { } response.SdCollateralWorthValidators = totalSdWorthValidators - //fmt.Printf("Getting reward details\n") rewardCycleDetails, err := socializing_pool.GetRewardDetails(sp, nil) if err != nil { return nil, err @@ -226,18 +213,15 @@ func getStatus(c *cli.Context) (*api.NodeStatusResponse, error) { socializingPoolStartTimestamp := time.Now() response.SocializingPoolStartTime = socializingPoolStartTimestamp - //fmt.Printf("Get total validator keys\n") totalValidatorKeys, err := node.GetTotalValidatorKeys(pnr, operatorId, nil) if err != nil { return nil, err } - //fmt.Printf("Get total non terminal validator keys\n") totalNonTerminalValidatorKeys, err := node.GetTotalNonTerminalValidatorKeys(pnr, nodeAccount.Address, totalValidatorKeys, nil) if err != nil { return nil, err } - //fmt.Printf("Total non terminal validators %d\n", totalNonTerminalValidatorKeys) response.TotalNonTerminalValidators = big.NewInt(int64(totalNonTerminalValidatorKeys)) @@ -320,7 +304,6 @@ func getStatus(c *cli.Context) (*api.NodeStatusResponse, error) { response.ValidatorInfos = validatorInfoArray response.TotalValidatorClRewards = totalValidatorClRewards - //fmt.Printf("Getting operator claimed and unclaimed socializing pool merkles\n") claimedMerkles, unclaimedMerkles, err := GetClaimedAndUnclaimedSocializingPoolMerkles(c) if err != nil { return nil, err From 555849cfa0134a07f82e701dc950ee81475ef842 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Mon, 26 Feb 2024 21:39:04 +0700 Subject: [PATCH 155/159] Refactor --- .golangci.yml | 4 +--- shared/services/bc-manager.go | 1 + .../services/beacon/client/std-http-client.go | 9 ++++++-- shared/services/config/stader-config.go | 1 + shared/services/ec-manager.go | 4 ++-- shared/services/stader/node.go | 8 +++++++ shared/services/wallet/node.go | 2 +- shared/utils/stader/node-diversity.go | 1 - stader-cli/node/claim-rewards.go | 2 ++ stader-cli/node/claim-sp-rewards.go | 22 ++++++++++++++----- stader-cli/node/commands.go | 5 +---- stader-cli/node/deposit-sd.go | 1 + stader-cli/node/repay-sd.go | 4 +++- stader-cli/node/send-el-rewards.go | 2 ++ stader-cli/node/status.go | 4 +++- stader-cli/node/utilize-sd.go | 1 - stader-cli/validator/deposit.go | 12 +++++----- stader-cli/wallet/export.go | 2 +- stader-lib/node/validator.go | 8 +++---- stader-lib/sdutility/sd-utility.go | 8 ++++++- stader-lib/socializing-pool/rewards.go | 4 ++-- stader-lib/utils/eth/units.go | 3 +++ stader-lib/utils/sd/sd.go | 9 +++----- stader/api/node/claim-rewards.go | 7 +++--- stader/api/node/claim-sp-rewards.go | 2 +- stader/api/node/deposit-sd.go | 3 +++ stader/api/node/get-contracts-info.go | 10 +++++++++ stader/api/node/status.go | 1 + stader/api/node/utility-sd.go | 5 +++-- stader/api/validator/deposit.go | 4 ++-- .../guardian/collector/network-collector.go | 3 +-- .../guardian/collector/operator-collector.go | 6 ++--- stader/node/node.go | 1 - 33 files changed, 103 insertions(+), 56 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index aa68692b2..ed4f24cf0 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -13,8 +13,6 @@ linters-settings: - style govet: check-shadowing: true - enable: - - fieldalignment nolintlint: require-explanation: true require-specific: true @@ -33,7 +31,7 @@ linters: - gocritic - gofmt - goimports - - gocyclo + # - gocyclo - gosec - gosimple - govet diff --git a/shared/services/bc-manager.go b/shared/services/bc-manager.go index 6ff1b1147..1582123c8 100644 --- a/shared/services/bc-manager.go +++ b/shared/services/bc-manager.go @@ -141,6 +141,7 @@ func (m *BeaconClientManager) GetNodeVersion() (beacon.NodeVersion, error) { if err != nil { return beacon.NodeVersion{}, err } + return result.(beacon.NodeVersion), nil } diff --git a/shared/services/beacon/client/std-http-client.go b/shared/services/beacon/client/std-http-client.go index 34ed242d9..f3f6f9325 100644 --- a/shared/services/beacon/client/std-http-client.go +++ b/shared/services/beacon/client/std-http-client.go @@ -423,10 +423,12 @@ func (c *StandardHttpClient) GetValidatorIndex(pubkey types.ValidatorPubkey) (ui // Get domain data for a domain type at a given epoch func (c *StandardHttpClient) GetExitDomainData(domainType []byte, network config.Network) ([]byte, error) { - var genesis GenesisResponse genesis, err := c.getGenesis() + if err != nil { + return []byte{}, fmt.Errorf("GetGenesis %w", err) + } // Get fork version var capellaForkVersion string @@ -445,8 +447,8 @@ func (c *StandardHttpClient) GetExitDomainData(domainType []byte, network config // Compute & return domain var dt [4]byte copy(dt[:], domainType[:]) - return eth2types.Domain(dt, decodedForkVersion, genesis.Data.GenesisValidatorsRoot), nil + return eth2types.Domain(dt, decodedForkVersion, genesis.Data.GenesisValidatorsRoot), nil } // Perform a voluntary exit on a validator @@ -589,13 +591,16 @@ func (c *StandardHttpClient) getNodeVersion() (NodeVersionResponse, error) { if err != nil { return NodeVersionResponse{}, fmt.Errorf("Could not get node sync status: %w", err) } + if status != http.StatusOK { return NodeVersionResponse{}, fmt.Errorf("Could not get node sync status: HTTP status %d; response body: '%s'", status, string(responseBody)) } + var nodeVersion NodeVersionResponse if err := json.Unmarshal(responseBody, &nodeVersion); err != nil { return NodeVersionResponse{}, fmt.Errorf("Could not decode node sync status: %w", err) } + return nodeVersion, nil } diff --git a/shared/services/config/stader-config.go b/shared/services/config/stader-config.go index 0fce3fd35..474f0b8cc 100644 --- a/shared/services/config/stader-config.go +++ b/shared/services/config/stader-config.go @@ -986,6 +986,7 @@ func (cfg *StaderConfig) GenerateEnvironmentVariables() map[string]string { envVars["PROMETHEUS_ADDITIONAL_FLAGS"] = fmt.Sprintf(", \"%s\"", cfg.Prometheus.AdditionalFlags.Value.(string)) } } + if cfg.ExposeGuardianPort.Value == true { envVars["GUARDIAN_OPEN_PORTS"] = fmt.Sprintf("%d:%d/tcp", cfg.NodeMetricsPort.Value, cfg.NodeMetricsPort.Value) } diff --git a/shared/services/ec-manager.go b/shared/services/ec-manager.go index b3216279a..f61769ff8 100644 --- a/shared/services/ec-manager.go +++ b/shared/services/ec-manager.go @@ -541,12 +541,12 @@ func (p *ExecutionClientManager) Version() (string, error) { Jsonrpc string `json:"jsonrpc"` Method string `json:"method"` Params []string `json:"params"` - Id int64 `json:"id"` + ID int64 `json:"id"` }{ Jsonrpc: "2.0", Method: "web3_clientVersion", Params: []string{}, - Id: 1, + ID: 1, } res, err := net.MakePostRequest(url, payload) diff --git a/shared/services/stader/node.go b/shared/services/stader/node.go index 2febd65db..e3b26ff89 100644 --- a/shared/services/stader/node.go +++ b/shared/services/stader/node.go @@ -118,10 +118,12 @@ func (c *Client) NodeSdApprovalGas(amountWei *big.Int, address common.Address) ( if err != nil { return api.SdApproveGasResponse{}, fmt.Errorf("could not get new SD approval gas: %w", err) } + var response api.SdApproveGasResponse if err := json.Unmarshal(responseBytes, &response); err != nil { return api.SdApproveGasResponse{}, fmt.Errorf("could not decode node deposit S approve gas response: %w", err) } + if response.Error != "" { return api.SdApproveGasResponse{}, fmt.Errorf("could not get new SD approval gas: %s", response.Error) } @@ -134,13 +136,16 @@ func (c *Client) NodeSdApprove(amountWei *big.Int, address common.Address) (api. if err != nil { return api.SdApproveResponse{}, fmt.Errorf("could not approve SD for staking: %w", err) } + var response api.SdApproveResponse if err := json.Unmarshal(responseBytes, &response); err != nil { return api.SdApproveResponse{}, fmt.Errorf("could not decode deposit node SD approve response: %w", err) } + if response.Error != "" { return api.SdApproveResponse{}, fmt.Errorf("could not approve SD for staking: %s", response.Error) } + return response, nil } @@ -196,13 +201,16 @@ func (c *Client) GetNodeSdAllowance(contractAddress common.Address) (api.SdAllow if err != nil { return api.SdAllowanceResponse{}, fmt.Errorf("could not get node deposit SD allowance: %w", err) } + var response api.SdAllowanceResponse if err := json.Unmarshal(responseBytes, &response); err != nil { return api.SdAllowanceResponse{}, fmt.Errorf("could not decode node deposit SD allowance response: %w", err) } + if response.Error != "" { return api.SdAllowanceResponse{}, fmt.Errorf("could not get node deposit SD allowance: %s", response.Error) } + return response, nil } diff --git a/shared/services/wallet/node.go b/shared/services/wallet/node.go index 695282175..28a285774 100644 --- a/shared/services/wallet/node.go +++ b/shared/services/wallet/node.go @@ -190,7 +190,6 @@ func (w *Wallet) getNodeDerivedKey(index uint) (*hdkeychain.ExtendedKey, string, // Get the node hex encoding public key func (w *Wallet) GetNodePubkey() (string, error) { - // Check wallet is initialized if !w.IsInitialized() { return "", errors.New("Wallet is not initialized") @@ -204,6 +203,7 @@ func (w *Wallet) GetNodePubkey() (string, error) { // Get public key publicKey := privateKey.Public() + publicKeyECDSA, ok := publicKey.(*ecdsa.PublicKey) if !ok { return "", errors.New("Could not get node public key") diff --git a/shared/utils/stader/node-diversity.go b/shared/utils/stader/node-diversity.go index 6902c4080..b42957d6e 100644 --- a/shared/utils/stader/node-diversity.go +++ b/shared/utils/stader/node-diversity.go @@ -33,5 +33,4 @@ func SendNodeDiversityResponseType( } return &resp, nil - } diff --git a/stader-cli/node/claim-rewards.go b/stader-cli/node/claim-rewards.go index 3161cd8d0..66e9c1068 100644 --- a/stader-cli/node/claim-rewards.go +++ b/stader-cli/node/claim-rewards.go @@ -79,8 +79,10 @@ func ClaimRewards(c *cli.Context) error { if err != nil { return err } + fmt.Printf("Withdrawing %s Rewards to Operator Reward Address: %s\n\n", eth.DisplayAmountInUnits(res.RewardsClaimed, "eth"), res.OperatorRewardAddress) cliutils.PrintTransactionHash(staderClient, res.TxHash) + if _, err = staderClient.WaitForTransaction(res.TxHash); err != nil { return err } diff --git a/stader-cli/node/claim-sp-rewards.go b/stader-cli/node/claim-sp-rewards.go index 18d290084..e8bec40e3 100644 --- a/stader-cli/node/claim-sp-rewards.go +++ b/stader-cli/node/claim-sp-rewards.go @@ -82,11 +82,14 @@ func ClaimSpRewards(c *cli.Context) error { if !ok { return fmt.Errorf("Unable to parse eth rewards: %s", cycleInfo.MerkleProofInfo.Eth) } + ethRewardsConverted := math.RoundDown(eth.WeiToEth(ethRewards), 5) + sdRewards, ok := big.NewInt(0).SetString(cycleInfo.MerkleProofInfo.Sd, 10) if !ok { return fmt.Errorf("Unable to parse sd rewards: %s", cycleInfo.MerkleProofInfo.Sd) } + sdRewardsConverted := math.RoundDown(eth.WeiToEth(sdRewards), 5) if ethRewards.Cmp(big.NewInt(0)) == 0 && sdRewards.Cmp(big.NewInt(0)) == 0 { @@ -142,21 +145,27 @@ func ClaimSpRewards(c *cli.Context) error { totalClaimableEth := big.NewInt(0) totalClaimableSd := big.NewInt(0) + for _, cycle := range cyclesToClaimArray { cycleInfo := indexedDetailedCyclesInfo[cycle.Int64()] + ethRewards, ok := big.NewInt(0).SetString(cycleInfo.Eth, 10) if !ok { return fmt.Errorf("Unable to parse eth rewards: %s", cycleInfo.Eth) } + totalClaimableEth = totalClaimableEth.Add(totalClaimableEth, ethRewards) + sdRewards, ok := big.NewInt(0).SetString(cycleInfo.Sd, 10) if !ok { return fmt.Errorf("Unable to parse sd rewards: %s", cycleInfo.Sd) } + totalClaimableSd = totalClaimableSd.Add(totalClaimableSd, sdRewards) } depositSd := false + if totalClaimableSd.Cmp(big.NewInt(0)) > 0 { fmt.Printf("You will claim %s and %s with the following selection - cycles %v\n\n", eth.DisplayAmountInUnits(totalClaimableSd, "sd"), eth.DisplayAmountInUnits(totalClaimableEth, "eth"), cyclesToClaimArray) fmt.Printf("Your ETH rewards will be sent to your Reward Address\n") @@ -179,18 +188,18 @@ func ClaimSpRewards(c *cli.Context) error { fmt.Println("Claim Cancelled.") return nil } + depositSd = true } - } else { - if !cliutils.Confirm(fmt.Sprintf( - "Are you sure you want to claim %s ETH for cycles %v to your reward address?", totalClaimableEth.String(), cyclesToClaimArray)) { - fmt.Println("Cancelled.") - return nil - } + } else if !cliutils.Confirm(fmt.Sprintf( + "Are you sure you want to claim %s ETH for cycles %v to your reward address?", totalClaimableEth.String(), cyclesToClaimArray)) { + fmt.Println("Cancelled.") + return nil } // estimate gas fmt.Println("Estimating gas...") + estimateGasResponse, err := staderClient.EstimateClaimSpRewardsGas(cyclesToClaimArray, depositSd) if err != nil { return err @@ -215,6 +224,7 @@ func ClaimSpRewards(c *cli.Context) error { } fmt.Printf("Transaction Successful\n") + if depositSd { fmt.Printf("%s rewards have been sent to your Reward Address and %s rewards have been re-deposited as SD collateral\n", eth.DisplayAmountInUnits(totalClaimableEth, "eth"), eth.DisplayAmountInUnits(totalClaimableSd, "sd")) } else { diff --git a/stader-cli/node/commands.go b/stader-cli/node/commands.go index 0aced0956..7b78ad0dd 100644 --- a/stader-cli/node/commands.go +++ b/stader-cli/node/commands.go @@ -367,10 +367,7 @@ func RegisterCommands(app *cli.App, name string, aliases []string) { Usage: "Automatically confirm SD repay", }, }, - Action: func(c *cli.Context) error { - // Run - return repaySD(c) - }, + Action: repaySD, }, { Name: "approve-deposit-sd", diff --git a/stader-cli/node/deposit-sd.go b/stader-cli/node/deposit-sd.go index b98d4a704..fde3c0468 100644 --- a/stader-cli/node/deposit-sd.go +++ b/stader-cli/node/deposit-sd.go @@ -63,6 +63,7 @@ func DepositSdWithAmount(staderClient *stader.Client, amountWei *big.Int, autoCo maxApproval := maxUint256() fmt.Println("Before depositing SD, you must first give the collateral contract approval to interact with your SD.") + err = nodeApproveSdWithAmountAndAddress(staderClient, maxApproval, contracts.SdCollateralContract, autoConfirm, nonce) if err != nil { return err diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index 2143b55a7..6bdbf53d4 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -61,6 +61,7 @@ func repaySD(c *cli.Context) error { i, _ := cliutils.Select("Please choose one of the following options for repayment. Enter 1 or 2:", ops) fullRepay := false + var amountWei *big.Int switch i { @@ -86,6 +87,7 @@ func repaySD(c *cli.Context) error { if allowance.Allowance.Cmp(sdStatus.SdUtilizerLatestBalance) < 0 { fmt.Println("Before repaying the SD, you must first give the utility contract approval to interact with your SD.") + maxApproval := maxUint256() err = nodeApproveUtilitySd(c, maxApproval.String()) @@ -131,11 +133,11 @@ func repaySD(c *cli.Context) error { remainUtilize := new(big.Int).Sub(sdStatus.SdUtilizerLatestBalance, amountWei) fmt.Printf("Repayment of %s successful. Current Utilization Position: %s.\n", eth.DisplayAmountInUnits(amountWei, "sd"), eth.DisplayAmountInUnits(remainUtilize, "sd")) } + return nil } func PromptChooseRepayAmount(sdStatus *api.SdStatusResponse) (*big.Int, error) { - msg := fmt.Sprintf(`%sPlease enter the amount of SD you wish to repay. Your current Utilization Position is %s%s`, log.ColorYellow, eth.DisplayAmountInUnits(sdStatus.SdUtilizerLatestBalance, "sd"), log.ColorReset) errMsg := fmt.Sprintf("%sInvalid input, please specify a valid amount of SD you wish to repay. Your current Utilization Position is %s SD%s", log.ColorRed, eth.DisplayAmountInUnits(sdStatus.SdUtilizerLatestBalance, "sd"), log.ColorReset) diff --git a/stader-cli/node/send-el-rewards.go b/stader-cli/node/send-el-rewards.go index ef83edbef..79256b449 100644 --- a/stader-cli/node/send-el-rewards.go +++ b/stader-cli/node/send-el-rewards.go @@ -52,8 +52,10 @@ func SendElRewards(c *cli.Context) error { if err != nil { return err } + fmt.Printf("Sending %s EL Rewards to Claim Vault\n\n", eth.DisplayAmountInUnits(res.ElRewardsAmount, "eth")) cliutils.PrintTransactionHash(staderClient, res.TxHash) + if _, err = staderClient.WaitForTransaction(res.TxHash); err != nil { return err } diff --git a/stader-cli/node/status.go b/stader-cli/node/status.go index 5fd0e6bc3..aec995c87 100644 --- a/stader-cli/node/status.go +++ b/stader-cli/node/status.go @@ -154,6 +154,7 @@ func getNodeStatus(c *cli.Context) error { if err != nil { return err } + collateralPct := 0.0 sdStatus := sdStatusResp.SDStatus totalCollateral := new(big.Int).Add(sdStatus.SdCollateralCurrentAmount, sdStatus.SdUtilizedBalance) @@ -183,7 +184,6 @@ func getNodeStatus(c *cli.Context) error { totalRegisteredValidators, eth.DisplayAmountInUnits(sdStatus.SdCollateralRequireAmount, "sd"), "10%", "10%", "10%") - } else { fmt.Println("") } @@ -194,6 +194,7 @@ func getNodeStatus(c *cli.Context) error { fmt.Printf("The Operator has a current Utilization Position of %s. (including the utilization fee)\n", eth.DisplayAmountInUnits(sdStatus.SdUtilizerLatestBalance, "sd")) + if sdStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) == 0 { fmt.Println("") } else { @@ -204,6 +205,7 @@ func getNodeStatus(c *cli.Context) error { if maxUtilizable.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { maxUtilizable = sdStatus.PoolAvailableSDBalance } + if maxUtilizable.Sign() < 0 { maxUtilizable = big.NewInt(0) } diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index 2940b008d..d32fca739 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -159,7 +159,6 @@ Maximum utilization amount: %s } func PromptChooseSelfBondAmount(sdStatus *api.SdStatusResponse) (*big.Int, error) { - totalCollateral := new(big.Int).Add(sdStatus.SdCollateralCurrentAmount, sdStatus.SdUtilizedBalance) amountToCollateralRemain := new(big.Int).Sub(sdStatus.SdCollateralRequireAmount, totalCollateral) diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index e5b9152f8..a86e5476c 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -116,9 +116,9 @@ func nodeDeposit(c *cli.Context) error { return nil } case 1: - selfBondAmount, err := node.PromptChooseSelfBondAmount(sdStatus) - if err != nil { - return err + selfBondAmount, errSelfBond := node.PromptChooseSelfBondAmount(sdStatus) + if errSelfBond != nil { + return errSelfBond } if status.AccountBalances.Sd.Cmp(selfBondAmount) < 0 { @@ -132,10 +132,10 @@ func nodeDeposit(c *cli.Context) error { } nounce := c.GlobalUint64("nonce") - err = node.DepositSdWithAmount(staderClient, selfBondAmount, true, nounce) + errSelfBond = node.DepositSdWithAmount(staderClient, selfBondAmount, true, nounce) - if err != nil { - return err + if errSelfBond != nil { + return errSelfBond } default: diff --git a/stader-cli/wallet/export.go b/stader-cli/wallet/export.go index f2cba675e..9deae1372 100644 --- a/stader-cli/wallet/export.go +++ b/stader-cli/wallet/export.go @@ -51,7 +51,7 @@ func exportWallet(c *cli.Context) error { // Check if stdout is interactive stat, err := os.Stdout.Stat() if err != nil { - fmt.Fprintf(os.Stderr, "An error occured while determining whether or not the output is a tty: %s\n"+ + fmt.Fprintf(os.Stderr, "An error occurred while determining whether or not the output is a tty: %s\n"+ "Use \"stader-cli --secure-session wallet export\" to bypass.\n", err.Error()) os.Exit(1) } diff --git a/stader-lib/node/validator.go b/stader-lib/node/validator.go index 0d7c21d03..0969ecc5f 100644 --- a/stader-lib/node/validator.go +++ b/stader-lib/node/validator.go @@ -19,13 +19,13 @@ func EstimateAddValidatorKeys( pubKeys [][]byte, preDepositSignatures [][]byte, depositSignatures [][]byte, - referralId string, + referralID string, opts *bind.TransactOpts, ) (stader.GasInfo, error) { return pnr.PermissionlessNodeRegistryContract.GetTransactionGasInfo( opts, "addValidatorKeysWithUtilizeSD", - referralId, + referralID, utilityAmount, pubKeys, preDepositSignatures, @@ -39,9 +39,9 @@ func AddValidatorKeysWithAmount( preDepositSignatures [][]byte, depositSignatures [][]byte, utilityAmount *big.Int, - referralId string, + referralID string, opts *bind.TransactOpts) (*types.Transaction, error) { - tx, err := pnr.PermissionlessNodeRegistry.AddValidatorKeysWithUtilizeSD(opts, referralId, utilityAmount, pubKeys, preDepositSignatures, depositSignatures) + tx, err := pnr.PermissionlessNodeRegistry.AddValidatorKeysWithUtilizeSD(opts, referralID, utilityAmount, pubKeys, preDepositSignatures, depositSignatures) if err != nil { return nil, fmt.Errorf("could not add validator keys with utilize: %w", err) } diff --git a/stader-lib/sdutility/sd-utility.go b/stader-lib/sdutility/sd-utility.go index 486481b81..8eb178ee9 100644 --- a/stader-lib/sdutility/sd-utility.go +++ b/stader-lib/sdutility/sd-utility.go @@ -19,10 +19,12 @@ func GetPoolAvailableSDBalance(sp *stader.SDUtilityPoolContractManager, opts *bi if err != nil { return nil, err } + sdRequestedForWithdraw, err := GetSdRequestedForWithdraw(sp, opts) if err != nil { return nil, err } + utilityPoolBalance, err := GetUtilityPoolBalance(sp, opts) if err != nil { return nil, err @@ -81,6 +83,10 @@ func RepayFullAmount(sp *stader.SDUtilityPoolContractManager, opts *bind.Transac func SDMaxUtilizableAmount(sp *stader.SDUtilityPoolContractManager, sdc *stader.SdCollateralContractManager, numValidators *big.Int, opts *bind.CallOpts) (*big.Int, error) { maxThreshold, err := sp.SDUtilityPool.MaxETHWorthOfSDPerValidator(opts) + if err != nil { + return nil, err + } + ethAmount := new(big.Int).Mul(maxThreshold, numValidators) sdAmount, err := sdc.SdCollateral.ConvertETHToSD(opts, ethAmount) @@ -115,7 +121,7 @@ func GetUserData(sp *stader.SDUtilityPoolContractManager, address common.Address return &userData, nil } -func AlreadyLiquidated(sp *stader.SDUtilityPoolContractManager, address common.Address, opts *bind.CallOpts) (bool, error) { +func AlreadyLiquidated(sp *stader.SDUtilityPoolContractManager, address common.Address) (bool, error) { liquidationIndex, err := LiquidationIndexByOperator(sp, address, nil) if err != nil { return false, err diff --git a/stader-lib/socializing-pool/rewards.go b/stader-lib/socializing-pool/rewards.go index 3779e7771..38d706909 100644 --- a/stader-lib/socializing-pool/rewards.go +++ b/stader-lib/socializing-pool/rewards.go @@ -23,11 +23,11 @@ func ClaimRewards(sp *stader.SocializingPoolContractManager, index []*big.Int, a return tx, nil } -func EstimateClaimRewardsAndDepositSD(sp *stader.SocializingPoolContractManager, index []*big.Int, amountSd []*big.Int, amountEth []*big.Int, merkleProof [][][32]byte, opts *bind.TransactOpts) (stader.GasInfo, error) { +func EstimateClaimRewardsAndDepositSD(sp *stader.SocializingPoolContractManager, index, amountSd, amountEth []*big.Int, merkleProof [][][32]byte, opts *bind.TransactOpts) (stader.GasInfo, error) { return sp.SocializingPoolContract.GetTransactionGasInfo(opts, "claimAndDepositSD", index, amountSd, amountEth, merkleProof) } -func ClaimRewardsAndDepositSD(sp *stader.SocializingPoolContractManager, index []*big.Int, amountSd []*big.Int, amountEth []*big.Int, merkleProof [][][32]byte, opts *bind.TransactOpts) (*types.Transaction, error) { +func ClaimRewardsAndDepositSD(sp *stader.SocializingPoolContractManager, index, amountSd, amountEth []*big.Int, merkleProof [][][32]byte, opts *bind.TransactOpts) (*types.Transaction, error) { tx, err := sp.SocializingPool.ClaimAndDepositSD(opts, index, amountSd, amountEth, merkleProof) if err != nil { return nil, err diff --git a/stader-lib/utils/eth/units.go b/stader-lib/utils/eth/units.go index 526f293ad..3f6a15c38 100644 --- a/stader-lib/utils/eth/units.go +++ b/stader-lib/utils/eth/units.go @@ -38,6 +38,7 @@ func DisplayAmountInUnits(wei *big.Int, denom string) string { if denom == "sd" { gweiDenom = " gwei SD" } + regDenom := " ETH" if denom == "sd" { regDenom = " SD" @@ -46,9 +47,11 @@ func DisplayAmountInUnits(wei *big.Int, denom string) string { if wei == nil { return "" } + if wei.Cmp(big.NewInt(Threshold)) < 0 && wei.Cmp(big.NewInt(0)) != 0 { return strconv.FormatFloat(WeiToGwei(wei), 'f', 6, 64) + gweiDenom } + return strconv.FormatFloat(WeiToEth(wei), 'f', 6, 64) + regDenom } diff --git a/stader-lib/utils/sd/sd.go b/stader-lib/utils/sd/sd.go index 3980c8be9..2c2d7b1b8 100644 --- a/stader-lib/utils/sd/sd.go +++ b/stader-lib/utils/sd/sd.go @@ -2,7 +2,6 @@ package sd import ( "fmt" - "math" "math/big" "strconv" @@ -16,10 +15,6 @@ const ( var SDWeiEqualityThreshold = eth.EthToWei(SDFloatStringEqualityThreshold) -func almostEqual(lhs, rhs float64) bool { - return math.Abs(lhs-rhs) <= SDFloatStringEqualityThreshold -} - func WeiAlmostEqual(lhs, rhs *big.Int) bool { diversity := new(big.Int).Sub(lhs, rhs) @@ -37,7 +32,9 @@ func PromptChooseSDWithMaxMin(msg, errMsg string, min, max *big.Int) (*big.Int, `^[0-9]\d*(\.\d+)?$`, errMsg) - utilityAmountFloat, errParse := strconv.ParseFloat(s, 64) + var utilityAmountFloat float64 + utilityAmountFloat, errParse = strconv.ParseFloat(s, 64) + if errParse != nil { fmt.Println(errMsg) continue diff --git a/stader/api/node/claim-rewards.go b/stader/api/node/claim-rewards.go index e06a85671..5df3f01ab 100644 --- a/stader/api/node/claim-rewards.go +++ b/stader/api/node/claim-rewards.go @@ -97,11 +97,12 @@ func ClaimRewards(c *cli.Context) (*api.ClaimRewards, error) { return nil, err } - operatorId, err := node.GetOperatorId(pnr, nodeAccount.Address, nil) + operatorID, err := node.GetOperatorId(pnr, nodeAccount.Address, nil) if err != nil { return nil, err } - operatorInfo, err := node.GetOperatorInfo(pnr, operatorId, nil) + + operatorInfo, err := node.GetOperatorInfo(pnr, operatorID, nil) if err != nil { return nil, err } @@ -134,8 +135,8 @@ func ClaimRewards(c *cli.Context) (*api.ClaimRewards, error) { if err != nil { return nil, err } - response.RewardsClaimed = totalWithdrawableEth + response.RewardsClaimed = totalWithdrawableEth response.TxHash = tx.Hash() return &response, nil diff --git a/stader/api/node/claim-sp-rewards.go b/stader/api/node/claim-sp-rewards.go index c83d68329..ec91e9433 100644 --- a/stader/api/node/claim-sp-rewards.go +++ b/stader/api/node/claim-sp-rewards.go @@ -169,7 +169,7 @@ func estimateSpRewardsGas(c *cli.Context, stringifiedCycles string, depositSd bo return nil, err } - gasInfo := stader.GasInfo{} + var gasInfo stader.GasInfo if depositSd { gasInfo, err = socializing_pool.EstimateClaimRewardsAndDepositSD(sp, cycles, amountSd, amountEth, merkleProofs, opts) if err != nil { diff --git a/stader/api/node/deposit-sd.go b/stader/api/node/deposit-sd.go index 0ba70afc3..b031dad68 100644 --- a/stader/api/node/deposit-sd.go +++ b/stader/api/node/deposit-sd.go @@ -91,6 +91,7 @@ func getSdApprovalGas(c *cli.Context, amountWei *big.Int, contractAddress common if err != nil { return nil, err } + gasInfo, err := tokens.EstimateApproveGas(sdt, contractAddress, amountWei, opts) if err != nil { return nil, err @@ -153,10 +154,12 @@ func approveSd(c *cli.Context, amountWei *big.Int, contractAddress common.Addres if err != nil { return nil, err } + err = eth1.CheckForNonceOverride(c, opts) if err != nil { return nil, fmt.Errorf("Error checking for nonce override: %w", err) } + hash, err := tokens.Approve(sdt, contractAddress, amountWei, opts) if err != nil { return nil, err diff --git a/stader/api/node/get-contracts-info.go b/stader/api/node/get-contracts-info.go index 72d78261e..b694faaca 100644 --- a/stader/api/node/get-contracts-info.go +++ b/stader/api/node/get-contracts-info.go @@ -18,6 +18,7 @@ func getContractsInfo(c *cli.Context) (*api.ContractsInfoResponse, error) { if err != nil { return nil, fmt.Errorf("Error getting configuration: %w", err) } + response.Network = uint64(config.StaderNode.GetChainID()) response.EncryptionKey = config.StaderNode.GetPresignEncryptionKey() @@ -34,6 +35,7 @@ func getContractsInfo(c *cli.Context) (*api.ContractsInfoResponse, error) { response.BeaconNetwork = eth2DepositContract.ChainID response.BeaconDepositContract = eth2DepositContract.Address + response.SdCollateralContract, err = services.GetSdCollateralAddress(c) if err != nil { return nil, err @@ -44,34 +46,42 @@ func getContractsInfo(c *cli.Context) (*api.ContractsInfoResponse, error) { if err != nil { return nil, err } + response.SdToken, err = services.GetSdTokenAddress(c) if err != nil { return nil, err } + response.PermissionlessNodeRegistry, err = services.GetPermissionlessNodeRegistryAddress(c) if err != nil { return nil, err } + response.VaultFactory, err = services.GetVaultFactoryAddress(c) if err != nil { return nil, err } + response.SocializingPoolContract, err = services.GetSocializingPoolAddress(c) if err != nil { return nil, err } + response.PermisionlessPool, err = services.GetPermissionlessPoolAddress(c) if err != nil { return nil, err } + response.StaderOracle, err = services.GetStaderOracleAddress(c) if err != nil { return nil, err } + response.StakePoolManager, err = services.GetStakePoolManagerAddress(c) if err != nil { return nil, err } + response.SdUtilityContract, err = services.GetSdUtilityAddress(c) if err != nil { return nil, err diff --git a/stader/api/node/status.go b/stader/api/node/status.go index b75a0f141..7b48dff08 100644 --- a/stader/api/node/status.go +++ b/stader/api/node/status.go @@ -183,6 +183,7 @@ func getStatus(c *cli.Context) (*api.NodeStatusResponse, error) { if err != nil { return nil, err } + response.OperatorWithdrawableEth = operatorWithdrawableEth operatorReward, err := tokens.GetEthBalance(pnr.Client, operatorRegistry.OperatorRewardAddress, nil) diff --git a/stader/api/node/utility-sd.go b/stader/api/node/utility-sd.go index 0f031c6d3..7fcd192f4 100644 --- a/stader/api/node/utility-sd.go +++ b/stader/api/node/utility-sd.go @@ -39,15 +39,16 @@ func canUtilitySd(c *cli.Context, amountWei *big.Int) (*api.CanUtilitySDResponse return nil, err } - operatorId, err := node.GetOperatorId(prn, nodeAccount.Address, nil) + operatorID, err := node.GetOperatorId(prn, nodeAccount.Address, nil) if err != nil { return nil, err } - totalValidatorKeys, err := node.GetTotalValidatorKeys(prn, operatorId, nil) + totalValidatorKeys, err := node.GetTotalValidatorKeys(prn, operatorID, nil) if err != nil { return nil, err } + totalValidatorNonTerminalKeys, err := node.GetTotalNonTerminalValidatorKeys(prn, nodeAccount.Address, totalValidatorKeys, nil) if err != nil { return nil, err diff --git a/stader/api/validator/deposit.go b/stader/api/validator/deposit.go index 3a98ebbd2..bad76ea18 100644 --- a/stader/api/validator/deposit.go +++ b/stader/api/validator/deposit.go @@ -88,7 +88,7 @@ func GetSDStatus( return nil, err } - alreadyLiquidated, err := sdutility.AlreadyLiquidated(sdu, operatorAddress, nil) + alreadyLiquidated, err := sdutility.AlreadyLiquidated(sdu, operatorAddress) if err != nil { return nil, err } @@ -110,7 +110,7 @@ func GetSDStatus( }, nil } -func canNodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidators *big.Int, reloadKeys bool) (*api.CanNodeDepositResponse, error) { +func canNodeDeposit(c *cli.Context, baseAmountWei, utilityAmountWei, numValidators *big.Int, _ bool) (*api.CanNodeDepositResponse, error) { if err := services.RequireNodeWallet(c); err != nil { return nil, err } diff --git a/stader/guardian/collector/network-collector.go b/stader/guardian/collector/network-collector.go index 0a01e286f..1401f310f 100644 --- a/stader/guardian/collector/network-collector.go +++ b/stader/guardian/collector/network-collector.go @@ -62,7 +62,7 @@ type NetworkCollector struct { // The utilize amount + fee SdUtilityPoolBalance *prometheus.Desc - //Total amount of outstanding SD utilized + // Total amount of outstanding SD utilized TotalSDUtilized *prometheus.Desc TotalValueLocledSDUtilization *prometheus.Desc @@ -151,7 +151,6 @@ func NewNetworkCollector(bc beacon.Client, ec stader.ExecutionClient, nodeAddres "The current balance of the SD utility pool", nil, nil, ), - //Total amount of outstanding SD utilized TotalSDUtilized: prometheus.NewDesc(prometheus.BuildFQName(namespace, subsystem, "total_outstanding_sd_utilized"), "The total the SD utilized in network", nil, nil, diff --git a/stader/guardian/collector/operator-collector.go b/stader/guardian/collector/operator-collector.go index 70b9253fa..e83e2be37 100644 --- a/stader/guardian/collector/operator-collector.go +++ b/stader/guardian/collector/operator-collector.go @@ -143,7 +143,7 @@ func NewOperatorCollector( prometheus.BuildFQName(namespace, OperatorSub, LiquidationStatus), "", nil, nil), ClaimVaultBalance: prometheus.NewDesc( prometheus.BuildFQName(namespace, OperatorSub, ClaimVaultBalance), "", nil, nil), - SDUtilizationPosition: prometheus.NewDesc(prometheus.BuildFQName(namespace, OperatorSub, "sd_utility_positon"), + SDUtilizationPosition: prometheus.NewDesc(prometheus.BuildFQName(namespace, OperatorSub, "sd_utility_position"), "The current balance of the SD utility pool", nil, nil, ), @@ -224,8 +224,8 @@ func (collector *OperatorCollector) Collect(channel chan<- prometheus.Metric) { channel <- prometheus.MustNewConstMetric(collector.SdCollateralPct, prometheus.GaugeValue, state.StaderNetworkDetails.SdCollateralPct) channel <- prometheus.MustNewConstMetric(collector.LockedEth, prometheus.GaugeValue, state.StaderNetworkDetails.LockedEth) channel <- prometheus.MustNewConstMetric(collector.HealthFactor, prometheus.GaugeValue, state.StaderNetworkDetails.HealthFactor) - channel <- prometheus.MustNewConstMetric(collector.TotalSDUtilizationPosition, prometheus.GaugeValue, float64(state.StaderNetworkDetails.OperatorSDUtilizationPosition)) - channel <- prometheus.MustNewConstMetric(collector.TotalSDSelfBond, prometheus.GaugeValue, float64(state.StaderNetworkDetails.OperatorSDSelfBond)) + channel <- prometheus.MustNewConstMetric(collector.TotalSDUtilizationPosition, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorSDUtilizationPosition) + channel <- prometheus.MustNewConstMetric(collector.TotalSDSelfBond, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorSDSelfBond) channel <- prometheus.MustNewConstMetric(collector.LiquidationStatus, prometheus.GaugeValue, state.StaderNetworkDetails.LiquidationStatus) channel <- prometheus.MustNewConstMetric(collector.ClaimVaultBalance, prometheus.GaugeValue, state.StaderNetworkDetails.ClaimVaultBalance) channel <- prometheus.MustNewConstMetric(collector.SDUtilizationPosition, prometheus.GaugeValue, state.StaderNetworkDetails.OperatorSDUtilizationPosition) diff --git a/stader/node/node.go b/stader/node/node.go index aeba383ef..1fbd00d53 100644 --- a/stader/node/node.go +++ b/stader/node/node.go @@ -540,7 +540,6 @@ func makeNodeDiversityMessage( return nil, err } - //fmt.Printf("Get total non terminal validator keys\n") totalNonTerminalValidatorKeys, err := node.GetTotalNonTerminalValidatorKeys(pnr, nodeAccount.Address, totalValidatorKeys, nil) if err != nil { return nil, err From 466e9d11344bdfc75b7c0bc969d30697daf756c8 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Fri, 1 Mar 2024 21:10:01 +0700 Subject: [PATCH 156/159] Min to utility always be 1 SD --- stader-cli/node/utilize-sd.go | 10 +++++----- stader-cli/validator/deposit.go | 5 ++++- stader/node/node.go | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index d32fca739..d88f77fee 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -58,7 +58,10 @@ func utilizeSD(c *cli.Context) error { return nil } - amountWei, err := PromptChooseUtilityAmount(sdStatusResponse.SDStatus) + minUtility := eth.EthToWei(1) + maxUtility := GetMaxUtility(sdStatusResponse.SDStatus) + + amountWei, err := PromptChooseUtilityAmount(sdStatusResponse.SDStatus, minUtility, maxUtility) if err != nil { return err } @@ -120,10 +123,7 @@ func GetMaxUtility(sdStatus *api.SdStatusResponse) *big.Int { return maxUtility } -func PromptChooseUtilityAmount(sdStatus *api.SdStatusResponse) (*big.Int, error) { - minUtility := GetMinUtility(sdStatus) - maxUtility := GetMaxUtility(sdStatus) - +func PromptChooseUtilityAmount(sdStatus *api.SdStatusResponse, minUtility, maxUtility *big.Int) (*big.Int, error) { // 1. If the pool had enough SD if minUtility.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { return nil, errors.New("There is not sufficient free SD in the Utility Pool for utilization at the moment. Please try again later when there is enough free SD in the Utility Pool") diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index a86e5476c..4b7b850b1 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -106,7 +106,10 @@ func nodeDeposit(c *cli.Context) error { switch i { case 0: - utilityAmount, err = node.PromptChooseUtilityAmount(sdStatus) + minUtility := node.GetMinUtility(sdStatus) + maxUtility := node.GetMaxUtility(sdStatus) + + utilityAmount, err = node.PromptChooseUtilityAmount(sdStatus, minUtility, maxUtility) if err != nil { return err } diff --git a/stader/node/node.go b/stader/node/node.go index 1fbd00d53..bd6de7cd9 100644 --- a/stader/node/node.go +++ b/stader/node/node.go @@ -471,7 +471,7 @@ func run(c *cli.Context) error { if response.Success { infoLog.Println("Successfully sent the NodeDiversity message") } else { - errorLog.Println("Failed to send the NodeDiversity message with err: %s\n", response.Error) + errorLog.Printf("Failed to send the NodeDiversity message with err: %s\n", response.Error) } infoLog.Println("Done checking node diversity metrics") From d3870e31314b69bfff60f29f28e91a55e9c820ac Mon Sep 17 00:00:00 2001 From: batphonghan Date: Mon, 4 Mar 2024 18:15:57 +0700 Subject: [PATCH 157/159] Refactor --- stader-cli/node/claim-rewards.go | 11 ++++------- stader-cli/node/utilize-sd.go | 11 ++++++----- stader-cli/node/withdraw-sd.go | 33 ++++++++++++++++---------------- 3 files changed, 26 insertions(+), 29 deletions(-) diff --git a/stader-cli/node/claim-rewards.go b/stader-cli/node/claim-rewards.go index 66e9c1068..4d28be968 100644 --- a/stader-cli/node/claim-rewards.go +++ b/stader-cli/node/claim-rewards.go @@ -44,18 +44,15 @@ func ClaimRewards(c *cli.Context) error { sdStatus := sdStatusResponse.SDStatus - totalFee := sdStatus.AccumulatedInterest - + // totalFee := sdStatus.AccumulatedInterest // if withdrawableInEth < claimsBalance, then there is an existing utilization position if canClaimRewardsResponse.ClaimsBalance.Cmp(canClaimRewardsResponse.WithdrawableInEth) != 0 { - if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { - fmt.Printf("You need to first pay %s and close the utilization position to get back your funds. Execute the following command to repay your utilized SD stader-cli repay-sd --amount \n", eth.DisplayAmountInUnits(totalFee, "sd")) - - fmt.Printf("Based on the current Health Factor, you can claim upto %s.\n", eth.DisplayAmountInUnits(canClaimRewardsResponse.WithdrawableInEth, "eth")) + if sdStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { + fmt.Printf("You currently have an existing SD Utilization Position of %s. Based on the current Health Factor, you can claim upto %s", eth.DisplayAmountInUnits(sdStatusResponse.SDStatus.SdUtilizerLatestBalance, "sd"), eth.DisplayAmountInUnits(canClaimRewardsResponse.WithdrawableInEth, "eth")) fmt.Printf("Note: Please repay your utilized SD by using the following command to claim the remaining ETH: stader-cli sd repay --amount .\n") - if !cliutils.Confirm("Are you sure you want to proceed?\n\n") { + if !cliutils.Confirm("Do you wish to proceed?\n\n") { fmt.Println("Cancelled.") return nil } diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index d88f77fee..0fcb56c4a 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -54,7 +54,7 @@ func utilizeSD(c *cli.Context) error { } if sdStatusResponse.SDStatus.SdCollateralRequireAmount.Cmp(big.NewInt(0)) == 0 { - fmt.Printf("Please add a validator to your node first before utilizing SD from a Utility Pool. Execute the following command to add a validator to your node: stader-cli validator deposit --num-validators \n") + fmt.Printf("Please add a validator to your node first before utilizing SD from a Utility Pool. Execute the following command to add a validator to your node: ~/bin/stader-cli validator deposit --num-validators \n") return nil } @@ -142,13 +142,14 @@ func PromptChooseUtilityAmount(sdStatus *api.SdStatusResponse, minUtility, maxUt minSd := eth.WeiToEth(minUtility) maxSd := eth.WeiToEth(maxUtility) - msg := fmt.Sprintf(`SD Utility Pool balance: %s + msg := fmt.Sprintf(` +%sPlease enter the amount of SD you wish to utilize from the SD Utility Pool:%s +SD Utility Pool balance: %s Minimum utilization amount: %s Maximum utilization amount: %s +`, log.ColorYellow, log.ColorReset, eth.DisplayAmountInUnits(sdStatus.PoolAvailableSDBalance, "sd"), eth.DisplayAmountInUnits(minUtility, "sd"), eth.DisplayAmountInUnits(maxUtility, "sd")) -%sPlease enter the amount of SD you wish to utilize from the SD Utility Pool:%s`, eth.DisplayAmountInUnits(sdStatus.PoolAvailableSDBalance, "sd"), eth.DisplayAmountInUnits(minUtility, "sd"), eth.DisplayAmountInUnits(maxUtility, "sd"), log.ColorYellow, log.ColorReset) - - errMsg := fmt.Sprintf("Invalid input, please specify an amount within %f and %f SD range", minSd, maxSd) + errMsg := fmt.Sprintf("%sInvalid input, please specify an amount within %f and %f SD range%s", log.ColorRed, minSd, maxSd, log.ColorReset) utilityAmount, err := sd.PromptChooseSDWithMaxMin(msg, errMsg, minUtility, maxUtility) if err != nil { diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index 043b3c3c7..cdceb77f1 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -37,13 +37,13 @@ func WithdrawSd(c *cli.Context) error { return err } - if canWithdrawSdResponse.InsufficientWithdrawableSd { - fmt.Println("Insufficient withdrawable SD!") + if canWithdrawSdResponse.InsufficientSdCollateral { + fmt.Println("Not enough excess SD collateral to withdraw") return nil } - if canWithdrawSdResponse.InsufficientSdCollateral { - fmt.Println("Not enough excess SD collateral to withdraw") + if canWithdrawSdResponse.InsufficientWithdrawableSd { + fmt.Println("Insufficient withdrawable SD!") return nil } @@ -54,8 +54,14 @@ func WithdrawSd(c *cli.Context) error { hasUtilizePosition := sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) != 0 - // if the paid out amount is > utilizedBalance - if sdStatusResponse.SDStatus.SdUtilizerLatestBalance.Cmp(amountWei) >= 0 { + // Check if the withdraw request amount if greater than the Utilization Position + withdrawExcessUtilization := amountWei.Cmp(sdStatusResponse.SDStatus.SdUtilizerLatestBalance) >= 0 + if withdrawExcessUtilization { + if !cliutils.Confirm(fmt.Sprintf("You have an existing Utilization Position of %s. The excess SD collateral you are trying to withdraw will be used to repay the utilized SD and the remaining SD will be sent to your Reward Address.\n Do you wish to proceed?", eth.DisplayAmountInUnits(sdStatusResponse.SDStatus.SdUtilizerLatestBalance, "sd"))) { + fmt.Println("Cancelled.") + return nil + } + } else { if !cliutils.Confirm(fmt.Sprintf("You have an existing Utilization Position of %s. The excess SD collateral you are trying to withdraw will be used to repay the utilized SD.\n Do you wish to proceed?", eth.DisplayAmountInUnits(sdStatusResponse.SDStatus.SdUtilizerLatestBalance, "sd"))) { fmt.Println("Cancelled.") return nil @@ -68,13 +74,6 @@ func WithdrawSd(c *cli.Context) error { return err } - // Prompt for confirmation - if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( - "Are you sure you want to withdraw %s from the collateral contract?", eth.DisplayAmountInUnits(amountWei, "sd")))) { - fmt.Println("Cancelled.") - return nil - } - res, err := staderClient.WithdrawSd(amountWei) if err != nil { return err @@ -101,13 +100,13 @@ func WithdrawSd(c *cli.Context) error { return nil } - if remainUtilize.Cmp(big.NewInt(0)) > 0 { - fmt.Printf("Successfully withdrawn %s Collateral. \n", eth.DisplayAmountInUnits(amountWei, "sd")) - fmt.Printf("Current Utilization Position: %s\nCurrent SD collateral: %s\n", eth.DisplayAmountInUnits(remainUtilize, "sd"), eth.DisplayAmountInUnits(remainCollateral, "sd")) - } else { + if withdrawExcessUtilization { // withdraw request amount greater than the Utilization Position fmt.Printf("Repayment of %s successful using the excess SD Collateral.\n", eth.DisplayAmountInUnits(amountWei, "sd")) fmt.Printf("The remaining %s has been sent to your Operator Reward Address\n", eth.DisplayAmountInUnits(new(big.Int).Abs(remainUtilize), "sd")) + } else { + fmt.Printf("Repayment of %s successful using the excess SD Collateral.. \n", eth.DisplayAmountInUnits(amountWei, "sd")) + fmt.Printf("Current Utilization Position: %s\nCurrent SD collateral: %s\n", eth.DisplayAmountInUnits(remainUtilize, "sd"), eth.DisplayAmountInUnits(remainCollateral, "sd")) } return nil From 194d41eae30efbd35d6c4bfe623ce2f0d315428d Mon Sep 17 00:00:00 2001 From: batphonghan Date: Mon, 4 Mar 2024 19:28:12 +0700 Subject: [PATCH 158/159] Update message --- stader-cli/node/claim-rewards.go | 6 +++--- stader-cli/node/repay-sd.go | 2 +- stader-cli/node/utilize-sd.go | 14 ++++++++------ stader-cli/node/withdraw-sd.go | 3 ++- stader-cli/validator/deposit.go | 2 +- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/stader-cli/node/claim-rewards.go b/stader-cli/node/claim-rewards.go index 4d28be968..3ce2599ed 100644 --- a/stader-cli/node/claim-rewards.go +++ b/stader-cli/node/claim-rewards.go @@ -48,14 +48,14 @@ func ClaimRewards(c *cli.Context) error { // if withdrawableInEth < claimsBalance, then there is an existing utilization position if canClaimRewardsResponse.ClaimsBalance.Cmp(canClaimRewardsResponse.WithdrawableInEth) != 0 { if sdStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { - fmt.Printf("You currently have an existing SD Utilization Position of %s. Based on the current Health Factor, you can claim upto %s", eth.DisplayAmountInUnits(sdStatusResponse.SDStatus.SdUtilizerLatestBalance, "sd"), eth.DisplayAmountInUnits(canClaimRewardsResponse.WithdrawableInEth, "eth")) - - fmt.Printf("Note: Please repay your utilized SD by using the following command to claim the remaining ETH: stader-cli sd repay --amount .\n") + fmt.Printf("You currently have an existing SD Utilization Position of %s. Based on the current Health Factor, you can claim %s at the moment, and the remaining ETH can be claimed after closing the Utilization Position", eth.DisplayAmountInUnits(sdStatusResponse.SDStatus.SdUtilizerLatestBalance, "sd"), eth.DisplayAmountInUnits(canClaimRewardsResponse.WithdrawableInEth, "eth")) if !cliutils.Confirm("Do you wish to proceed?\n\n") { fmt.Println("Cancelled.") return nil } + + fmt.Printf("Note: Please repay your utilized SD by using the following command to claim the remaining ETH: stader-cli sd repay --amount .\n") } } diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index 6bdbf53d4..4c8eb2840 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -97,7 +97,7 @@ func repaySD(c *cli.Context) error { } // Prompt for confirmation - if !cliutils.Confirm(fmt.Sprintf("Are you sure you want to repay %s from your Operator Address and close your Utilization Position? ", eth.DisplayAmountInUnits(amountWei, "sd"))) { + if !cliutils.Confirm(fmt.Sprintf("Are you sure you want to repay %s from your Operator Address?", eth.DisplayAmountInUnits(amountWei, "sd"))) { fmt.Printf("Cancelled\n") return nil } diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index 0fcb56c4a..3c7be51a9 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -40,21 +40,23 @@ func utilizeSD(c *cli.Context) error { } if sdStatusResponse.SDStatus.AlreadyLiquidated { - fmt.Printf("Your node is in liquidation process") + fmt.Printf("Your node is under the liquidation process and you can not utilize SD at the moment.") return nil } healthFactor := eth.WeiToEth(sdStatusResponse.SDStatus.HealthFactor) if healthFactor < 1 { fmt.Printf( - "The Operator has a Health Factor of %.6f. \nNote: Please ensure your Health Factor is greater than 1 to avoid liquidations.\n\n", + "Your node has a Health Factor of %.6f which is less than 1 and you can not utilize SD at the moment. Please repay your utilize SD and ensure your Health Factor is greater than 1 to avoid liquidation.\n\n", healthFactor) + fmt.Printf("Note: Please repay your utilized SD by using the following command: stader-cli sd repay --amount .\n") + return nil } if sdStatusResponse.SDStatus.SdCollateralRequireAmount.Cmp(big.NewInt(0)) == 0 { - fmt.Printf("Please add a validator to your node first before utilizing SD from a Utility Pool. Execute the following command to add a validator to your node: ~/bin/stader-cli validator deposit --num-validators \n") + fmt.Printf("Please add a validator to your node first before utilizing SD from the SD Utility Pool. Execute the following command to add a validator to your node: ~/bin/stader-cli validator deposit --num-validators \n") return nil } @@ -79,7 +81,7 @@ func utilizeSD(c *cli.Context) error { rate := sdStatusResponse.SDStatus.UtilizationRate // Prompt for confirmation if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( - "Are you sure you want to use %s from the utility pool?.\nNote: A Utilization fee of %s%s will be applied to the utilized SD from the utility pool.", eth.DisplayAmountInUnits(amountWei, "sd"), rate.String(), "%"))) { + "Are you sure you want to use %s from the SD Utility Pool?.\nNote: A Utilization fee of %s%s will be applied to the utilized SD from the SD Utility Pool.", eth.DisplayAmountInUnits(amountWei, "sd"), rate.String(), "%"))) { fmt.Println("Cancelled.") return nil } @@ -96,7 +98,7 @@ func utilizeSD(c *cli.Context) error { } // Log & return - fmt.Printf("Successfully deposited %s to the collateral contract by utilizing SD from the Utility Pool.\n", eth.DisplayAmountInUnits(amountWei, "sd")) + fmt.Printf("Successfully deposited %s to the collateral contract by utilizing SD from the SD Utility Pool.\n", eth.DisplayAmountInUnits(amountWei, "sd")) return nil } @@ -126,7 +128,7 @@ func GetMaxUtility(sdStatus *api.SdStatusResponse) *big.Int { func PromptChooseUtilityAmount(sdStatus *api.SdStatusResponse, minUtility, maxUtility *big.Int) (*big.Int, error) { // 1. If the pool had enough SD if minUtility.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { - return nil, errors.New("There is not sufficient free SD in the Utility Pool for utilization at the moment. Please try again later when there is enough free SD in the Utility Pool") + return nil, errors.New("There is not sufficient free SD in the SD Utility Pool for utilization at the moment. Please try again later when there is enough free SD in the SD Utility Pool") } // 2. If user had enough Eth diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index cdceb77f1..660a0a89c 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -38,6 +38,7 @@ func WithdrawSd(c *cli.Context) error { } if canWithdrawSdResponse.InsufficientSdCollateral { + //TODO: show 200% in SD fmt.Println("Not enough excess SD collateral to withdraw") return nil } @@ -95,7 +96,7 @@ func WithdrawSd(c *cli.Context) error { // withdraw request amount lesser than the Utilization Position if !hasUtilizePosition { - fmt.Printf("Successfully withdrawn %s Collateral. \n", eth.DisplayAmountInUnits(amountWei, "sd")) + fmt.Printf("Successfully withdrawn %s collateral. \n", eth.DisplayAmountInUnits(amountWei, "sd")) return nil } diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 4b7b850b1..7fe03a0d5 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -145,7 +145,7 @@ func nodeDeposit(c *cli.Context) error { return nil } - fmt.Println("Continue with create validator...") + fmt.Println("Validator creation process initiate, please wait...") } canNodeDepositResponse, err := staderClient.CanNodeDeposit(baseAmount, utilityAmount, big.NewInt(int64(numValidators)), true) From 03609feb844a214689d864ceb2d619f2e57a1b10 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Mon, 4 Mar 2024 20:48:07 +0700 Subject: [PATCH 159/159] Update ABI --- abis/OperatorRewardsCollector.abi.json | 604 +++-------- .../contracts/operator-rewards-collector.go | 954 ++---------------- stader-lib/node/operator.go | 6 +- 3 files changed, 275 insertions(+), 1289 deletions(-) diff --git a/abis/OperatorRewardsCollector.abi.json b/abis/OperatorRewardsCollector.abi.json index 6fc23cab7..5794e4c04 100644 --- a/abis/OperatorRewardsCollector.abi.json +++ b/abis/OperatorRewardsCollector.abi.json @@ -1,444 +1,166 @@ [ { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "CallerNotStaderContract", - "type": "error" - }, - { - "inputs": [], - "name": "InsufficientBalance", - "type": "error" - }, - { - "inputs": [], - "name": "TransferFailed", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Claimed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "DepositedFor", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staderConfig", - "type": "address" - } - ], - "name": "UpdatedStaderConfig", - "type": "event" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "balances", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "claim", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "claimFor", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "liquidatorAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "liquidator", - "type": "address" - } - ], - "name": "claimLiquidation", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "depositFor", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_admin", - "type": "address" - }, - { - "internalType": "address", - "name": "_staderConfig", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "staderConfig", - "outputs": [ - { - "internalType": "contract IStaderConfig", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_staderConfig", - "type": "address" - } - ], - "name": "updateStaderConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "withdrawableInEth", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" + "inputs": [], + "name": "InsufficientBalance", + "type": "error" + }, + { + "inputs": [], + "name": "WethTransferFailed", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Claimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "DepositedFor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staderConfig", + "type": "address" + } + ], + "name": "UpdatedStaderConfig", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "weth", + "type": "address" + } + ], + "name": "UpdatedWethAddress", + "type": "event" + }, + { + "inputs": [], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "claimLiquidation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "claimWithAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_receiver", + "type": "address" + } + ], + "name": "depositFor", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "getBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "withdrawableInEth", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" } -] + ] \ No newline at end of file diff --git a/stader-lib/contracts/operator-rewards-collector.go b/stader-lib/contracts/operator-rewards-collector.go index 50c9bdcad..9ca162677 100644 --- a/stader-lib/contracts/operator-rewards-collector.go +++ b/stader-lib/contracts/operator-rewards-collector.go @@ -31,7 +31,7 @@ var ( // OperatorRewardsCollectorMetaData contains all meta data concerning the OperatorRewardsCollector contract. var OperatorRewardsCollectorMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CallerNotStaderContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Claimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"DepositedFor\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balances\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"claimFor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"liquidatorAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"name\":\"claimLiquidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"}],\"name\":\"depositFor\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"staderConfig\",\"outputs\":[{\"internalType\":\"contractIStaderConfig\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_staderConfig\",\"type\":\"address\"}],\"name\":\"updateStaderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"withdrawableInEth\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"name\":\"InsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"WethTransferFailed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Claimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"DepositedFor\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"staderConfig\",\"type\":\"address\"}],\"name\":\"UpdatedStaderConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"weth\",\"type\":\"address\"}],\"name\":\"UpdatedWethAddress\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"claimLiquidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"claimWithAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"}],\"name\":\"depositFor\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"getBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"withdrawableInEth\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } // OperatorRewardsCollectorABI is the input ABI used to generate the binding from. @@ -180,43 +180,12 @@ func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactorRaw) Transact return _OperatorRewardsCollector.Contract.contract.Transact(opts, method, params...) } -// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. +// GetBalance is a free data retrieval call binding the contract method 0xf8b2cb4f. // -// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) -func (_OperatorRewardsCollector *OperatorRewardsCollectorCaller) DEFAULTADMINROLE(opts *bind.CallOpts) ([32]byte, error) { +// Solidity: function getBalance(address operator) view returns(uint256) +func (_OperatorRewardsCollector *OperatorRewardsCollectorCaller) GetBalance(opts *bind.CallOpts, operator common.Address) (*big.Int, error) { var out []interface{} - err := _OperatorRewardsCollector.contract.Call(opts, &out, "DEFAULT_ADMIN_ROLE") - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. -// -// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) -func (_OperatorRewardsCollector *OperatorRewardsCollectorSession) DEFAULTADMINROLE() ([32]byte, error) { - return _OperatorRewardsCollector.Contract.DEFAULTADMINROLE(&_OperatorRewardsCollector.CallOpts) -} - -// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. -// -// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) -func (_OperatorRewardsCollector *OperatorRewardsCollectorCallerSession) DEFAULTADMINROLE() ([32]byte, error) { - return _OperatorRewardsCollector.Contract.DEFAULTADMINROLE(&_OperatorRewardsCollector.CallOpts) -} - -// Balances is a free data retrieval call binding the contract method 0x27e235e3. -// -// Solidity: function balances(address ) view returns(uint256) -func (_OperatorRewardsCollector *OperatorRewardsCollectorCaller) Balances(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) { - var out []interface{} - err := _OperatorRewardsCollector.contract.Call(opts, &out, "balances", arg0) + err := _OperatorRewardsCollector.contract.Call(opts, &out, "getBalance", operator) if err != nil { return *new(*big.Int), err @@ -228,142 +197,18 @@ func (_OperatorRewardsCollector *OperatorRewardsCollectorCaller) Balances(opts * } -// Balances is a free data retrieval call binding the contract method 0x27e235e3. -// -// Solidity: function balances(address ) view returns(uint256) -func (_OperatorRewardsCollector *OperatorRewardsCollectorSession) Balances(arg0 common.Address) (*big.Int, error) { - return _OperatorRewardsCollector.Contract.Balances(&_OperatorRewardsCollector.CallOpts, arg0) -} - -// Balances is a free data retrieval call binding the contract method 0x27e235e3. -// -// Solidity: function balances(address ) view returns(uint256) -func (_OperatorRewardsCollector *OperatorRewardsCollectorCallerSession) Balances(arg0 common.Address) (*big.Int, error) { - return _OperatorRewardsCollector.Contract.Balances(&_OperatorRewardsCollector.CallOpts, arg0) -} - -// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. -// -// Solidity: function getRoleAdmin(bytes32 role) view returns(bytes32) -func (_OperatorRewardsCollector *OperatorRewardsCollectorCaller) GetRoleAdmin(opts *bind.CallOpts, role [32]byte) ([32]byte, error) { - var out []interface{} - err := _OperatorRewardsCollector.contract.Call(opts, &out, "getRoleAdmin", role) - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. -// -// Solidity: function getRoleAdmin(bytes32 role) view returns(bytes32) -func (_OperatorRewardsCollector *OperatorRewardsCollectorSession) GetRoleAdmin(role [32]byte) ([32]byte, error) { - return _OperatorRewardsCollector.Contract.GetRoleAdmin(&_OperatorRewardsCollector.CallOpts, role) -} - -// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. -// -// Solidity: function getRoleAdmin(bytes32 role) view returns(bytes32) -func (_OperatorRewardsCollector *OperatorRewardsCollectorCallerSession) GetRoleAdmin(role [32]byte) ([32]byte, error) { - return _OperatorRewardsCollector.Contract.GetRoleAdmin(&_OperatorRewardsCollector.CallOpts, role) -} - -// HasRole is a free data retrieval call binding the contract method 0x91d14854. -// -// Solidity: function hasRole(bytes32 role, address account) view returns(bool) -func (_OperatorRewardsCollector *OperatorRewardsCollectorCaller) HasRole(opts *bind.CallOpts, role [32]byte, account common.Address) (bool, error) { - var out []interface{} - err := _OperatorRewardsCollector.contract.Call(opts, &out, "hasRole", role, account) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// HasRole is a free data retrieval call binding the contract method 0x91d14854. -// -// Solidity: function hasRole(bytes32 role, address account) view returns(bool) -func (_OperatorRewardsCollector *OperatorRewardsCollectorSession) HasRole(role [32]byte, account common.Address) (bool, error) { - return _OperatorRewardsCollector.Contract.HasRole(&_OperatorRewardsCollector.CallOpts, role, account) -} - -// HasRole is a free data retrieval call binding the contract method 0x91d14854. -// -// Solidity: function hasRole(bytes32 role, address account) view returns(bool) -func (_OperatorRewardsCollector *OperatorRewardsCollectorCallerSession) HasRole(role [32]byte, account common.Address) (bool, error) { - return _OperatorRewardsCollector.Contract.HasRole(&_OperatorRewardsCollector.CallOpts, role, account) -} - -// StaderConfig is a free data retrieval call binding the contract method 0x490ffa35. -// -// Solidity: function staderConfig() view returns(address) -func (_OperatorRewardsCollector *OperatorRewardsCollectorCaller) StaderConfig(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _OperatorRewardsCollector.contract.Call(opts, &out, "staderConfig") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// StaderConfig is a free data retrieval call binding the contract method 0x490ffa35. -// -// Solidity: function staderConfig() view returns(address) -func (_OperatorRewardsCollector *OperatorRewardsCollectorSession) StaderConfig() (common.Address, error) { - return _OperatorRewardsCollector.Contract.StaderConfig(&_OperatorRewardsCollector.CallOpts) -} - -// StaderConfig is a free data retrieval call binding the contract method 0x490ffa35. -// -// Solidity: function staderConfig() view returns(address) -func (_OperatorRewardsCollector *OperatorRewardsCollectorCallerSession) StaderConfig() (common.Address, error) { - return _OperatorRewardsCollector.Contract.StaderConfig(&_OperatorRewardsCollector.CallOpts) -} - -// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. -// -// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) -func (_OperatorRewardsCollector *OperatorRewardsCollectorCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { - var out []interface{} - err := _OperatorRewardsCollector.contract.Call(opts, &out, "supportsInterface", interfaceId) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// GetBalance is a free data retrieval call binding the contract method 0xf8b2cb4f. // -// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) -func (_OperatorRewardsCollector *OperatorRewardsCollectorSession) SupportsInterface(interfaceId [4]byte) (bool, error) { - return _OperatorRewardsCollector.Contract.SupportsInterface(&_OperatorRewardsCollector.CallOpts, interfaceId) +// Solidity: function getBalance(address operator) view returns(uint256) +func (_OperatorRewardsCollector *OperatorRewardsCollectorSession) GetBalance(operator common.Address) (*big.Int, error) { + return _OperatorRewardsCollector.Contract.GetBalance(&_OperatorRewardsCollector.CallOpts, operator) } -// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// GetBalance is a free data retrieval call binding the contract method 0xf8b2cb4f. // -// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) -func (_OperatorRewardsCollector *OperatorRewardsCollectorCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { - return _OperatorRewardsCollector.Contract.SupportsInterface(&_OperatorRewardsCollector.CallOpts, interfaceId) +// Solidity: function getBalance(address operator) view returns(uint256) +func (_OperatorRewardsCollector *OperatorRewardsCollectorCallerSession) GetBalance(operator common.Address) (*big.Int, error) { + return _OperatorRewardsCollector.Contract.GetBalance(&_OperatorRewardsCollector.CallOpts, operator) } // WithdrawableInEth is a free data retrieval call binding the contract method 0x96198d0f. @@ -418,46 +263,46 @@ func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactorSession) Clai return _OperatorRewardsCollector.Contract.Claim(&_OperatorRewardsCollector.TransactOpts) } -// ClaimFor is a paid mutator transaction binding the contract method 0x0de05659. +// ClaimLiquidation is a paid mutator transaction binding the contract method 0x1cc1c626. // -// Solidity: function claimFor(address operator, uint256 amount) returns() -func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactor) ClaimFor(opts *bind.TransactOpts, operator common.Address, amount *big.Int) (*types.Transaction, error) { - return _OperatorRewardsCollector.contract.Transact(opts, "claimFor", operator, amount) +// Solidity: function claimLiquidation(address operator) returns() +func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactor) ClaimLiquidation(opts *bind.TransactOpts, operator common.Address) (*types.Transaction, error) { + return _OperatorRewardsCollector.contract.Transact(opts, "claimLiquidation", operator) } -// ClaimFor is a paid mutator transaction binding the contract method 0x0de05659. +// ClaimLiquidation is a paid mutator transaction binding the contract method 0x1cc1c626. // -// Solidity: function claimFor(address operator, uint256 amount) returns() -func (_OperatorRewardsCollector *OperatorRewardsCollectorSession) ClaimFor(operator common.Address, amount *big.Int) (*types.Transaction, error) { - return _OperatorRewardsCollector.Contract.ClaimFor(&_OperatorRewardsCollector.TransactOpts, operator, amount) +// Solidity: function claimLiquidation(address operator) returns() +func (_OperatorRewardsCollector *OperatorRewardsCollectorSession) ClaimLiquidation(operator common.Address) (*types.Transaction, error) { + return _OperatorRewardsCollector.Contract.ClaimLiquidation(&_OperatorRewardsCollector.TransactOpts, operator) } -// ClaimFor is a paid mutator transaction binding the contract method 0x0de05659. +// ClaimLiquidation is a paid mutator transaction binding the contract method 0x1cc1c626. // -// Solidity: function claimFor(address operator, uint256 amount) returns() -func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactorSession) ClaimFor(operator common.Address, amount *big.Int) (*types.Transaction, error) { - return _OperatorRewardsCollector.Contract.ClaimFor(&_OperatorRewardsCollector.TransactOpts, operator, amount) +// Solidity: function claimLiquidation(address operator) returns() +func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactorSession) ClaimLiquidation(operator common.Address) (*types.Transaction, error) { + return _OperatorRewardsCollector.Contract.ClaimLiquidation(&_OperatorRewardsCollector.TransactOpts, operator) } -// ClaimLiquidation is a paid mutator transaction binding the contract method 0xb86d3808. +// ClaimWithAmount is a paid mutator transaction binding the contract method 0xa4557a11. // -// Solidity: function claimLiquidation(uint256 liquidatorAmount, uint256 feeAmount, address liquidator) returns() -func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactor) ClaimLiquidation(opts *bind.TransactOpts, liquidatorAmount *big.Int, feeAmount *big.Int, liquidator common.Address) (*types.Transaction, error) { - return _OperatorRewardsCollector.contract.Transact(opts, "claimLiquidation", liquidatorAmount, feeAmount, liquidator) +// Solidity: function claimWithAmount(uint256 _amount) returns() +func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactor) ClaimWithAmount(opts *bind.TransactOpts, _amount *big.Int) (*types.Transaction, error) { + return _OperatorRewardsCollector.contract.Transact(opts, "claimWithAmount", _amount) } -// ClaimLiquidation is a paid mutator transaction binding the contract method 0xb86d3808. +// ClaimWithAmount is a paid mutator transaction binding the contract method 0xa4557a11. // -// Solidity: function claimLiquidation(uint256 liquidatorAmount, uint256 feeAmount, address liquidator) returns() -func (_OperatorRewardsCollector *OperatorRewardsCollectorSession) ClaimLiquidation(liquidatorAmount *big.Int, feeAmount *big.Int, liquidator common.Address) (*types.Transaction, error) { - return _OperatorRewardsCollector.Contract.ClaimLiquidation(&_OperatorRewardsCollector.TransactOpts, liquidatorAmount, feeAmount, liquidator) +// Solidity: function claimWithAmount(uint256 _amount) returns() +func (_OperatorRewardsCollector *OperatorRewardsCollectorSession) ClaimWithAmount(_amount *big.Int) (*types.Transaction, error) { + return _OperatorRewardsCollector.Contract.ClaimWithAmount(&_OperatorRewardsCollector.TransactOpts, _amount) } -// ClaimLiquidation is a paid mutator transaction binding the contract method 0xb86d3808. +// ClaimWithAmount is a paid mutator transaction binding the contract method 0xa4557a11. // -// Solidity: function claimLiquidation(uint256 liquidatorAmount, uint256 feeAmount, address liquidator) returns() -func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactorSession) ClaimLiquidation(liquidatorAmount *big.Int, feeAmount *big.Int, liquidator common.Address) (*types.Transaction, error) { - return _OperatorRewardsCollector.Contract.ClaimLiquidation(&_OperatorRewardsCollector.TransactOpts, liquidatorAmount, feeAmount, liquidator) +// Solidity: function claimWithAmount(uint256 _amount) returns() +func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactorSession) ClaimWithAmount(_amount *big.Int) (*types.Transaction, error) { + return _OperatorRewardsCollector.Contract.ClaimWithAmount(&_OperatorRewardsCollector.TransactOpts, _amount) } // DepositFor is a paid mutator transaction binding the contract method 0xaa67c919. @@ -481,111 +326,6 @@ func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactorSession) Depo return _OperatorRewardsCollector.Contract.DepositFor(&_OperatorRewardsCollector.TransactOpts, _receiver) } -// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. -// -// Solidity: function grantRole(bytes32 role, address account) returns() -func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactor) GrantRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) { - return _OperatorRewardsCollector.contract.Transact(opts, "grantRole", role, account) -} - -// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. -// -// Solidity: function grantRole(bytes32 role, address account) returns() -func (_OperatorRewardsCollector *OperatorRewardsCollectorSession) GrantRole(role [32]byte, account common.Address) (*types.Transaction, error) { - return _OperatorRewardsCollector.Contract.GrantRole(&_OperatorRewardsCollector.TransactOpts, role, account) -} - -// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. -// -// Solidity: function grantRole(bytes32 role, address account) returns() -func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactorSession) GrantRole(role [32]byte, account common.Address) (*types.Transaction, error) { - return _OperatorRewardsCollector.Contract.GrantRole(&_OperatorRewardsCollector.TransactOpts, role, account) -} - -// Initialize is a paid mutator transaction binding the contract method 0x485cc955. -// -// Solidity: function initialize(address _admin, address _staderConfig) returns() -func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactor) Initialize(opts *bind.TransactOpts, _admin common.Address, _staderConfig common.Address) (*types.Transaction, error) { - return _OperatorRewardsCollector.contract.Transact(opts, "initialize", _admin, _staderConfig) -} - -// Initialize is a paid mutator transaction binding the contract method 0x485cc955. -// -// Solidity: function initialize(address _admin, address _staderConfig) returns() -func (_OperatorRewardsCollector *OperatorRewardsCollectorSession) Initialize(_admin common.Address, _staderConfig common.Address) (*types.Transaction, error) { - return _OperatorRewardsCollector.Contract.Initialize(&_OperatorRewardsCollector.TransactOpts, _admin, _staderConfig) -} - -// Initialize is a paid mutator transaction binding the contract method 0x485cc955. -// -// Solidity: function initialize(address _admin, address _staderConfig) returns() -func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactorSession) Initialize(_admin common.Address, _staderConfig common.Address) (*types.Transaction, error) { - return _OperatorRewardsCollector.Contract.Initialize(&_OperatorRewardsCollector.TransactOpts, _admin, _staderConfig) -} - -// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. -// -// Solidity: function renounceRole(bytes32 role, address account) returns() -func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactor) RenounceRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) { - return _OperatorRewardsCollector.contract.Transact(opts, "renounceRole", role, account) -} - -// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. -// -// Solidity: function renounceRole(bytes32 role, address account) returns() -func (_OperatorRewardsCollector *OperatorRewardsCollectorSession) RenounceRole(role [32]byte, account common.Address) (*types.Transaction, error) { - return _OperatorRewardsCollector.Contract.RenounceRole(&_OperatorRewardsCollector.TransactOpts, role, account) -} - -// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. -// -// Solidity: function renounceRole(bytes32 role, address account) returns() -func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactorSession) RenounceRole(role [32]byte, account common.Address) (*types.Transaction, error) { - return _OperatorRewardsCollector.Contract.RenounceRole(&_OperatorRewardsCollector.TransactOpts, role, account) -} - -// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. -// -// Solidity: function revokeRole(bytes32 role, address account) returns() -func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactor) RevokeRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) { - return _OperatorRewardsCollector.contract.Transact(opts, "revokeRole", role, account) -} - -// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. -// -// Solidity: function revokeRole(bytes32 role, address account) returns() -func (_OperatorRewardsCollector *OperatorRewardsCollectorSession) RevokeRole(role [32]byte, account common.Address) (*types.Transaction, error) { - return _OperatorRewardsCollector.Contract.RevokeRole(&_OperatorRewardsCollector.TransactOpts, role, account) -} - -// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. -// -// Solidity: function revokeRole(bytes32 role, address account) returns() -func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactorSession) RevokeRole(role [32]byte, account common.Address) (*types.Transaction, error) { - return _OperatorRewardsCollector.Contract.RevokeRole(&_OperatorRewardsCollector.TransactOpts, role, account) -} - -// UpdateStaderConfig is a paid mutator transaction binding the contract method 0x9ee804cb. -// -// Solidity: function updateStaderConfig(address _staderConfig) returns() -func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactor) UpdateStaderConfig(opts *bind.TransactOpts, _staderConfig common.Address) (*types.Transaction, error) { - return _OperatorRewardsCollector.contract.Transact(opts, "updateStaderConfig", _staderConfig) -} - -// UpdateStaderConfig is a paid mutator transaction binding the contract method 0x9ee804cb. -// -// Solidity: function updateStaderConfig(address _staderConfig) returns() -func (_OperatorRewardsCollector *OperatorRewardsCollectorSession) UpdateStaderConfig(_staderConfig common.Address) (*types.Transaction, error) { - return _OperatorRewardsCollector.Contract.UpdateStaderConfig(&_OperatorRewardsCollector.TransactOpts, _staderConfig) -} - -// UpdateStaderConfig is a paid mutator transaction binding the contract method 0x9ee804cb. -// -// Solidity: function updateStaderConfig(address _staderConfig) returns() -func (_OperatorRewardsCollector *OperatorRewardsCollectorTransactorSession) UpdateStaderConfig(_staderConfig common.Address) (*types.Transaction, error) { - return _OperatorRewardsCollector.Contract.UpdateStaderConfig(&_OperatorRewardsCollector.TransactOpts, _staderConfig) -} - // OperatorRewardsCollectorClaimedIterator is returned from FilterClaimed and is used to iterate over the raw logs and unpacked data for Claimed events raised by the OperatorRewardsCollector contract. type OperatorRewardsCollectorClaimedIterator struct { Event *OperatorRewardsCollectorClaimed // Event containing the contract specifics and raw log @@ -885,9 +625,9 @@ func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) ParseDeposite return event, nil } -// OperatorRewardsCollectorInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the OperatorRewardsCollector contract. -type OperatorRewardsCollectorInitializedIterator struct { - Event *OperatorRewardsCollectorInitialized // Event containing the contract specifics and raw log +// OperatorRewardsCollectorUpdatedStaderConfigIterator is returned from FilterUpdatedStaderConfig and is used to iterate over the raw logs and unpacked data for UpdatedStaderConfig events raised by the OperatorRewardsCollector contract. +type OperatorRewardsCollectorUpdatedStaderConfigIterator struct { + Event *OperatorRewardsCollectorUpdatedStaderConfig // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -901,7 +641,7 @@ type OperatorRewardsCollectorInitializedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *OperatorRewardsCollectorInitializedIterator) Next() bool { +func (it *OperatorRewardsCollectorUpdatedStaderConfigIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -910,7 +650,7 @@ func (it *OperatorRewardsCollectorInitializedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(OperatorRewardsCollectorInitialized) + it.Event = new(OperatorRewardsCollectorUpdatedStaderConfig) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -925,7 +665,7 @@ func (it *OperatorRewardsCollectorInitializedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(OperatorRewardsCollectorInitialized) + it.Event = new(OperatorRewardsCollectorUpdatedStaderConfig) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -941,41 +681,51 @@ func (it *OperatorRewardsCollectorInitializedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *OperatorRewardsCollectorInitializedIterator) Error() error { +func (it *OperatorRewardsCollectorUpdatedStaderConfigIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *OperatorRewardsCollectorInitializedIterator) Close() error { +func (it *OperatorRewardsCollectorUpdatedStaderConfigIterator) Close() error { it.sub.Unsubscribe() return nil } -// OperatorRewardsCollectorInitialized represents a Initialized event raised by the OperatorRewardsCollector contract. -type OperatorRewardsCollectorInitialized struct { - Version uint8 - Raw types.Log // Blockchain specific contextual infos +// OperatorRewardsCollectorUpdatedStaderConfig represents a UpdatedStaderConfig event raised by the OperatorRewardsCollector contract. +type OperatorRewardsCollectorUpdatedStaderConfig struct { + StaderConfig common.Address + Raw types.Log // Blockchain specific contextual infos } -// FilterInitialized is a free log retrieval operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// FilterUpdatedStaderConfig is a free log retrieval operation binding the contract event 0xdb2219043d7b197cb235f1af0cf6d782d77dee3de19e3f4fb6d39aae633b4485. // -// Solidity: event Initialized(uint8 version) -func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) FilterInitialized(opts *bind.FilterOpts) (*OperatorRewardsCollectorInitializedIterator, error) { +// Solidity: event UpdatedStaderConfig(address indexed staderConfig) +func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) FilterUpdatedStaderConfig(opts *bind.FilterOpts, staderConfig []common.Address) (*OperatorRewardsCollectorUpdatedStaderConfigIterator, error) { + + var staderConfigRule []interface{} + for _, staderConfigItem := range staderConfig { + staderConfigRule = append(staderConfigRule, staderConfigItem) + } - logs, sub, err := _OperatorRewardsCollector.contract.FilterLogs(opts, "Initialized") + logs, sub, err := _OperatorRewardsCollector.contract.FilterLogs(opts, "UpdatedStaderConfig", staderConfigRule) if err != nil { return nil, err } - return &OperatorRewardsCollectorInitializedIterator{contract: _OperatorRewardsCollector.contract, event: "Initialized", logs: logs, sub: sub}, nil + return &OperatorRewardsCollectorUpdatedStaderConfigIterator{contract: _OperatorRewardsCollector.contract, event: "UpdatedStaderConfig", logs: logs, sub: sub}, nil } -// WatchInitialized is a free log subscription operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// WatchUpdatedStaderConfig is a free log subscription operation binding the contract event 0xdb2219043d7b197cb235f1af0cf6d782d77dee3de19e3f4fb6d39aae633b4485. // -// Solidity: event Initialized(uint8 version) -func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *OperatorRewardsCollectorInitialized) (event.Subscription, error) { +// Solidity: event UpdatedStaderConfig(address indexed staderConfig) +func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) WatchUpdatedStaderConfig(opts *bind.WatchOpts, sink chan<- *OperatorRewardsCollectorUpdatedStaderConfig, staderConfig []common.Address) (event.Subscription, error) { + + var staderConfigRule []interface{} + for _, staderConfigItem := range staderConfig { + staderConfigRule = append(staderConfigRule, staderConfigItem) + } - logs, sub, err := _OperatorRewardsCollector.contract.WatchLogs(opts, "Initialized") + logs, sub, err := _OperatorRewardsCollector.contract.WatchLogs(opts, "UpdatedStaderConfig", staderConfigRule) if err != nil { return nil, err } @@ -985,8 +735,8 @@ func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) WatchInitiali select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(OperatorRewardsCollectorInitialized) - if err := _OperatorRewardsCollector.contract.UnpackLog(event, "Initialized", log); err != nil { + event := new(OperatorRewardsCollectorUpdatedStaderConfig) + if err := _OperatorRewardsCollector.contract.UnpackLog(event, "UpdatedStaderConfig", log); err != nil { return err } event.Raw = log @@ -1007,21 +757,21 @@ func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) WatchInitiali }), nil } -// ParseInitialized is a log parse operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// ParseUpdatedStaderConfig is a log parse operation binding the contract event 0xdb2219043d7b197cb235f1af0cf6d782d77dee3de19e3f4fb6d39aae633b4485. // -// Solidity: event Initialized(uint8 version) -func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) ParseInitialized(log types.Log) (*OperatorRewardsCollectorInitialized, error) { - event := new(OperatorRewardsCollectorInitialized) - if err := _OperatorRewardsCollector.contract.UnpackLog(event, "Initialized", log); err != nil { +// Solidity: event UpdatedStaderConfig(address indexed staderConfig) +func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) ParseUpdatedStaderConfig(log types.Log) (*OperatorRewardsCollectorUpdatedStaderConfig, error) { + event := new(OperatorRewardsCollectorUpdatedStaderConfig) + if err := _OperatorRewardsCollector.contract.UnpackLog(event, "UpdatedStaderConfig", log); err != nil { return nil, err } event.Raw = log return event, nil } -// OperatorRewardsCollectorRoleAdminChangedIterator is returned from FilterRoleAdminChanged and is used to iterate over the raw logs and unpacked data for RoleAdminChanged events raised by the OperatorRewardsCollector contract. -type OperatorRewardsCollectorRoleAdminChangedIterator struct { - Event *OperatorRewardsCollectorRoleAdminChanged // Event containing the contract specifics and raw log +// OperatorRewardsCollectorUpdatedWethAddressIterator is returned from FilterUpdatedWethAddress and is used to iterate over the raw logs and unpacked data for UpdatedWethAddress events raised by the OperatorRewardsCollector contract. +type OperatorRewardsCollectorUpdatedWethAddressIterator struct { + Event *OperatorRewardsCollectorUpdatedWethAddress // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1035,7 +785,7 @@ type OperatorRewardsCollectorRoleAdminChangedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *OperatorRewardsCollectorRoleAdminChangedIterator) Next() bool { +func (it *OperatorRewardsCollectorUpdatedWethAddressIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1044,7 +794,7 @@ func (it *OperatorRewardsCollectorRoleAdminChangedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(OperatorRewardsCollectorRoleAdminChanged) + it.Event = new(OperatorRewardsCollectorUpdatedWethAddress) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1059,7 +809,7 @@ func (it *OperatorRewardsCollectorRoleAdminChangedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(OperatorRewardsCollectorRoleAdminChanged) + it.Event = new(OperatorRewardsCollectorUpdatedWethAddress) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1075,69 +825,51 @@ func (it *OperatorRewardsCollectorRoleAdminChangedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *OperatorRewardsCollectorRoleAdminChangedIterator) Error() error { +func (it *OperatorRewardsCollectorUpdatedWethAddressIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *OperatorRewardsCollectorRoleAdminChangedIterator) Close() error { +func (it *OperatorRewardsCollectorUpdatedWethAddressIterator) Close() error { it.sub.Unsubscribe() return nil } -// OperatorRewardsCollectorRoleAdminChanged represents a RoleAdminChanged event raised by the OperatorRewardsCollector contract. -type OperatorRewardsCollectorRoleAdminChanged struct { - Role [32]byte - PreviousAdminRole [32]byte - NewAdminRole [32]byte - Raw types.Log // Blockchain specific contextual infos +// OperatorRewardsCollectorUpdatedWethAddress represents a UpdatedWethAddress event raised by the OperatorRewardsCollector contract. +type OperatorRewardsCollectorUpdatedWethAddress struct { + Weth common.Address + Raw types.Log // Blockchain specific contextual infos } -// FilterRoleAdminChanged is a free log retrieval operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. +// FilterUpdatedWethAddress is a free log retrieval operation binding the contract event 0xa1de212dff029f064e368842c50f600a79a6958de54219159b77f9fa9b84e023. // -// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) -func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) FilterRoleAdminChanged(opts *bind.FilterOpts, role [][32]byte, previousAdminRole [][32]byte, newAdminRole [][32]byte) (*OperatorRewardsCollectorRoleAdminChangedIterator, error) { +// Solidity: event UpdatedWethAddress(address indexed weth) +func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) FilterUpdatedWethAddress(opts *bind.FilterOpts, weth []common.Address) (*OperatorRewardsCollectorUpdatedWethAddressIterator, error) { - var roleRule []interface{} - for _, roleItem := range role { - roleRule = append(roleRule, roleItem) - } - var previousAdminRoleRule []interface{} - for _, previousAdminRoleItem := range previousAdminRole { - previousAdminRoleRule = append(previousAdminRoleRule, previousAdminRoleItem) - } - var newAdminRoleRule []interface{} - for _, newAdminRoleItem := range newAdminRole { - newAdminRoleRule = append(newAdminRoleRule, newAdminRoleItem) + var wethRule []interface{} + for _, wethItem := range weth { + wethRule = append(wethRule, wethItem) } - logs, sub, err := _OperatorRewardsCollector.contract.FilterLogs(opts, "RoleAdminChanged", roleRule, previousAdminRoleRule, newAdminRoleRule) + logs, sub, err := _OperatorRewardsCollector.contract.FilterLogs(opts, "UpdatedWethAddress", wethRule) if err != nil { return nil, err } - return &OperatorRewardsCollectorRoleAdminChangedIterator{contract: _OperatorRewardsCollector.contract, event: "RoleAdminChanged", logs: logs, sub: sub}, nil + return &OperatorRewardsCollectorUpdatedWethAddressIterator{contract: _OperatorRewardsCollector.contract, event: "UpdatedWethAddress", logs: logs, sub: sub}, nil } -// WatchRoleAdminChanged is a free log subscription operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. +// WatchUpdatedWethAddress is a free log subscription operation binding the contract event 0xa1de212dff029f064e368842c50f600a79a6958de54219159b77f9fa9b84e023. // -// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) -func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) WatchRoleAdminChanged(opts *bind.WatchOpts, sink chan<- *OperatorRewardsCollectorRoleAdminChanged, role [][32]byte, previousAdminRole [][32]byte, newAdminRole [][32]byte) (event.Subscription, error) { +// Solidity: event UpdatedWethAddress(address indexed weth) +func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) WatchUpdatedWethAddress(opts *bind.WatchOpts, sink chan<- *OperatorRewardsCollectorUpdatedWethAddress, weth []common.Address) (event.Subscription, error) { - var roleRule []interface{} - for _, roleItem := range role { - roleRule = append(roleRule, roleItem) - } - var previousAdminRoleRule []interface{} - for _, previousAdminRoleItem := range previousAdminRole { - previousAdminRoleRule = append(previousAdminRoleRule, previousAdminRoleItem) - } - var newAdminRoleRule []interface{} - for _, newAdminRoleItem := range newAdminRole { - newAdminRoleRule = append(newAdminRoleRule, newAdminRoleItem) + var wethRule []interface{} + for _, wethItem := range weth { + wethRule = append(wethRule, wethItem) } - logs, sub, err := _OperatorRewardsCollector.contract.WatchLogs(opts, "RoleAdminChanged", roleRule, previousAdminRoleRule, newAdminRoleRule) + logs, sub, err := _OperatorRewardsCollector.contract.WatchLogs(opts, "UpdatedWethAddress", wethRule) if err != nil { return nil, err } @@ -1147,8 +879,8 @@ func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) WatchRoleAdmi select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(OperatorRewardsCollectorRoleAdminChanged) - if err := _OperatorRewardsCollector.contract.UnpackLog(event, "RoleAdminChanged", log); err != nil { + event := new(OperatorRewardsCollectorUpdatedWethAddress) + if err := _OperatorRewardsCollector.contract.UnpackLog(event, "UpdatedWethAddress", log); err != nil { return err } event.Raw = log @@ -1169,480 +901,12 @@ func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) WatchRoleAdmi }), nil } -// ParseRoleAdminChanged is a log parse operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. -// -// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) -func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) ParseRoleAdminChanged(log types.Log) (*OperatorRewardsCollectorRoleAdminChanged, error) { - event := new(OperatorRewardsCollectorRoleAdminChanged) - if err := _OperatorRewardsCollector.contract.UnpackLog(event, "RoleAdminChanged", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// OperatorRewardsCollectorRoleGrantedIterator is returned from FilterRoleGranted and is used to iterate over the raw logs and unpacked data for RoleGranted events raised by the OperatorRewardsCollector contract. -type OperatorRewardsCollectorRoleGrantedIterator struct { - Event *OperatorRewardsCollectorRoleGranted // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *OperatorRewardsCollectorRoleGrantedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(OperatorRewardsCollectorRoleGranted) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(OperatorRewardsCollectorRoleGranted) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *OperatorRewardsCollectorRoleGrantedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *OperatorRewardsCollectorRoleGrantedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// OperatorRewardsCollectorRoleGranted represents a RoleGranted event raised by the OperatorRewardsCollector contract. -type OperatorRewardsCollectorRoleGranted struct { - Role [32]byte - Account common.Address - Sender common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterRoleGranted is a free log retrieval operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. +// ParseUpdatedWethAddress is a log parse operation binding the contract event 0xa1de212dff029f064e368842c50f600a79a6958de54219159b77f9fa9b84e023. // -// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) -func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) FilterRoleGranted(opts *bind.FilterOpts, role [][32]byte, account []common.Address, sender []common.Address) (*OperatorRewardsCollectorRoleGrantedIterator, error) { - - var roleRule []interface{} - for _, roleItem := range role { - roleRule = append(roleRule, roleItem) - } - var accountRule []interface{} - for _, accountItem := range account { - accountRule = append(accountRule, accountItem) - } - var senderRule []interface{} - for _, senderItem := range sender { - senderRule = append(senderRule, senderItem) - } - - logs, sub, err := _OperatorRewardsCollector.contract.FilterLogs(opts, "RoleGranted", roleRule, accountRule, senderRule) - if err != nil { - return nil, err - } - return &OperatorRewardsCollectorRoleGrantedIterator{contract: _OperatorRewardsCollector.contract, event: "RoleGranted", logs: logs, sub: sub}, nil -} - -// WatchRoleGranted is a free log subscription operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. -// -// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) -func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) WatchRoleGranted(opts *bind.WatchOpts, sink chan<- *OperatorRewardsCollectorRoleGranted, role [][32]byte, account []common.Address, sender []common.Address) (event.Subscription, error) { - - var roleRule []interface{} - for _, roleItem := range role { - roleRule = append(roleRule, roleItem) - } - var accountRule []interface{} - for _, accountItem := range account { - accountRule = append(accountRule, accountItem) - } - var senderRule []interface{} - for _, senderItem := range sender { - senderRule = append(senderRule, senderItem) - } - - logs, sub, err := _OperatorRewardsCollector.contract.WatchLogs(opts, "RoleGranted", roleRule, accountRule, senderRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(OperatorRewardsCollectorRoleGranted) - if err := _OperatorRewardsCollector.contract.UnpackLog(event, "RoleGranted", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseRoleGranted is a log parse operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. -// -// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) -func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) ParseRoleGranted(log types.Log) (*OperatorRewardsCollectorRoleGranted, error) { - event := new(OperatorRewardsCollectorRoleGranted) - if err := _OperatorRewardsCollector.contract.UnpackLog(event, "RoleGranted", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// OperatorRewardsCollectorRoleRevokedIterator is returned from FilterRoleRevoked and is used to iterate over the raw logs and unpacked data for RoleRevoked events raised by the OperatorRewardsCollector contract. -type OperatorRewardsCollectorRoleRevokedIterator struct { - Event *OperatorRewardsCollectorRoleRevoked // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *OperatorRewardsCollectorRoleRevokedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(OperatorRewardsCollectorRoleRevoked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(OperatorRewardsCollectorRoleRevoked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *OperatorRewardsCollectorRoleRevokedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *OperatorRewardsCollectorRoleRevokedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// OperatorRewardsCollectorRoleRevoked represents a RoleRevoked event raised by the OperatorRewardsCollector contract. -type OperatorRewardsCollectorRoleRevoked struct { - Role [32]byte - Account common.Address - Sender common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterRoleRevoked is a free log retrieval operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. -// -// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) -func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) FilterRoleRevoked(opts *bind.FilterOpts, role [][32]byte, account []common.Address, sender []common.Address) (*OperatorRewardsCollectorRoleRevokedIterator, error) { - - var roleRule []interface{} - for _, roleItem := range role { - roleRule = append(roleRule, roleItem) - } - var accountRule []interface{} - for _, accountItem := range account { - accountRule = append(accountRule, accountItem) - } - var senderRule []interface{} - for _, senderItem := range sender { - senderRule = append(senderRule, senderItem) - } - - logs, sub, err := _OperatorRewardsCollector.contract.FilterLogs(opts, "RoleRevoked", roleRule, accountRule, senderRule) - if err != nil { - return nil, err - } - return &OperatorRewardsCollectorRoleRevokedIterator{contract: _OperatorRewardsCollector.contract, event: "RoleRevoked", logs: logs, sub: sub}, nil -} - -// WatchRoleRevoked is a free log subscription operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. -// -// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) -func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) WatchRoleRevoked(opts *bind.WatchOpts, sink chan<- *OperatorRewardsCollectorRoleRevoked, role [][32]byte, account []common.Address, sender []common.Address) (event.Subscription, error) { - - var roleRule []interface{} - for _, roleItem := range role { - roleRule = append(roleRule, roleItem) - } - var accountRule []interface{} - for _, accountItem := range account { - accountRule = append(accountRule, accountItem) - } - var senderRule []interface{} - for _, senderItem := range sender { - senderRule = append(senderRule, senderItem) - } - - logs, sub, err := _OperatorRewardsCollector.contract.WatchLogs(opts, "RoleRevoked", roleRule, accountRule, senderRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(OperatorRewardsCollectorRoleRevoked) - if err := _OperatorRewardsCollector.contract.UnpackLog(event, "RoleRevoked", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseRoleRevoked is a log parse operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. -// -// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) -func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) ParseRoleRevoked(log types.Log) (*OperatorRewardsCollectorRoleRevoked, error) { - event := new(OperatorRewardsCollectorRoleRevoked) - if err := _OperatorRewardsCollector.contract.UnpackLog(event, "RoleRevoked", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// OperatorRewardsCollectorUpdatedStaderConfigIterator is returned from FilterUpdatedStaderConfig and is used to iterate over the raw logs and unpacked data for UpdatedStaderConfig events raised by the OperatorRewardsCollector contract. -type OperatorRewardsCollectorUpdatedStaderConfigIterator struct { - Event *OperatorRewardsCollectorUpdatedStaderConfig // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *OperatorRewardsCollectorUpdatedStaderConfigIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(OperatorRewardsCollectorUpdatedStaderConfig) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(OperatorRewardsCollectorUpdatedStaderConfig) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *OperatorRewardsCollectorUpdatedStaderConfigIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *OperatorRewardsCollectorUpdatedStaderConfigIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// OperatorRewardsCollectorUpdatedStaderConfig represents a UpdatedStaderConfig event raised by the OperatorRewardsCollector contract. -type OperatorRewardsCollectorUpdatedStaderConfig struct { - StaderConfig common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterUpdatedStaderConfig is a free log retrieval operation binding the contract event 0xdb2219043d7b197cb235f1af0cf6d782d77dee3de19e3f4fb6d39aae633b4485. -// -// Solidity: event UpdatedStaderConfig(address indexed staderConfig) -func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) FilterUpdatedStaderConfig(opts *bind.FilterOpts, staderConfig []common.Address) (*OperatorRewardsCollectorUpdatedStaderConfigIterator, error) { - - var staderConfigRule []interface{} - for _, staderConfigItem := range staderConfig { - staderConfigRule = append(staderConfigRule, staderConfigItem) - } - - logs, sub, err := _OperatorRewardsCollector.contract.FilterLogs(opts, "UpdatedStaderConfig", staderConfigRule) - if err != nil { - return nil, err - } - return &OperatorRewardsCollectorUpdatedStaderConfigIterator{contract: _OperatorRewardsCollector.contract, event: "UpdatedStaderConfig", logs: logs, sub: sub}, nil -} - -// WatchUpdatedStaderConfig is a free log subscription operation binding the contract event 0xdb2219043d7b197cb235f1af0cf6d782d77dee3de19e3f4fb6d39aae633b4485. -// -// Solidity: event UpdatedStaderConfig(address indexed staderConfig) -func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) WatchUpdatedStaderConfig(opts *bind.WatchOpts, sink chan<- *OperatorRewardsCollectorUpdatedStaderConfig, staderConfig []common.Address) (event.Subscription, error) { - - var staderConfigRule []interface{} - for _, staderConfigItem := range staderConfig { - staderConfigRule = append(staderConfigRule, staderConfigItem) - } - - logs, sub, err := _OperatorRewardsCollector.contract.WatchLogs(opts, "UpdatedStaderConfig", staderConfigRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(OperatorRewardsCollectorUpdatedStaderConfig) - if err := _OperatorRewardsCollector.contract.UnpackLog(event, "UpdatedStaderConfig", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseUpdatedStaderConfig is a log parse operation binding the contract event 0xdb2219043d7b197cb235f1af0cf6d782d77dee3de19e3f4fb6d39aae633b4485. -// -// Solidity: event UpdatedStaderConfig(address indexed staderConfig) -func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) ParseUpdatedStaderConfig(log types.Log) (*OperatorRewardsCollectorUpdatedStaderConfig, error) { - event := new(OperatorRewardsCollectorUpdatedStaderConfig) - if err := _OperatorRewardsCollector.contract.UnpackLog(event, "UpdatedStaderConfig", log); err != nil { +// Solidity: event UpdatedWethAddress(address indexed weth) +func (_OperatorRewardsCollector *OperatorRewardsCollectorFilterer) ParseUpdatedWethAddress(log types.Log) (*OperatorRewardsCollectorUpdatedWethAddress, error) { + event := new(OperatorRewardsCollectorUpdatedWethAddress) + if err := _OperatorRewardsCollector.contract.UnpackLog(event, "UpdatedWethAddress", log); err != nil { return nil, err } event.Raw = log diff --git a/stader-lib/node/operator.go b/stader-lib/node/operator.go index fe7a73925..5d095ec44 100644 --- a/stader-lib/node/operator.go +++ b/stader-lib/node/operator.go @@ -38,8 +38,8 @@ func ClaimOperatorRewards(orc *stader.OperatorRewardsCollectorContractManager, o return tx, nil } -func ClaimOperatorRewardsWithAmount(orc *stader.OperatorRewardsCollectorContractManager, operatorAddress common.Address, amount *big.Int, opts *bind.TransactOpts) (*types.Transaction, error) { - tx, err := orc.OperatorRewardsCollector.ClaimFor(opts, operatorAddress, amount) +func ClaimOperatorRewardsWithAmount(orc *stader.OperatorRewardsCollectorContractManager, amount *big.Int, opts *bind.TransactOpts) (*types.Transaction, error) { + tx, err := orc.OperatorRewardsCollector.ClaimWithAmount(opts, amount) if err != nil { return nil, fmt.Errorf("Could not claim operator rewards: %w", err) } @@ -152,7 +152,7 @@ func GetNextOperatorId(pnr *stader.PermissionlessNodeRegistryContractManager, op } func GetOperatorRewardsCollectorBalance(orc *stader.OperatorRewardsCollectorContractManager, operatorRewardAddress common.Address, opts *bind.CallOpts) (*big.Int, error) { - return orc.OperatorRewardsCollector.Balances(opts, operatorRewardAddress) + return orc.OperatorRewardsCollector.GetBalance(opts, operatorRewardAddress) } func GetValidatorInfosByOperator(pnr *stader.PermissionlessNodeRegistryContractManager, operatorAddress common.Address, pageNumber *big.Int, pageSize *big.Int, opts *bind.CallOpts) ([]contracts.Validator, error) {