diff --git a/packages/network-contracts/contracts/OperatorTokenomics/Operator.sol b/packages/network-contracts/contracts/OperatorTokenomics/Operator.sol index f9ecdb17c..8f86f112e 100644 --- a/packages/network-contracts/contracts/OperatorTokenomics/Operator.sol +++ b/packages/network-contracts/contracts/OperatorTokenomics/Operator.sol @@ -296,13 +296,16 @@ contract Operator is Initializable, ERC2771ContextUpgradeable, IERC677Receiver, } _delegate(delegator, amount); + emit Delegated(delegator, amount); payOutQueue(0); } /** 2-step delegation: first call DATA.approve(operatorContract.address, amountWei) then this function */ function delegate(uint amountWei) external { - token.transferFrom(_msgSender(), address(this), amountWei); - _delegate(_msgSender(), amountWei); + address delegator = _msgSender(); + token.transferFrom(delegator, address(this), amountWei); + _delegate(delegator, amountWei); + emit Delegated(delegator, amountWei); payOutQueue(0); } @@ -331,7 +334,6 @@ contract Operator is Initializable, ERC2771ContextUpgradeable, IERC677Receiver, } latestDelegationTimestamp[delegator] = block.timestamp; // solhint-disable-line not-rely-on-time - emit Delegated(delegator, amountDataWei); emit BalanceUpdate(delegator, balanceOf(delegator), totalSupply(), valueWithoutEarnings()); emit OperatorValueUpdate(totalStakedIntoSponsorshipsWei - totalSlashedInSponsorshipsWei, token.balanceOf(address(this))); } diff --git a/packages/network-contracts/contracts/OperatorTokenomics/OperatorPolicies/StakeModule.sol b/packages/network-contracts/contracts/OperatorTokenomics/OperatorPolicies/StakeModule.sol index f9d85343d..2c9365330 100644 --- a/packages/network-contracts/contracts/OperatorTokenomics/OperatorPolicies/StakeModule.sol +++ b/packages/network-contracts/contracts/OperatorTokenomics/OperatorPolicies/StakeModule.sol @@ -127,7 +127,7 @@ contract StakeModule is IStakeModule, Operator { uint protocolFee = earningsDataWei * streamrConfig.protocolFeeFraction() / 1 ether; token.transfer(streamrConfig.protocolFeeBeneficiary(), protocolFee); - // "self-delegate" the operator's share === mint new operator tokens + // Self-delegate the operator's cut === mint new operator tokens // because _delegate is assumed to be called AFTER the DATA token transfer, the result of calling it is equivalent to: // 1) send operator's cut in DATA tokens to the operator (removed from DATA balance, NO burning of tokens) // 2) the operator delegates them back to the contract (added back to DATA balance, minting new tokens) diff --git a/packages/network-subgraphs/schema.graphql b/packages/network-subgraphs/schema.graphql index ca14f1fa4..10b1134d8 100644 --- a/packages/network-subgraphs/schema.graphql +++ b/packages/network-subgraphs/schema.graphql @@ -372,10 +372,10 @@ type OperatorDailyBucket @entity { "Delegators that joined today. Updated when Delegation entity is created" delegatorCountChange: Int! - "Sum of DATA tokens delegated to this operator today, by all delegators. Updated when Delegated event is fired" + "DATA value of received operator tokens, by all delegators. Updated when BalanceUpdate event is fired" totalDelegatedWei: BigInt! - "Sum of DATA tokens undelegated from this operator today, by all delegators. Updated when Undelegated event is fired" + "DATA value of sent/burned operator tokens, by all delegators. Updated when BalanceUpdate event is fired" totalUndelegatedWei: BigInt! "Sum of earnings today, less operator's share"