Skip to content
Merged
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
2 changes: 1 addition & 1 deletion bindings/bind/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

const (
// DefaultGasBudget is the default gas budget for transactions
DefaultGasBudget uint64 = 500_000_000
DefaultGasBudget uint64 = 10_000_000_000
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will likely be used only by MCMS. I removed it from the lib so we control from Sui the default.
Other transactions can control the Budget from the Operations

)

type IBoundContract interface {
Expand Down
50 changes: 29 additions & 21 deletions bindings/mcms_encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func overrideCall(call *bind.EncodedCall, module, function string) *bind.Encoded

// MCMS SDK will call this to encode the entrypoint call
// Data is the raw BCS encoded bytes of the final function call
func (e *CCIPEntrypointArgEncoder) EncodeEntryPointArg(executingCallbackParams *transaction.Argument, target, module, function, stateObjID string, data []byte) (*bind.EncodedCall, error) {
func (e *CCIPEntrypointArgEncoder) EncodeEntryPointArg(executingCallbackParams *transaction.Argument, target, module, function, stateObjID string, data []byte, typeArgs []string) (*bind.EncodedCall, error) {
clock := bind.Object{Id: "0x6"}
stateObj := bind.Object{Id: stateObjID}
registryObj := bind.Object{Id: e.registryObjID}
Expand Down Expand Up @@ -76,8 +76,7 @@ func (e *CCIPEntrypointArgEncoder) EncodeEntryPointArg(executingCallbackParams *
if err != nil {
return nil, err
}
// TODO: Find correct type args
typeArgs := []string{"0x1::sui::SUI"}

entrypointCall, err := burnMintTokenPool.Encoder().McmsSetChainRateLimiterConfigsWithArgs(typeArgs, stateObj, registryObj, executingCallbackParams, clock)
if err != nil {
return nil, err
Expand All @@ -91,8 +90,7 @@ func (e *CCIPEntrypointArgEncoder) EncodeEntryPointArg(executingCallbackParams *
if err != nil {
return nil, err
}
// TODO: Find correct type args
typeArgs := []string{"0x1::sui::SUI"}

entrypointCall, err := burnMintTokenPool.Encoder().McmsExecuteOwnershipTransferWithArgs(typeArgs, stateObj, registryObj, executingCallbackParams)
if err != nil {
return nil, err
Expand All @@ -115,6 +113,7 @@ func (e *CCIPEntrypointArgEncoder) EncodeEntryPointArg(executingCallbackParams *
if ccipRef.Id != stateObj.Id {
return nil, fmt.Errorf("ccip ref (%s) does not match state object (%s)", ccipRef.Id, stateObj.Id)
}

return feeQuoter.Encoder().McmsUpdatePricesWithOwnerCapWithArgs(ccipRef, registryObj, clock, executingCallbackParams)
}

Expand Down Expand Up @@ -145,6 +144,7 @@ func (e *CCIPEntrypointArgEncoder) EncodeEntryPointArg(executingCallbackParams *
}
ccipObjectRef := bind.Object{Id: stateObjID} // For accept_ownership, the state object is the CCIP object ref
stateObj := bind.Object{Id: toHexString(deserializeFirst32Bytes(data))}

return offramp.Encoder().McmsAcceptOwnershipWithArgs(ccipObjectRef, stateObj, registryObj, executingCallbackParams)
}

Expand All @@ -162,6 +162,7 @@ func (e *CCIPEntrypointArgEncoder) EncodeEntryPointArg(executingCallbackParams *
}
ccipObjectRef := bind.Object{Id: stateObjID} // For accept_ownership, the state object is the CCIP object ref
stateObj := bind.Object{Id: toHexString(deserializeFirst32Bytes(data))}

return onramp.Encoder().McmsAcceptOwnershipWithArgs(ccipObjectRef, stateObj, registryObj, executingCallbackParams)

case "set_dynamic_config",
Expand All @@ -179,10 +180,10 @@ func (e *CCIPEntrypointArgEncoder) EncodeEntryPointArg(executingCallbackParams *

nonceManagerCapObj := bind.Object{Id: toHexString(nonceManagerCap)}
sourceTransferCapObj := bind.Object{Id: toHexString(sourceTransferCap)}

if toHexString(state) != stateObj.Id {
return nil, fmt.Errorf("state (%s) does not match state object (%s)", toHexString(state), stateObj.Id)
}

return onramp.Encoder().McmsInitializeWithArgs(stateObj, registryObj, nonceManagerCapObj, sourceTransferCapObj, executingCallbackParams)
case "withdraw_fee_tokens":
deserializer := bcs.NewDeserializer(data)
Expand All @@ -197,8 +198,7 @@ func (e *CCIPEntrypointArgEncoder) EncodeEntryPointArg(executingCallbackParams *
if toHexString(state) != stateObj.Id {
return nil, fmt.Errorf("state (%s) does not match state object (%s)", toHexString(state), stateObj.Id)
}
// TODO: Find correct type args
typeArgs := []string{"0x1::sui::SUI"}

return onramp.Encoder().McmsWithdrawFeeTokensWithArgs(typeArgs, ccipRef, stateObj, registryObj, coinMetadata, executingCallbackParams)
}

Expand All @@ -221,8 +221,6 @@ func (e *CCIPEntrypointArgEncoder) EncodeEntryPointArg(executingCallbackParams *
}
switch function {
case "accept_ownership":
// TODO: Find correct type args
typeArgs := []string{"0x1::sui::SUI"}
return burnMintTokenPool.Encoder().McmsAcceptOwnershipWithArgs(typeArgs, stateObj, registryObj, executingCallbackParams)
case "set_allowlist_enabled",
"apply_allowlist_updates",
Expand All @@ -235,6 +233,10 @@ func (e *CCIPEntrypointArgEncoder) EncodeEntryPointArg(executingCallbackParams *
case "set_chain_rate_limiter_configs",
"set_chain_rate_limiter_config":
return encodeDefaultWithTypeArgsAndClock()
case "set_pool":
ccipRefBytes := deserializeFirst32Bytes(data)
ccipRef := bind.Object{Id: toHexString(ccipRefBytes)}
return burnMintTokenPool.Encoder().McmsSetPoolWithArgs(typeArgs, ccipRef, stateObj, registryObj, executingCallbackParams)
}

// LOCK RELEASE TOKEN POOL
Expand All @@ -245,8 +247,6 @@ func (e *CCIPEntrypointArgEncoder) EncodeEntryPointArg(executingCallbackParams *
}
switch function {
case "accept_ownership":
// TODO: Find correct type args
typeArgs := []string{"0x1::sui::SUI"}
return lockReleaseTokenPool.Encoder().McmsAcceptOwnershipWithArgs(typeArgs, stateObj, registryObj, executingCallbackParams)
case "set_rebalancer",
"set_allowlist_enabled",
Expand All @@ -260,6 +260,10 @@ func (e *CCIPEntrypointArgEncoder) EncodeEntryPointArg(executingCallbackParams *
case "set_chain_rate_limiter_configs",
"set_chain_rate_limiter_config":
return encodeDefaultWithTypeArgsAndClock()
case "set_pool":
ccipRefBytes := deserializeFirst32Bytes(data)
ccipRef := bind.Object{Id: toHexString(ccipRefBytes)}
return lockReleaseTokenPool.Encoder().McmsSetPoolWithArgs(typeArgs, ccipRef, stateObj, registryObj, executingCallbackParams)

}

Expand All @@ -271,8 +275,7 @@ func (e *CCIPEntrypointArgEncoder) EncodeEntryPointArg(executingCallbackParams *
}
switch function {
case "accept_ownership":
// TODO: Find correct type args
typeArgs := []string{"0x1::sui::SUI"}

return managedTokenPool.Encoder().McmsAcceptOwnershipWithArgs(typeArgs, stateObj, registryObj, executingCallbackParams)
case "set_allowlist_enabled",
"apply_allowlist_updates",
Expand All @@ -285,6 +288,11 @@ func (e *CCIPEntrypointArgEncoder) EncodeEntryPointArg(executingCallbackParams *
case "set_chain_rate_limiter_configs",
"set_chain_rate_limiter_config":
return encodeDefaultWithTypeArgsAndClock()
case "set_pool":
ccipRefBytes := deserializeFirst32Bytes(data)
ccipRef := bind.Object{Id: toHexString(ccipRefBytes)}
return managedTokenPool.Encoder().McmsSetPoolWithArgs(typeArgs, ccipRef, stateObj, registryObj, executingCallbackParams)

}

// USDC TOKEN POOL
Expand All @@ -295,8 +303,7 @@ func (e *CCIPEntrypointArgEncoder) EncodeEntryPointArg(executingCallbackParams *
}
switch function {
case "accept_ownership":
// TODO: Find correct type args
typeArgs := []string{"0x1::sui::SUI"}

return usdcTokenPool.Encoder().McmsAcceptOwnershipWithArgs(typeArgs, stateObj, registryObj, executingCallbackParams)
case "set_allowlist_enabled",
"apply_allowlist_updates",
Expand All @@ -308,6 +315,10 @@ func (e *CCIPEntrypointArgEncoder) EncodeEntryPointArg(executingCallbackParams *
return encodeDefaultWithTypeArgs()
case "set_chain_rate_limiter_configs", "set_chain_rate_limiter_config":
return encodeDefaultWithTypeArgsAndClock()
case "set_pool":
ccipRefBytes := deserializeFirst32Bytes(data)
ccipRef := bind.Object{Id: toHexString(ccipRefBytes)}
return usdcTokenPool.Encoder().McmsSetPoolWithArgs(typeArgs, ccipRef, stateObj, registryObj, executingCallbackParams)
}

// MANAGED TOKEN
Expand All @@ -318,19 +329,16 @@ func (e *CCIPEntrypointArgEncoder) EncodeEntryPointArg(executingCallbackParams *
}
switch function {
case "accept_ownership":
// TODO: Find correct type args
typeArgs := []string{"0x1::sui::SUI"}

return managedToken.Encoder().McmsAcceptOwnershipWithArgs(typeArgs, stateObj, registryObj, executingCallbackParams)
case "configure_new_minter":
// TODO: Find correct type args
typeArgs := []string{"0x1::sui::SUI"}

return managedToken.Encoder().McmsConfigureNewMinterWithArgs(typeArgs, stateObj, registryObj, executingCallbackParams)
case "increment_mint_allowance",
"set_unlimited_mint_allowances",
"blocklist",
"unblocklist",
"pause":
typeArgs := []string{"0x1::sui::SUI"}
deserializer := bcs.NewDeserializer(data)
state := deserializer.ReadFixedBytes(SuiAddressLength)
deserializer.ReadFixedBytes(SuiAddressLength) // skip owner cap, we don't need it
Expand Down
Loading
Loading