-
Notifications
You must be signed in to change notification settings - Fork 40
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
R4R: Implement BEP84 #809
Merged
Merged
R4R: Implement BEP84 #809
Changes from 18 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
1ce9ae7
implement bep100
yutianwu 2eda0eb
add upgrade height for FixFailAckPackage
5bdffbd
convert to bep20 supply in sync
8c6f7c4
distribute fee
yutianwu b71cc85
the mirror and sync fee in package is already converted into BC amount
8b1a98c
update dependency
3c355c5
enable account scripts for cross chain transfer
4def158
register upgrade height
b5ad850
send only no script execution error
34da05a
include refund package into result
53a2349
add transfer in tag
651b8ce
use idx other than address as refund exclude flag
dfafd81
use full refund instead of partial refund
a0167be
publish mirror related events (#813)
yutianwu 9ecd122
update mirror config
yutianwu c7c17a3
move deduct fee from deliverTx
yutianwu b070d9a
fix comments
yutianwu fb8997e
add missing tags
yutianwu 0c7c2c2
fix transfer out fail ack handler issue
bdb176d
update schmema
yutianwu 53ac574
update dependency
5c7cd96
add old total supply for mirror sync event
yutianwu eebd032
fix mirror event
yutianwu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package pub | ||
|
||
import "fmt" | ||
|
||
type Mirror struct { | ||
TxHash string | ||
ChainId string | ||
Type string | ||
RelayerFee int64 | ||
Sender string | ||
Contract string | ||
BEP20Name string | ||
BEP20Symbol string | ||
BEP2Symbol string | ||
TotalSupply int64 | ||
Decimals int | ||
Fee int64 | ||
} | ||
|
||
func (msg Mirror) String() string { | ||
return fmt.Sprintf("Mirror: txHash: %s, sender: %s, bep2Symbol: %s", msg.TxHash, msg.Sender, msg.BEP2Symbol) | ||
} | ||
|
||
func (msg Mirror) ToNativeMap() map[string]interface{} { | ||
var native = make(map[string]interface{}) | ||
native["txHash"] = msg.TxHash | ||
native["chainId"] = msg.ChainId | ||
native["type"] = msg.Type | ||
native["relayerFee"] = msg.RelayerFee | ||
native["sender"] = msg.Sender | ||
native["contract"] = msg.Contract | ||
native["bep20Name"] = msg.BEP20Name | ||
native["bep20Symbol"] = msg.BEP20Symbol | ||
native["bep2Symbol"] = msg.BEP2Symbol | ||
native["totalSupply"] = msg.TotalSupply | ||
native["totalSupply"] = msg.TotalSupply | ||
native["decimals"] = msg.Decimals | ||
native["fee"] = msg.Fee | ||
return native | ||
} | ||
|
||
// deliberated not implemented Ess | ||
type Mirrors struct { | ||
Height int64 | ||
Num int | ||
Timestamp int64 | ||
Mirrors []Mirror | ||
} | ||
|
||
func (msg Mirrors) String() string { | ||
return fmt.Sprintf("Mirrors in block %d, num: %d", msg.Height, msg.Num) | ||
} | ||
|
||
func (msg Mirrors) ToNativeMap() map[string]interface{} { | ||
var native = make(map[string]interface{}) | ||
native["height"] = msg.Height | ||
mirrors := make([]map[string]interface{}, len(msg.Mirrors), len(msg.Mirrors)) | ||
for idx, t := range msg.Mirrors { | ||
mirrors[idx] = t.ToNativeMap() | ||
} | ||
native["timestamp"] = msg.Timestamp | ||
native["num"] = msg.Num | ||
native["mirrors"] = mirrors | ||
return native | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package sub | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/pubsub" | ||
|
||
"github.com/binance-chain/node/plugins/bridge" | ||
) | ||
|
||
func SubscribeMirrorEvent(sub *pubsub.Subscriber) error { | ||
err := sub.Subscribe(bridge.MirrorTopic, func(event pubsub.Event) { | ||
switch event.(type) { | ||
case bridge.MirrorEvent: | ||
mirrorEvent := event.(bridge.MirrorEvent) | ||
if stagingArea.MirrorData == nil { | ||
stagingArea.MirrorData = make([]bridge.MirrorEvent, 0, 1) | ||
} | ||
stagingArea.MirrorData = append(stagingArea.MirrorData, mirrorEvent) | ||
default: | ||
sub.Logger.Info("unknown event type") | ||
} | ||
}) | ||
return err | ||
} | ||
|
||
func commitMirror() { | ||
if len(stagingArea.MirrorData) > 0 { | ||
toPublish.EventData.MirrorData = append(toPublish.EventData.MirrorData, stagingArea.MirrorData...) | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't redefine: org.binance.dex.explorer.work.domain.avro.mirror.Mirror , the name is duplicate to line 895
Can you change it to "MirrorData"?