Skip to content

Commit

Permalink
feat: support alternative gas token (#124)
Browse files Browse the repository at this point in the history
* feat: support alternative gas token

* fix: set gas token holder address

* fix: add gas token gateway to config file

* fix: version
  • Loading branch information
yiweichi authored Aug 19, 2024
1 parent f520420 commit 5accd3b
Show file tree
Hide file tree
Showing 6 changed files with 819 additions and 8 deletions.
6 changes: 4 additions & 2 deletions conf/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
"erc1155_gateway": "0xa5Df8530766A85936EE3E139dECE3bF081c83146",
"dai_gateway": "0x0000000000000000000000000000000000000000",
"usdc_gateway": "0x0000000000000000000000000000000000000000",
"lido_gateway": "0x0000000000000000000000000000000000000000"
"lido_gateway": "0x0000000000000000000000000000000000000000",
"gas_token_gateway": "0x8587FE761F1669Fa75C444c8BC959c28a64AD822"
},
"scroll_messenger": "0x50c7d3e7f7c656493D1D76aaa1a836CedfCBB16A",
"message_queue": "0xF0B2293F5D834eAe920c6974D50957A1732de763",
"scroll_chain": "0x2D567EcE699Eabe5afCd141eDB7A4f2D0D6ce8a0"
"scroll_chain": "0x2D567EcE699Eabe5afCd141eDB7A4f2D0D6ce8a0",
"gas_token": "0x0000000000000000000000000000000000000000"
},
"start_messenger_balance": 10000000000000000000,
"ignored_tokens": [
Expand Down
2 changes: 2 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type Gateway struct {
USDCGateway common.Address `json:"usdc_gateway"`
LIDOGateway common.Address `json:"lido_gateway"`
PufferGateway common.Address `json:"puffer_gateway"`
GasTokenGateway common.Address `json:"gas_token_gateway"`

// erc721
ERC721Gateway common.Address `json:"erc721_gateway"`
Expand All @@ -33,6 +34,7 @@ type Gateway struct {
type L1Contracts struct {
Gateway `json:"l1_gateways"`
ScrollMessenger common.Address `json:"scroll_messenger"`
GasToken common.Address `json:"gas_token"`
}

// L1Config l1 chain config.
Expand Down
4 changes: 3 additions & 1 deletion internal/controller/cross_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ type CrossChainController struct {
func NewCrossChainController(cfg *config.Config, db *gorm.DB, l1Client, l2Client *ethclient.Client) *CrossChainController {
l1MessengerAddr := cfg.L1Config.L1Contracts.ScrollMessenger
l2MessengerAddr := cfg.L2Config.L2Contracts.ScrollMessenger
gasTokenGatewayAddr := cfg.L1Config.L1Contracts.GasTokenGateway
gasTokenAddr := cfg.L1Config.L1Contracts.GasToken
return &CrossChainController{
stopL1CrossChainChan: make(chan struct{}),
stopL2CrossChainChan: make(chan struct{}),
gatewayCrossChainLogic: crosschain.NewLogicGatewayCrossChain(db),
messengerCrossChainLogic: crosschain.NewLogicMessengerCrossChain(db, l1Client, l2Client, l1MessengerAddr, l2MessengerAddr, cfg.L1Config.StartMessengerBalance),
messengerCrossChainLogic: crosschain.NewLogicMessengerCrossChain(db, l1Client, l2Client, l1MessengerAddr, l2MessengerAddr, gasTokenGatewayAddr, gasTokenAddr, cfg.L1Config.StartMessengerBalance),
crossChainControllerRunningTotal: promauto.With(prometheus.DefaultRegisterer).NewCounterVec(prometheus.CounterOpts{
Name: "cross_chain_check_controller_running_total",
Help: "The total number of cross chain controllers running.",
Expand Down
Loading

0 comments on commit 5accd3b

Please sign in to comment.