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

Removed Mint method #130

Merged
merged 17 commits into from Jun 2, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/Core/StakeManager.sol
Expand Up @@ -227,7 +227,7 @@ contract StakeManager is ACL, StakeStorage {
if (blockReward > 0) {
uint256 newStake = stakers[stakerId].stake+(blockReward);
_setStakerStake(stakerId, newStake, "Block Reward", epoch);
require(sch.mint(address(this), blockReward));

}
uint256 prevStakeGettingReward = stakeGettingReward;
stakeGettingReward = 0;
Expand Down
9 changes: 3 additions & 6 deletions migrations/src/postDeploymentSetup.js
@@ -1,7 +1,6 @@
const {
getdeployedContractInstance,
readDeploymentFile,
readOldDeploymentFile,
} = require('../migrationHelpers');

const {
Expand Down Expand Up @@ -44,22 +43,20 @@ module.exports = async () => {
// Only transfer tokens in testnets
if (NETWORK !== 'mainnet') {
// Add new instance of StakeManager contract & Deployer address as Minter
await schellingCoin.addMinter(stakeManagerAddress);
const initialSupply = await schellingCoin.INITIAL_SUPPLY();
await schellingCoin.addMinter(signers[0].address);
await schellingCoin.mint(stakeManagerAddress, initialSupply);
dev1644 marked this conversation as resolved.
Show resolved Hide resolved

if (SCHELLING_COIN_ADDRESS !== '') {
const { StakeManager: oldStakeManagerAddress } = await readOldDeploymentFile();

// if previous instances of Schelling Coin is reused again and again,
// then initial balance will get depleted, thus intial tokens minting is needed,
// each time Schelling Coin instance is reused
const initialSupply = await schellingCoin.INITIAL_SUPPLY();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this declaration, it is redundant to line no.46

await schellingCoin.mint(signers[0].address, initialSupply);

// Remove previous instance of StakeManager contract & Deployer address from Minter
await schellingCoin.removeMinter(oldStakeManagerAddress);
await schellingCoin.removeMinter(signers[0].address);
0xcuriousapple marked this conversation as resolved.
Show resolved Hide resolved
}
await schellingCoin.mint(stakeManagerAddress, initialSupply);
0xcuriousapple marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey
First we have to only mint mintableSupply to stakaManager, not initial supply
See
If shelling coin get deployed, deployer get complete Initial Supply minted.
Now again you mintinng here on top of it doesn't make sense.
It should be transfer

So impl as per me would


 if (SCHELLING_COIN_ADDRESS !== '') { 
 Mint Intial Supply to Signers[0]
 } 
Transfer Mintable Supply from Signers[0] to StakeManager

This would work in both cases


for (let i = 0; i < stakerAddressList.length; i++) {
const tx = await schellingCoin.transfer(stakerAddressList[i], SEED_AMOUNT);
Expand Down