Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug in _addStake function, added identityId to SharesMinted/Burned events #229

Merged
merged 2 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions abi/StakingV2.json
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,12 @@
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint72",
"name": "identityId",
"type": "uint72"
},
{
"indexed": true,
"internalType": "address",
Expand Down Expand Up @@ -285,6 +291,12 @@
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint72",
"name": "identityId",
"type": "uint72"
},
{
"indexed": true,
"internalType": "address",
Expand Down
11 changes: 7 additions & 4 deletions contracts/v2/Staking.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ contract StakingV2 is Named, Versioned, ContractStatus, Initializable {
uint96 newStake
);
event SharesMinted(
uint72 indexed identityId,
address indexed sharesContractAddress,
address indexed delegator,
uint256 sharesMintedAmount,
Expand All @@ -54,6 +55,7 @@ contract StakingV2 is Named, Versioned, ContractStatus, Initializable {
);
event StakeWithdrawn(uint72 indexed identityId, bytes nodeId, address indexed staker, uint96 withdrawnStakeAmount);
event SharesBurned(
uint72 indexed identityId,
address indexed sharesContractAddress,
address indexed delegator,
uint256 sharesBurnedAmount,
Expand Down Expand Up @@ -157,7 +159,7 @@ contract StakingV2 is Named, Versioned, ContractStatus, Initializable {
newStake,
withdrawalPeriodEnd
);
emit SharesBurned(address(sharesContract), msg.sender, sharesToBurn, sharesContract.totalSupply());
emit SharesBurned(identityId, address(sharesContract), msg.sender, sharesToBurn, sharesContract.totalSupply());
}

function withdrawStake(uint72 identityId) external {
Expand Down Expand Up @@ -291,13 +293,14 @@ contract StakingV2 is Named, Versioned, ContractStatus, Initializable {
ss.setTotalStake(identityId, newStake);
tknc.transferFrom(sender, address(ss), stakeAmount);

if (!sts.nodeExists(identityId) && newStake >= params.minimumStake())
if (!sts.nodeExists(identityId) && newStake >= params.minimumStake()) {
if (sts.nodesCount() >= params.shardingTableSizeLimit()) revert ShardingTableErrors.ShardingTableIsFull();

shardingTableContract.insertNode(identityId);
shardingTableContract.insertNode(identityId);
}

emit StakeIncreased(identityId, ps.getNodeId(identityId), sender, oldStake, newStake);
emit SharesMinted(address(sharesContract), sender, sharesMinted, sharesContract.totalSupply());
emit SharesMinted(identityId, address(sharesContract), sender, sharesMinted, sharesContract.totalSupply());
}

function _checkAdmin(uint72 identityId) internal view virtual {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dkg-evm-module",
"version": "4.2.2",
"version": "4.2.3",
"description": "Smart contracts for OriginTrail V6",
"main": "index.ts",
"files": [
Expand Down
Loading