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

transfer native token to sourceTokenAddress #4

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

cyl19970726
Copy link

Signed-off-by: cyl19970726 15258378443@163.com

Signed-off-by: cyl19970726 <15258378443@163.com>
Signed-off-by: cyl19970726 <15258378443@163.com>
Signed-off-by: cyl19970726 <15258378443@163.com>
Copy link
Contributor

@qizhou qizhou left a comment

Choose a reason for hiding this comment

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

Should BridgeDestination.withdraw() also handle the native token logic?

}

function buy(TransferKey memory tkey) public {
function buy(TransferKey memory tkey) public payable{
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: payable{ => payable {

@qizhou
Copy link
Contributor

qizhou commented Dec 23, 2021

Further, please use

npm run prettier:fix

to auto-format the code.

Signed-off-by: cyl19970726 <15258378443@163.com>
Signed-off-by: cyl19970726 <15258378443@163.com>
Signed-off-by: cyl19970726 <15258378443@163.com>
) {
return transferData.fee;
} else {
return transferData.fee * (currentTime - transferData.startTime);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return transferData.fee * (currentTime - transferData.startTime);
return transferData.fee * (currentTime - transferData.startTime) / transferData.feeRampup;

Copy link
Contributor

Choose a reason for hiding this comment

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

Not yet fixed?


if (tkey.transferData.tokenAddress == address(0)) {
require(msg.value >= amount, "not enough msg.value");
payable(tkey.transferData.destination).transfer(amount);
Copy link
Contributor

Choose a reason for hiding this comment

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

may need nonReentrant to avoid reentrancy attack?

cyl19970726 and others added 2 commits December 24, 2021 13:32
modify BridgeDestination.getLPFee()

Co-authored-by: Qi Zhou <qizhou@quarkchain.org>
add nonReentrant to BridgeDestination.withdraw() and BridgeDestination.buy()

Signed-off-by: cyl19970726 <15258378443@163.com>
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