Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 12 additions & 4 deletions chains/evm/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,18 @@ mockery: $(mockery) ## Install mockery.
extract-bytecode-abi: ## Extract bytecode and abi from versioned gobindings to bytecode and abi directories
cd gobindings && go run ./cmd/extract_bytecode/main.go

.PHONY: operations
operations: pnpmdep wrappers
OPERATIONS_GEN_V2 := github.com/smartcontractkit/chainlink-deployments-framework/tools/operations-gen@v0.0.2-0.20260515181606-62d38f5a89b0

.PHONY: operations-legacy
operations-legacy:
go run cmd/operations-gen/main.go -config deployment/operations_gen_config.yaml

.PHONY: operations-1-5
operations-1-5:
go run $(OPERATIONS_GEN_V2) -config deployment/operations_gen_config_1_5.yaml

.PHONY: operations
operations: pnpmdep wrappers operations-legacy operations-1-5

.PHONY: operations-fast
operations-fast:
go run cmd/operations-gen/main.go -config deployment/operations_gen_config.yaml
operations-fast: operations-legacy operations-1-5
13 changes: 0 additions & 13 deletions chains/evm/deployment/operations_gen_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,6 @@ output:
# - (none): Public/Read functions don't need access control

contracts:
# 1.5.0
- contract_name: BurnMintTokenPoolAndProxy
version: "1.5.0"
functions:
- name: getRemotePool
access: public
- name: getCurrentInboundRateLimiterState
access: public
- name: getCurrentOutboundRateLimiterState
access: public
- name: getPreviousPool
access: public

# 1.6.3
- contract_name: FeeQuoter
version: "1.6.3"
Expand Down
72 changes: 72 additions & 0 deletions chains/evm/deployment/operations_gen_config_1_5.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Schema for github.com/smartcontractkit/chainlink-deployments-framework/tools/operations-gen
# (generates operations using chain/evm/operations2/contract).
# Covers EVM deployment versions <= 1.5.1 only.
version: "1.0.0"
chain_family: evm

input:
gobindings_package: "../gobindings/generated"

output:
base_path: "."

contracts:
# 1.5.0
- contract_name: BurnMintTokenPoolAndProxy
version: "1.5.0"
functions:
- name: getRemotePool
access: public
- name: getCurrentInboundRateLimiterState
access: public
- name: getCurrentOutboundRateLimiterState
access: public
- name: getPreviousPool
access: public

# 1.5.1
- contract_name: TokenPool
version: "1.5.1"
omit_deploy: true
functions:
- name: applyChainUpdates
access: owner
- name: setRateLimitAdmin
access: owner
- name: getRateLimitAdmin
access: public
- name: setChainRateLimiterConfig
access: owner
- name: getToken
access: public
- name: getTokenDecimals
access: public
- name: isSupportedToken
access: public
- name: getSupportedChains
access: public
- name: getRemoteToken
access: public
- name: getRemotePools
access: public
- name: addRemotePool
access: owner
- name: getCurrentInboundRateLimiterState
access: public
- name: getCurrentOutboundRateLimiterState
access: public

- contract_name: BurnMintTokenPool
version: "1.5.1"

- contract_name: BurnFromMintTokenPool
version: "1.5.1"

- contract_name: BurnToAddressMintTokenPool
version: "1.5.1"

- contract_name: BurnWithFromMintTokenPool
version: "1.5.1"

- contract_name: LockReleaseTokenPool
version: "1.5.1"

Large diffs are not rendered by default.

56 changes: 37 additions & 19 deletions chains/evm/deployment/v1_5_1/adapters/tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
cldf_chain "github.com/smartcontractkit/chainlink-deployments-framework/chain"
"github.com/smartcontractkit/chainlink-deployments-framework/chain/evm"
evm_contract "github.com/smartcontractkit/chainlink-deployments-framework/chain/evm/operations/contract"
ops2contract "github.com/smartcontractkit/chainlink-deployments-framework/chain/evm/operations2/contract"
cldf_ops "github.com/smartcontractkit/chainlink-deployments-framework/operations"
)

Expand Down Expand Up @@ -121,11 +122,14 @@ func (t *TokenAdapter) ConfigureTokenForTransfersSequence() *cldf_ops.Sequence[t
type poolOpsV151 struct{}

func (p *poolOpsV151) GetToken(b cldf_ops.Bundle, chain evm.Chain, poolAddr common.Address) (common.Address, error) {
tp, err := token_pool.NewTokenPool(poolAddr, chain.Client)
if err != nil {
return common.Address{}, fmt.Errorf("failed to instantiate token pool v1.5.1 contract: %w", err)
}
res, err := cldf_ops.ExecuteOperation(b,
tpOps.GetToken, chain,
evm_contract.FunctionInput[struct{}]{
ChainSelector: chain.Selector,
Address: poolAddr,
tpOps.NewReadGetToken(tp), chain,
ops2contract.FunctionInput[struct{}]{
Args: struct{}{},
},
)
if err != nil {
Expand Down Expand Up @@ -175,18 +179,20 @@ func (p *poolOpsV151) SetRateLimiterConfig(b cldf_ops.Bundle, chain evm.Chain, p
return nil, fmt.Errorf("inbound rate limiter config is enabled but rate and capacity are both zero")
}

tp, err := token_pool.NewTokenPool(poolAddr, chain.Client)
if err != nil {
return nil, fmt.Errorf("failed to instantiate token pool v1.5.1 contract: %w", err)
}
report, err := cldf_ops.ExecuteOperation(b,
tpOps.SetChainRateLimiterConfig, chain,
evm_contract.FunctionInput[tpOps.SetChainRateLimiterConfigArgs]{
ChainSelector: chain.Selector,
Address: poolAddr,
tpOps.NewWriteSetChainRateLimiterConfig(tp), chain,
ops2contract.FunctionInput[tpOps.SetChainRateLimiterConfigArgs]{
Args: tpOps.SetChainRateLimiterConfigArgs{
OutboundRateLimitConfig: token_pool.RateLimiterConfig{
OutboundConfig: token_pool.RateLimiterConfig{
IsEnabled: outbound.IsEnabled,
Capacity: outbound.Capacity,
Rate: outbound.Rate,
},
InboundRateLimitConfig: token_pool.RateLimiterConfig{
InboundConfig: token_pool.RateLimiterConfig{
IsEnabled: inbound.IsEnabled,
Capacity: inbound.Capacity,
Rate: inbound.Rate,
Expand All @@ -197,23 +203,35 @@ func (p *poolOpsV151) SetRateLimiterConfig(b cldf_ops.Bundle, chain evm.Chain, p
if err != nil {
return nil, fmt.Errorf("SetChainRateLimiterConfig v1.5.1: %w", err)
}
return []evm_contract.WriteOutput{report.Output}, nil
return []evm_contract.WriteOutput{writeOutputOps2ToOps(report.Output)}, nil
}

func (p *poolOpsV151) SetRateLimitAdmin(b cldf_ops.Bundle, chain evm.Chain, poolAddr common.Address, newAdmin common.Address) (evm_contract.WriteOutput, error) {
tp, err := token_pool.NewTokenPool(poolAddr, chain.Client)
if err != nil {
return evm_contract.WriteOutput{}, fmt.Errorf("failed to instantiate token pool v1.5.1 contract: %w", err)
}
report, err := cldf_ops.ExecuteOperation(b,
tpOps.SetRateLimitAdmin, chain,
evm_contract.FunctionInput[tpOps.SetRateLimitAdminArgs]{
ChainSelector: chain.Selector,
Address: poolAddr,
Args: tpOps.SetRateLimitAdminArgs{
NewAdmin: newAdmin,
},
tpOps.NewWriteSetRateLimitAdmin(tp), chain,
ops2contract.FunctionInput[common.Address]{
Args: newAdmin,
})
if err != nil {
return evm_contract.WriteOutput{}, fmt.Errorf("SetRateLimitAdmin v1.5.1: %w", err)
}
return report.Output, nil
return writeOutputOps2ToOps(report.Output), nil
}

func writeOutputOps2ToOps(out ops2contract.WriteOutput) evm_contract.WriteOutput {
var execInfo *evm_contract.ExecInfo
if out.ExecInfo != nil {
execInfo = &evm_contract.ExecInfo{Hash: out.ExecInfo.Hash}
}
return evm_contract.WriteOutput{
ChainSelector: out.ChainSelector,
Tx: out.Tx,
ExecInfo: execInfo,
}
}

func (p *poolOpsV151) GetCurrentInboundRateLimit(b cldf_ops.Bundle, chain evm.Chain, poolAddr common.Address, remoteSelector uint64) (tokensapi.RateLimiterConfig, error) {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading