Skip to content

Commit

Permalink
feat: integrate sfrxeth, sfrxeth-convertor on ethereum (#581)
Browse files Browse the repository at this point in the history
  • Loading branch information
minhnhathoang authored Nov 14, 2024
1 parent 7285184 commit 58af6e8
Show file tree
Hide file tree
Showing 27 changed files with 1,367 additions and 19 deletions.
30 changes: 30 additions & 0 deletions pkg/liquidity-source/frax/common/abis.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package frax_common

import (
"bytes"

"github.com/ethereum/go-ethereum/accounts/abi"
)

var (
FrxETHMinterABI abi.ABI
SfrxETHABI abi.ABI
)

func init() {
builder := []struct {
ABI *abi.ABI
data []byte
}{
{&FrxETHMinterABI, frxETHMinterJson},
{&SfrxETHABI, sfrxETHJson},
}

for _, b := range builder {
var err error
*b.ABI, err = abi.JSON(bytes.NewReader(b.data))
if err != nil {
panic(err)
}
}
}
1 change: 1 addition & 0 deletions pkg/liquidity-source/frax/common/abis/frxETHMinter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"inputs":[{"internalType":"address","name":"depositContractAddress","type":"address"},{"internalType":"address","name":"frxETHAddress","type":"address"},{"internalType":"address","name":"sfrxETHAddress","type":"address"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_timelock_address","type":"address"},{"internalType":"bytes","name":"_withdrawalCredential","type":"bytes"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"new_status","type":"bool"}],"name":"DepositEtherPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes","name":"pubKey","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"withdrawalCredential","type":"bytes"}],"name":"DepositSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"sent_amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"withheld_amt","type":"uint256"}],"name":"ETHSubmitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"EmergencyERC20Recovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyEtherRecovered","type":"event"},{"anonymous":false,"inputs":[],"name":"KeysCleared","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerNominated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"new_status","type":"bool"}],"name":"SubmitPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"timelock_address","type":"address"}],"name":"TimelockChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"pubKey","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"withdrawalCredential","type":"bytes"}],"name":"ValidatorAdded","type":"event"},{"anonymous":false,"inputs":[],"name":"ValidatorArrayCleared","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"pubKey","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"remove_idx","type":"uint256"},{"indexed":false,"internalType":"bool","name":"dont_care_about_ordering","type":"bool"}],"name":"ValidatorRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"times","type":"uint256"}],"name":"ValidatorsPopped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"from_pubKey","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"to_pubKey","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"from_idx","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"to_idx","type":"uint256"}],"name":"ValidatorsSwapped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"_withdrawalCredential","type":"bytes"}],"name":"WithdrawalCredentialSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithheldETHMoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newRatio","type":"uint256"}],"name":"WithholdRatioSet","type":"event"},{"inputs":[],"name":"DEPOSIT_SIZE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RATIO_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"activeValidators","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes","name":"pubKey","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes32","name":"depositDataRoot","type":"bytes32"}],"internalType":"struct OperatorRegistry.Validator","name":"validator","type":"tuple"}],"name":"addValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes","name":"pubKey","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes32","name":"depositDataRoot","type":"bytes32"}],"internalType":"struct OperatorRegistry.Validator[]","name":"validatorArray","type":"tuple[]"}],"name":"addValidators","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"clearValidatorArray","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentWithheldETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"depositContract","outputs":[{"internalType":"contract IDepositContract","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"max_deposits","type":"uint256"}],"name":"depositEther","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositEtherPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"frxETHToken","outputs":[{"internalType":"contract frxETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"i","type":"uint256"}],"name":"getValidator","outputs":[{"internalType":"bytes","name":"pubKey","type":"bytes"},{"internalType":"bytes","name":"withdrawalCredentials","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes32","name":"depositDataRoot","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"pubKey","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes32","name":"depositDataRoot","type":"bytes32"}],"name":"getValidatorStruct","outputs":[{"components":[{"internalType":"bytes","name":"pubKey","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes32","name":"depositDataRoot","type":"bytes32"}],"internalType":"struct OperatorRegistry.Validator","name":"","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address payable","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"moveWithheldETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"nominateNewOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nominatedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numValidators","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"times","type":"uint256"}],"name":"popValidators","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"recoverEther","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"remove_idx","type":"uint256"},{"internalType":"bool","name":"dont_care_about_ordering","type":"bool"}],"name":"removeValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_timelock_address","type":"address"}],"name":"setTimelock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"_new_withdrawal_pubkey","type":"bytes"}],"name":"setWithdrawalCredential","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newRatio","type":"uint256"}],"name":"setWithholdRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sfrxETHToken","outputs":[{"internalType":"contract IsfrxETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"submit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"submitAndDeposit","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"submitAndGive","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"submitPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"from_idx","type":"uint256"},{"internalType":"uint256","name":"to_idx","type":"uint256"}],"name":"swapValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"timelock_address","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"togglePauseDepositEther","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"togglePauseSubmits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withholdRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Loading

0 comments on commit 58af6e8

Please sign in to comment.