Skip to content

Commit 1f84058

Browse files
committed
add tps to address book
1 parent fb4cfef commit 1f84058

File tree

2 files changed

+59
-4
lines changed

2 files changed

+59
-4
lines changed

deployment/changesets/cd_deploy_tp_and_configure.go

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,51 @@ func (d DeployTPAndConfigure) Apply(e cldf.Environment, config DeployTPAndConfig
120120
if err != nil {
121121
return cldf.ChangesetOutput{}, fmt.Errorf("failed to save BnMTokenPoolOwnerCapId address %s for Sui chain %d: %w", tokenPoolReport.Output.DeployBurnMintTokenPoolOutput.Objects.OwnerCapObjectId, config.SuiChainSelector, err)
122122
}
123+
124+
case "lnr":
125+
// save LnR Pool to the addressbook
126+
typeAndVersionLnRTokenPool := cldf.NewTypeAndVersion(deployment.SuiLnRTokenPoolType, deployment.Version1_0_0)
127+
err = ab.Save(config.SuiChainSelector, tokenPoolReport.Output.LockReleaseTPPackageID, typeAndVersionLnRTokenPool)
128+
if err != nil {
129+
return cldf.ChangesetOutput{}, fmt.Errorf("failed to save LnRTokenPool address %s for Sui chain %d: %w", tokenPoolReport.Output.LockReleaseTPPackageID, config.SuiChainSelector, err)
130+
}
131+
132+
// save LnR Pool State to the addressBook
133+
typeAndVersionLnRTokenPoolState := cldf.NewTypeAndVersion(deployment.SuiLnRTokenPoolStateType, deployment.Version1_0_0)
134+
err = ab.Save(config.SuiChainSelector, tokenPoolReport.Output.DeployLockReleaseTokenPoolOutput.Objects.StateObjectId, typeAndVersionLnRTokenPoolState)
135+
if err != nil {
136+
return cldf.ChangesetOutput{}, fmt.Errorf("failed to save LnRTokenPoolState address %s for Sui chain %d: %w", tokenPoolReport.Output.DeployLockReleaseTokenPoolOutput.Objects.StateObjectId, config.SuiChainSelector, err)
137+
}
138+
139+
// save LnR Pool OwnerId to the addressBook
140+
typeAndVersionLnRTokenPoolOwnerId := cldf.NewTypeAndVersion(deployment.SuiLnRTokenPoolOwnerIDType, deployment.Version1_0_0)
141+
err = ab.Save(config.SuiChainSelector, tokenPoolReport.Output.DeployLockReleaseTokenPoolOutput.Objects.OwnerCapObjectId, typeAndVersionLnRTokenPoolOwnerId)
142+
if err != nil {
143+
return cldf.ChangesetOutput{}, fmt.Errorf("failed to save LnRTokenPoolOwnerCapId address %s for Sui chain %d: %w", tokenPoolReport.Output.DeployLockReleaseTokenPoolOutput.Objects.OwnerCapObjectId, config.SuiChainSelector, err)
144+
}
145+
146+
case "managed":
147+
// save Managed Pool to the addressbook
148+
typeAndVersionManagedTokenPool := cldf.NewTypeAndVersion(deployment.SuiManagedTokenPoolType, deployment.Version1_0_0)
149+
err = ab.Save(config.SuiChainSelector, tokenPoolReport.Output.ManagedTPPackageId, typeAndVersionManagedTokenPool)
150+
if err != nil {
151+
return cldf.ChangesetOutput{}, fmt.Errorf("failed to save ManagedTokenPool address %s for Sui chain %d: %w", tokenPoolReport.Output.ManagedTPPackageId, config.SuiChainSelector, err)
152+
}
153+
154+
// save Managed Pool State to the addressBook
155+
typeAndVersionManagedTokenPoolState := cldf.NewTypeAndVersion(deployment.SuiManagedTokenPoolStateType, deployment.Version1_0_0)
156+
err = ab.Save(config.SuiChainSelector, tokenPoolReport.Output.DeployManagedTokenPoolOutput.Objects.StateObjectId, typeAndVersionManagedTokenPoolState)
157+
if err != nil {
158+
return cldf.ChangesetOutput{}, fmt.Errorf("failed to save ManagedTokenPoolState address %s for Sui chain %d: %w", tokenPoolReport.Output.DeployManagedTokenPoolOutput.Objects.StateObjectId, config.SuiChainSelector, err)
159+
}
160+
161+
// save Managed Pool OwnerId to the addressBook
162+
typeAndVersionManagedTokenPoolOwnerId := cldf.NewTypeAndVersion(deployment.SuiManagedTokenPoolOwnerIDType, deployment.Version1_0_0)
163+
err = ab.Save(config.SuiChainSelector, tokenPoolReport.Output.DeployManagedTokenPoolOutput.Objects.OwnerCapObjectId, typeAndVersionManagedTokenPoolOwnerId)
164+
if err != nil {
165+
return cldf.ChangesetOutput{}, fmt.Errorf("failed to save ManagedTokenPoolOwnerCapId address %s for Sui chain %d: %w", tokenPoolReport.Output.DeployManagedTokenPoolOutput.Objects.OwnerCapObjectId, config.SuiChainSelector, err)
166+
}
123167
}
124-
// Note: Address book saving for "lnr" and "managed" token pools can be added here if needed
125168
}
126169

127170
return cldf.ChangesetOutput{

deployment/types.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,21 @@ var (
4242
SuiLinkTokenTreasuryCapID deployment.ContractType = "SuiLinkTokenTreasuryCapID"
4343
SuiMCMSType deployment.ContractType = "SuiManyChainMultisig"
4444
SuiLinkTokenType deployment.ContractType = "SuiLinkToken"
45-
SuiBnMTokenPoolType deployment.ContractType = "SuiBnMTokenPool"
46-
SuiBnMTokenPoolStateType deployment.ContractType = "SuiBnMTokenPoolState"
47-
SuiBnMTokenPoolOwnerIDType deployment.ContractType = "SuiBnMTokenPoolOwnerID"
45+
46+
// BnM Token Pool related
47+
SuiBnMTokenPoolType deployment.ContractType = "SuiBnMTokenPool"
48+
SuiBnMTokenPoolStateType deployment.ContractType = "SuiBnMTokenPoolState"
49+
SuiBnMTokenPoolOwnerIDType deployment.ContractType = "SuiBnMTokenPoolOwnerID"
50+
51+
// LnR Token Pool related
52+
SuiLnRTokenPoolType deployment.ContractType = "SuiLnRTokenPool"
53+
SuiLnRTokenPoolStateType deployment.ContractType = "SuiLnRTokenPoolState"
54+
SuiLnRTokenPoolOwnerIDType deployment.ContractType = "SuiLnRTokenPoolOwnerID"
55+
56+
// Managed Token Pool related
57+
SuiManagedTokenPoolType deployment.ContractType = "SuiManagedTokenPool"
58+
SuiManagedTokenPoolStateType deployment.ContractType = "SuiManagedTokenPoolState"
59+
SuiManagedTokenPoolOwnerIDType deployment.ContractType = "SuiManagedTokenPoolOwnerID"
4860
)
4961

5062
var (

0 commit comments

Comments
 (0)