Skip to content

Feature/migrate user token#16

Open
sujine2 wants to merge 7 commits intomainfrom
feature/migrate-user-token
Open

Feature/migrate user token#16
sujine2 wants to merge 7 commits intomainfrom
feature/migrate-user-token

Conversation

@sujine2
Copy link
Contributor

@sujine2 sujine2 commented Apr 15, 2022

User Can migrate staking token

  • When the staking pool is updated, the current pool is closed.
  • If user calls migrate function, the user receives reward and the entire amount of staked token is transferred to the new staking pool contract.
  • Only admin can set contract address to transfer the user's staking token.

return stakingPool;
};

const migrateSetStakingPool = async (
Copy link
Contributor

Choose a reason for hiding this comment

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

I think setMigrageStaking would be the better choice for a unified name convention.

return migrateTestEnv;
}

// export const setMigrateTestEnv = async (): Promise<MigrateTestEnv> => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Are those codes depreciated?

return poolData;
};

export const newGetUserData = async (
Copy link
Contributor

Choose a reason for hiding this comment

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

The new keyword is not clear. Can't this function be merged with above getPoolData and getUserData? What is the difference? I think they are same.


/// @dev Allow a user to migrate underlying tokens to next new contract
/// @notice This function is based on the openzeppelin ERC20Wrapper
function _migrateTo(address toContractAddr, uint256 amount) internal virtual returns (bool) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think _migrate is enough for the name of this function.

// Migrate next contract of user, total principal
nextContract.setPreviousPoolData(msg.sender, amount);

emit Migrate(msg.sender);
Copy link
Contributor

Choose a reason for hiding this comment

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

For making this event to be more practical, I'd recommend adding other parameters to the Migrate event


interface MigrateTestEnv extends TestEnv {
newStakingPool: StakingPoolV3;
isNew: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this field for?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants