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

Bounce for withdraw、borrow 、repay #32

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

Conversation

jfzhou5
Copy link
Contributor

@jfzhou5 jfzhou5 commented Jul 23, 2024

No description provided.

Comment on lines +222 to +239
let queryId: Int = self.queryId;
let tokenTransferMsg: TokenTransfer = TokenTransfer{
queryId: queryId,
amount: amount,
destination: toAddress,
response_destination: myAddress(), // Pool need to receive TokenExcesses message
custom_payload: null,
forward_ton_amount: 0,
forward_payload: emptySlice()
};
// store TokenTransferBounce
let bounceMsg: TokenTransferBounce = TokenTransferBounce{
to: poolWalletAddress,
user: toAddress,
msg: tokenTransferMsg
};
self.tokenTransferMsg.set(queryId, bounceMsg);
self.queryId += 1;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

如果下面的 gas value: ton("0.05") 设置的足够的话,这里可能就不需要做 Bounce处理

Copy link
Contributor

Choose a reason for hiding this comment

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

以及做好数值的 validation

Comment on lines +70 to +74
message MintBounce {
to: Address;
user: Address;
msg: Mint;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

把 Bounce 类的 msg 结构固定了,to: to 地址,user:这个 message 对应的用户,msg: 原生message。
如何拿到 user对应的 bounce message,可能需要有个线下服务去定时扫一下 queryId 对应的 bounce message 内容。

@@ -93,7 +95,7 @@ contract Pool with Deployable, Ownable, Resumable, PoolView {
let reserveAddress: Address = msg.tokenAddress;
let reserveConfiguration: ReserveConfiguration? = self.reservesConfiguration.get(reserveAddress);
require(reserveConfiguration != null, "Reserve not found");

// GetUserAccountData don't need do bounce
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
// GetUserAccountData don't need do bounce
// GetUserAccountData don't need to handle bounce
or // GetUserAccountData won't bounce

@jfzhou5
Copy link
Contributor Author

jfzhou5 commented Jul 24, 2024

暂时不合,留着当后续参考

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