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

feat: Added migrator contract and tests (SC-4769) #1

Merged
merged 8 commits into from
Feb 17, 2022

Conversation

JGcarv
Copy link
Contributor

@JGcarv JGcarv commented Feb 16, 2022

No description provided.

@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #4769: [mpl-migration] Create repo for MPL token migration.

Copy link
Contributor

@lucas-manuel lucas-manuel left a comment

Choose a reason for hiding this comment

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

Looks good! Small changes

require(ERC20Helper.transfer(newToken, msg.sender, amount_), "M:M:TRANSFER_FAILED");
}

}
Copy link
Contributor

Choose a reason for hiding this comment

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

New line

Comment on lines 19 to 20
require(ERC20Helper.transferFrom(oldToken, msg.sender, address(this), amount_), "M:M:TRANSFER_FROM_FAILED");
require(ERC20Helper.transfer(newToken, msg.sender, amount_), "M:M:TRANSFER_FAILED");
Copy link
Contributor

Choose a reason for hiding this comment

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

require(ERC20Helper.transferFrom(oldToken, msg.sender, address(this), amount_), "M:M:TRANSFER_FROM_FAILED");
require(ERC20Helper.transfer(newToken, msg.sender, amount_),                    "M:M:TRANSFER_FAILED");

address immutable oldToken;
address immutable newToken;

constructor(address old_, address new_) {
Copy link
Contributor

Choose a reason for hiding this comment

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

oldToken_, newToken_

function test_migration(uint256 amount_) external {
amount_ = constrictToRange(amount_, 1, OLD_SUPPLY);

//Mint new token to migrator
Copy link
Contributor

Choose a reason for hiding this comment

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

// Mint

amount_ = constrictToRange(amount_, 1, OLD_SUPPLY);

//Mint new token to migrator
newToken.mint(address(migrator), OLD_SUPPLY);
Copy link
Contributor

Choose a reason for hiding this comment

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

This step should be in the setUp I think

Comment on lines 168 to 172
try migrator.migrate(amount_) {
assertTrue(false, "Able to migrate without new token");
} catch Error(string memory reason) {
assertEq(reason, "M:M:TRANSFER_FAILED");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

vm.expectRevert




}
Copy link
Contributor

Choose a reason for hiding this comment

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

New line

Comment on lines 185 to 187



Copy link
Contributor

Choose a reason for hiding this comment

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

One line break

Comment on lines 174 to 175
//Mint new token to migrator
newToken.mint(address(migrator), OLD_SUPPLY);
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets move this to the setup block and then burn OLD_SUPPLY - amount_ + 1, and then mint 1 for the success case

test.sh Outdated
forge test --match "$match" -vvv --lib-paths "modules" --contracts "contracts"
Copy link
Contributor

Choose a reason for hiding this comment

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

New line

Copy link
Contributor

Choose a reason for hiding this comment

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

Dont need --contracts flag

Copy link
Contributor

Choose a reason for hiding this comment

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

Also lets try removing --lib-paths and see what happens, last time it didn't work for me but maybe new forge works

@lucas-manuel lucas-manuel merged commit 9f8566a into main Feb 17, 2022
@lucas-manuel lucas-manuel deleted the sc-4769-mpl-migration branch February 17, 2022 23:25
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