Skip to content

Commit

Permalink
fix typo: principle => principal (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
adu-web3 authored Jun 24, 2024
1 parent dba280b commit 86d84f2
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 55 deletions.
2 changes: 1 addition & 1 deletion precompiles/assets/IAssets.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ interface IAssets {
/// @param assetsAddress The client chain asset Address
/// @param withdrawAddress The withdraw address
/// @param opAmount The withdraw amount
function withdrawPrinciple(
function withdrawPrincipal(
uint32 clientChainLzID,
bytes memory assetsAddress,
bytes memory withdrawAddress,
Expand Down
91 changes: 43 additions & 48 deletions precompiles/assets/abi.json
Original file line number Diff line number Diff line change
@@ -1,103 +1,98 @@
[
{
"inputs":
[
"type": "function",
"name": "depositTo",
"inputs": [
{
"internalType": "uint32",
"name": "clientChainLzID",
"type": "uint32"
"type": "uint32",
"internalType": "uint32"
},
{
"internalType": "bytes",
"name": "assetsAddress",
"type": "bytes"
"type": "bytes",
"internalType": "bytes"
},
{
"internalType": "bytes",
"name": "stakerAddress",
"type": "bytes"
"type": "bytes",
"internalType": "bytes"
},
{
"internalType": "uint256",
"name": "opAmount",
"type": "uint256"
"type": "uint256",
"internalType": "uint256"
}
],
"name": "depositTo",
"outputs":
[
"outputs": [
{
"internalType": "bool",
"name": "success",
"type": "bool"
"type": "bool",
"internalType": "bool"
},
{
"internalType": "uint256",
"name": "latestAssetState",
"type": "uint256"
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
"stateMutability": "nonpayable"
},
{
"inputs": [],
"type": "function",
"name": "getClientChains",
"outputs":
[
"inputs": [],
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
"type": "bool",
"internalType": "bool"
},
{
"internalType": "uint32[]",
"name": "",
"type": "uint32[]"
"type": "uint32[]",
"internalType": "uint32[]"
}
],
"stateMutability": "view",
"type": "function"
"stateMutability": "view"
},
{
"inputs":
[
"type": "function",
"name": "withdrawPrincipal",
"inputs": [
{
"internalType": "uint32",
"name": "clientChainLzID",
"type": "uint32"
"type": "uint32",
"internalType": "uint32"
},
{
"internalType": "bytes",
"name": "assetsAddress",
"type": "bytes"
"type": "bytes",
"internalType": "bytes"
},
{
"internalType": "bytes",
"name": "withdrawAddress",
"type": "bytes"
"type": "bytes",
"internalType": "bytes"
},
{
"internalType": "uint256",
"name": "opAmount",
"type": "uint256"
"type": "uint256",
"internalType": "uint256"
}
],
"name": "withdrawPrinciple",
"outputs":
[
"outputs": [
{
"internalType": "bool",
"name": "success",
"type": "bool"
"type": "bool",
"internalType": "bool"
},
{
"internalType": "uint256",
"name": "latestAssetState",
"type": "uint256"
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
"stateMutability": "nonpayable"
}
]
]
2 changes: 1 addition & 1 deletion precompiles/assets/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) (bz [
//
// Available assets transactions are:
// - depositTo
// - withdrawPrinciple
// - withdrawPrincipal
func (Precompile) IsTransaction(methodID string) bool {
switch methodID {
case MethodDepositTo, MethodWithdraw:
Expand Down
2 changes: 1 addition & 1 deletion precompiles/assets/assets_integrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func (s *AssetsPrecompileSuite) TestCallWithdrawFromEOA() {
stakerAddr := paddingClientChainAddress(s.Address.Bytes(), assetstype.GeneralClientChainAddrLength)
opAmount := big.NewInt(100)
assetAddr := usdtAddress
method := "withdrawPrinciple"
method := "withdrawPrincipal"

beforeEach := func() {
s.SetupTest()
Expand Down
4 changes: 2 additions & 2 deletions precompiles/assets/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const (
// MethodDepositTo defines the ABI method name for the deposit
// DepositAndWithdraw transaction.
MethodDepositTo = "depositTo"
MethodWithdraw = "withdrawPrinciple"
MethodWithdraw = "withdrawPrincipal"

MethodGetClientChains = "getClientChains"
)
Expand Down Expand Up @@ -50,7 +50,7 @@ func (p Precompile) DepositAndWithdraw(
case MethodDepositTo:
depositWithdrawParams.Action = assetstypes.Deposit
case MethodWithdraw:
depositWithdrawParams.Action = assetstypes.WithdrawPrinciple
depositWithdrawParams.Action = assetstypes.WithdrawPrincipal
default:
return nil, fmt.Errorf(cmn.ErrUnknownMethod, method.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion x/assets/keeper/bank.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (k Keeper) PerformDepositOrWithdraw(ctx sdk.Context, params *DepositWithdra
if params.OpAmount.Add(assetsInfo.StakingTotalAmount).GT(assetsInfo.AssetBasicInfo.TotalSupply) {
return errorsmod.Wrapf(assetstypes.ErrInvalidDepositAmount, "deposit amount will make the total staking amount greater than the total supply, amount:%s,totalStakingAmount:%s, totalSupply:%s", params.OpAmount, assetsInfo.StakingTotalAmount, assetsInfo.AssetBasicInfo.TotalSupply)
}
case assetstypes.WithdrawPrinciple:
case assetstypes.WithdrawPrincipal:
actualOpAmount = actualOpAmount.Neg()
default:
return errorsmod.Wrapf(assetstypes.ErrInvalidOperationType, "the operation type is: %v", params.Action)
Expand Down
2 changes: 1 addition & 1 deletion x/assets/types/general.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const (

const (
Deposit CrossChainOpType = iota
WithdrawPrinciple
WithdrawPrincipal
WithDrawReward
DelegateTo
UndelegateFrom
Expand Down

0 comments on commit 86d84f2

Please sign in to comment.