Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
3a73d21
Feat: relconfig Bridge -> RFQAddress, add CCTPAddress
dwasse Feb 20, 2024
6664fd9
Feat: add RebalanceMethod enum
dwasse Feb 20, 2024
91017b7
Feat: add MaintenanceBalancePct and InitialBalancePct
dwasse Feb 20, 2024
f7d56f2
Feat: add RebalanceMethodNone
dwasse Feb 20, 2024
cbf01e7
Feat: add Rebalance() to inventory manager
dwasse Feb 20, 2024
512fb30
Cleanup: remove rebalance.go
dwasse Feb 20, 2024
536f227
Feat: add submitter to inventory manager
dwasse Feb 20, 2024
1e9e1d6
Cleanup: Adress -> Address
dwasse Feb 20, 2024
708eab0
WIP: add Rebalance() impl to inventory manager
dwasse Feb 20, 2024
eabdda0
Feat: add token address and chain id to tokenMetadata
dwasse Feb 20, 2024
1f7c3a3
Cleanup: utilize new tokenMetadata fields
dwasse Feb 20, 2024
44be2b3
Feat: add approval for CCTP bridge
dwasse Feb 20, 2024
d2acc79
Feat: impl rebalanceCCTP()
dwasse Feb 20, 2024
4ad03dc
Fix: regenerate
dwasse Feb 21, 2024
7c0cf7e
Cleanup: lint
dwasse Feb 21, 2024
fda6f90
WIP: export inventory structs for use in tests
dwasse Feb 21, 2024
4db711f
Feat: add TestGetRebalance
dwasse Feb 21, 2024
06e8e57
Feat: add rebalance case to TestGetRebalance
dwasse Feb 21, 2024
6b38ba5
Cleanup: remove duplicate data from RebalanceData
dwasse Feb 21, 2024
90a63e6
Feat: address rebalance case where origin chain cannot pass initial t…
dwasse Feb 21, 2024
6c70e96
Cleanup: regenerate inventory
dwasse Feb 21, 2024
3d561b0
Feat: remove handleClaimCompleted and move Rebalance() call to chaini…
dwasse Feb 21, 2024
e5868de
Feat: enforce rebalance methods to match from config
dwasse Feb 21, 2024
eca3b63
WIP: set rebalance params in e2e test
dwasse Feb 21, 2024
383ece0
WIP: add Rebalance interface and rebalanceManagerCCTP
dwasse Feb 21, 2024
0095c7c
Feat: add Start() to inventory manager
dwasse Feb 21, 2024
58c8a7f
Feat: add rebalance db models and functions
dwasse Feb 21, 2024
5aeb2c5
Feat: rebalance manager listens for cctp events and updates db
dwasse Feb 22, 2024
baab066
Feat: rebalance on interval instead of on DepositClaimed
dwasse Feb 22, 2024
752763b
Cleanup: DBSelectorIntervalSeconds -> DBSelectorInterval
dwasse Feb 22, 2024
ab90a63
Feat: check for pending rebalances
dwasse Feb 22, 2024
989c2d5
Feat: attempt rebalance on DepositClaimed
dwasse Feb 22, 2024
73e027d
Cleanup: lint
dwasse Feb 22, 2024
a4e308c
Fix: start inventory manager
dwasse Feb 23, 2024
03891fb
WIP: add cctp contract setup for integration test
dwasse Feb 23, 2024
c9ca663
WIP: use origin instead of origin tx hash for rebalance updating
dwasse Feb 26, 2024
81cfc79
WIP: enforce only one row affected in rebalance update
dwasse Feb 26, 2024
3a6ea21
WIP: don't track origin tx hash for now
dwasse Feb 26, 2024
42f24ce
WIP: logs
dwasse Feb 26, 2024
ed841c8
WIP: working test with MockMintBurnToken
dwasse Feb 27, 2024
628733d
WIP: adjust amounts
dwasse Feb 27, 2024
efaf3bd
WIP: fix approvals
dwasse Feb 27, 2024
1e7175f
Feat: remove fastbridge ref from chain listener
dwasse Feb 27, 2024
5c99c21
Feat: use iota+1 for rebalance status, regen model
dwasse Feb 27, 2024
8fcfbcb
WIP: don't return error in listener handler
dwasse Feb 27, 2024
88de62a
Feat: check for pending rebalances in integration test
dwasse Feb 27, 2024
ce32aa9
Cleanup: remove balance logs
dwasse Feb 27, 2024
819dd14
Cleanup: logs / comments
dwasse Feb 27, 2024
5f4486b
Cleanup: dedup code in inv manager
dwasse Feb 27, 2024
c8f2c67
Cleanup: lints
dwasse Feb 27, 2024
b7dd419
Feat: add CCTPStartBlock to relconfig
dwasse Feb 27, 2024
53e8129
[goreleaser]
dwasse Feb 27, 2024
2e33da3
Cleanup: lints
dwasse Feb 27, 2024
45c2ad9
Cleanup: lints
dwasse Feb 27, 2024
ba58876
add directive (#2122)
trajan0x Feb 28, 2024
4febe40
Feat: move listener to ethergo/chain/listener package
dwasse Feb 28, 2024
000549f
Merge branch 'feat/relayer-rebalance' of github.com:synapsecns/sangui…
dwasse Feb 28, 2024
ceb8479
[goreleaser]
dwasse Feb 28, 2024
19dc080
Cleanup: lints
dwasse Feb 28, 2024
085ac5e
update db
trajan0x Feb 28, 2024
782b869
Cleanup: remove unnecessary errgroup
dwasse Feb 28, 2024
6195502
Merge branch 'master' into feat/relayer-rebalance
dwasse Feb 28, 2024
07dbaeb
[goreleaser]
dwasse Feb 28, 2024
7a9a30b
fast
trajan0x Feb 29, 2024
f2d7ab8
cleanup
trajan0x Feb 29, 2024
cd760c2
more cleanup
trajan0x Feb 29, 2024
4055168
Merge pull request #2129 from synapsecns/feat/relayer-rebalance-gener…
trajan0x Feb 29, 2024
7ff3b2a
[goreleaser]
trajan0x Feb 29, 2024
d91525a
Feat: add tracing
dwasse Feb 29, 2024
ecbdc0e
Merge branch 'feat/relayer-rebalance' of github.com:synapsecns/sangui…
dwasse Feb 29, 2024
edeeb0e
[goreleaser]
dwasse Feb 29, 2024
5743f58
Feat: add more tracing around rebalance trigger
dwasse Mar 1, 2024
d8deade
[goreleaser]
dwasse Mar 1, 2024
e1296a4
Feat: add MaxRebalanceAmount and getter test
dwasse Mar 1, 2024
edae452
Feat: incorporate MaxRebalanceAmount and test
dwasse Mar 1, 2024
ab2a9ab
Feat: use big.Float for MaxRebalanceAmount parsing
dwasse Mar 1, 2024
996a82b
[goreleaser]
dwasse Mar 1, 2024
93a1e04
Feat: add check for address match in cctp event
dwasse Mar 1, 2024
b0f9d22
[goreleaser]
dwasse Mar 1, 2024
3285fe6
Cleanup: lint
dwasse Mar 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ethergo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ root
│ ├── <a href="./backends/geth">geth</a>: Contains an embedded geth backend. This is useful for testing against a local geth instance without forking capabilities. This does not require docker and runs fully embedded in the go application, as such it is faster than the docker-based backends, but less versatile. Used when an rpc address is needed for a localnet.
│ ├── <a href="./backends/preset">preset</a>: Contains a number of preset backends for testing.
│ ├── <a href="./backends/simulated">simulated</a>: The fastest backend, this does not expose an rpc endpoint and uses geth's [simulated backend](https://goethereumbook.org/en/client-simulated/)
├── <a href="./chain">chain</a>: Contains a client for interacting with the chain. This will be removed in a future version. Please use [client](./client) going forward.
├── <s><a href="./chain">chain</a>: Contains a client for interacting with the chain. This will be removed in a future version. Please use [client](./client) going forward.
│ ├── <a href="./chain/chainwatcher">chainwatcher</a>: Watches the chain for events, blocks and logs
│ ├── <a href="./chain/client">client</a>: Contains eth clients w/ rate limiting, workarounds for bugs in some chains, etc.
│ ├── <a href="./chain/gas">gas</a>: Contains a deterministic gas estimator
│ ├── <a href="./chain/watcher">watcher</a>: Client interface for chain watcher.
│ ├── <a href="./chain/watcher">watcher</a>: Client interface for chain watcher.</s>
├── <a href="./contracts">contracts</a>: Contains interfaces for using contracts with the deployer + manager
├── <a href="./client">client</a>: Contains an open tracing compatible ethclient with batching.
├── <a href="./example">example</a>: Contains a full featured example of how to use deployer + manager
├── <a href="./forker">forker</a>: Allows the use of fork tests in live chains without docker using an anvil binary.
├── <a href="./listener">listener</a>: Drop-in contract listener
├── <a href="./manager">manager</a>: Manages contract deployments.
├── <a href="./mocks">mocks</a>: Contains mocks for testing various data types (transactions, addresses, logs, etc)
├── <a href="./parser">parser</a>: Parse hardhat deployments
Expand Down
72 changes: 72 additions & 0 deletions ethergo/example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,77 @@
}
```

4. (Optional): Create a typecast getter:
To avoid naked casts of contract handle, we can potionally create a typecast getter.
To do this, we're going to create a thin wrapper around deploymanager.

```go
package example
import (
"context"
"github.com/synapsecns/sanguine/ethergo/backends"
"github.com/synapsecns/sanguine/ethergo/contracts"
"github.com/synapsecns/sanguine/ethergo/manager"
"testing"
)

// DeployManager wraps DeployManager and allows typed contract handles to be returned.
type DeployManager struct {
*manager.DeployerManager
}

// NewDeployManager creates a new DeployManager.
func NewDeployManager(t *testing.T) *DeployManager {
t.Helper()

parentManager := manager.NewDeployerManager(t, NewCounterDeployer)
return &DeployManager{parentManager}
}
```

Now we can create a handle to get the contract for us;

```go
package example
// see above for imports

import (
"context"
"github.com/synapsecns/sanguine/ethergo/backends"
"github.com/synapsecns/sanguine/ethergo/contracts"
"github.com/synapsecns/sanguine/ethergo/example/counter"
"github.com/synapsecns/sanguine/ethergo/manager"
"testing"
)

// GetCounter gets the pre-created counter.
func (d *DeployManager) GetCounter(ctx context.Context, backend backends.SimulatedTestBackend) (contract contracts.DeployedContract, handle *counter.CounterRef) {
d.T().Helper()

return manager.GetContract[*counter.CounterRef](ctx, d.T(), d, backend, CounterType)
}
```

5. (Optional) Make sure are dependencies are correct: We can also create a test to assert our dependencides are correctly listed in each deployer. That looks like this:

```go
package example_test

import (
"context"
"github.com/synapsecns/sanguine/ethergo/backends"
"github.com/synapsecns/sanguine/ethergo/contracts"
"github.com/synapsecns/sanguine/ethergo/example"
"github.com/synapsecns/sanguine/ethergo/manager"
"testing"
)


func TestDependenciesCorrect(t *testing.T) {
manager.AssertDependenciesCorrect(context.Background(), t, func() manager.IDeployManager {
return example.NewDeployerManager(t)
})
}
```

That's it! You should be done. As you can see, there's a lot more that can be done here. Passing in a list of all your deployers every time doesn't make sense. You'll want to create a standard testutil and extend it. We also haven't covered that any backend here is interchangable: you can use simulated, ganache, or embedded geth. This tutorial should've covered the basics though
Loading