mirror of
https://github.com/0glabs/0g-chain.git
synced 2025-01-23 21:46:18 +00:00
refactor: mint
This commit is contained in:
parent
58871957a8
commit
88304562cc
@ -37,18 +37,17 @@ interface IWrappedA0GIBase {
|
||||
function minterSupply(address minter) external view returns (Supply memory);
|
||||
|
||||
/**
|
||||
* @dev mint a0gi to given address directly, add corresponding amount to minter's mint supply.
|
||||
* @dev mint a0gi to this precompile, add corresponding amount to minter's mint supply.
|
||||
* If sender's final mint supply exceeds its mint cap, the transaction will revert.
|
||||
* Can only be called by
|
||||
*
|
||||
* Can only be called by WA0GI.
|
||||
* @param minter minter address
|
||||
* @param to recipient address
|
||||
* @param amount amount to mint
|
||||
*/
|
||||
function mint(address minter, address to, uint256 amount) external;
|
||||
function mint(address minter, uint256 amount) external;
|
||||
|
||||
/**
|
||||
* @dev burn given amount of a0gi on behalf of minter, reduce corresponding amount from sender's mint supply.
|
||||
* Can only be called by WA0GI.
|
||||
* @param minter minter address
|
||||
* @param amount amount to burn
|
||||
*/
|
||||
|
@ -37,11 +37,6 @@
|
||||
"name": "minter",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amount",
|
||||
|
@ -30,7 +30,7 @@ var (
|
||||
|
||||
// Wrappeda0gibaseMetaData contains all meta data concerning the Wrappeda0gibase contract.
|
||||
var Wrappeda0gibaseMetaData = &bind.MetaData{
|
||||
ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getWA0GI\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"}],\"name\":\"minterSupply\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"cap\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"}],\"internalType\":\"structSupply\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]",
|
||||
ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getWA0GI\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"}],\"name\":\"minterSupply\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"cap\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"}],\"internalType\":\"structSupply\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]",
|
||||
}
|
||||
|
||||
// Wrappeda0gibaseABI is the input ABI used to generate the binding from.
|
||||
@ -252,23 +252,23 @@ func (_Wrappeda0gibase *Wrappeda0gibaseTransactorSession) GetWA0GI() (*types.Tra
|
||||
return _Wrappeda0gibase.Contract.GetWA0GI(&_Wrappeda0gibase.TransactOpts)
|
||||
}
|
||||
|
||||
// Mint is a paid mutator transaction binding the contract method 0xc6c3bbe6.
|
||||
// Mint is a paid mutator transaction binding the contract method 0x40c10f19.
|
||||
//
|
||||
// Solidity: function mint(address minter, address to, uint256 amount) returns()
|
||||
func (_Wrappeda0gibase *Wrappeda0gibaseTransactor) Mint(opts *bind.TransactOpts, minter common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) {
|
||||
return _Wrappeda0gibase.contract.Transact(opts, "mint", minter, to, amount)
|
||||
// Solidity: function mint(address minter, uint256 amount) returns()
|
||||
func (_Wrappeda0gibase *Wrappeda0gibaseTransactor) Mint(opts *bind.TransactOpts, minter common.Address, amount *big.Int) (*types.Transaction, error) {
|
||||
return _Wrappeda0gibase.contract.Transact(opts, "mint", minter, amount)
|
||||
}
|
||||
|
||||
// Mint is a paid mutator transaction binding the contract method 0xc6c3bbe6.
|
||||
// Mint is a paid mutator transaction binding the contract method 0x40c10f19.
|
||||
//
|
||||
// Solidity: function mint(address minter, address to, uint256 amount) returns()
|
||||
func (_Wrappeda0gibase *Wrappeda0gibaseSession) Mint(minter common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) {
|
||||
return _Wrappeda0gibase.Contract.Mint(&_Wrappeda0gibase.TransactOpts, minter, to, amount)
|
||||
// Solidity: function mint(address minter, uint256 amount) returns()
|
||||
func (_Wrappeda0gibase *Wrappeda0gibaseSession) Mint(minter common.Address, amount *big.Int) (*types.Transaction, error) {
|
||||
return _Wrappeda0gibase.Contract.Mint(&_Wrappeda0gibase.TransactOpts, minter, amount)
|
||||
}
|
||||
|
||||
// Mint is a paid mutator transaction binding the contract method 0xc6c3bbe6.
|
||||
// Mint is a paid mutator transaction binding the contract method 0x40c10f19.
|
||||
//
|
||||
// Solidity: function mint(address minter, address to, uint256 amount) returns()
|
||||
func (_Wrappeda0gibase *Wrappeda0gibaseTransactorSession) Mint(minter common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) {
|
||||
return _Wrappeda0gibase.Contract.Mint(&_Wrappeda0gibase.TransactOpts, minter, to, amount)
|
||||
// Solidity: function mint(address minter, uint256 amount) returns()
|
||||
func (_Wrappeda0gibase *Wrappeda0gibaseTransactorSession) Mint(minter common.Address, amount *big.Int) (*types.Transaction, error) {
|
||||
return _Wrappeda0gibase.Contract.Mint(&_Wrappeda0gibase.TransactOpts, minter, amount)
|
||||
}
|
||||
|
@ -33,8 +33,7 @@ message MsgSetMintCapResponse {}
|
||||
|
||||
message MsgMint {
|
||||
bytes minter = 1;
|
||||
bytes to = 2;
|
||||
bytes amount = 3; // big endian
|
||||
bytes amount = 2; // big endian
|
||||
}
|
||||
|
||||
message MsgMintResponse {}
|
||||
|
@ -35,12 +35,8 @@ func (k Keeper) Burn(goCtx context.Context, msg *types.MsgBurn) (*types.MsgBurnR
|
||||
if err = k.setMinterSupply(ctx, minter, supply); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// transfer & burn
|
||||
// burn
|
||||
c := sdk.NewCoin(precisebanktypes.ExtendedCoinDenom, sdk.NewIntFromBigInt(amount))
|
||||
burner := sdk.AccAddress(minter.Bytes())
|
||||
if err = k.pbkeeper.SendCoinsFromAccountToModule(ctx, burner, types.ModuleName, sdk.NewCoins(c)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = k.pbkeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(c)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -68,15 +64,11 @@ func (k Keeper) Mint(goCtx context.Context, msg *types.MsgMint) (*types.MsgMintR
|
||||
if err = k.setMinterSupply(ctx, minter, supply); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// mint & transfer
|
||||
// mint
|
||||
c := sdk.NewCoin(precisebanktypes.ExtendedCoinDenom, sdk.NewIntFromBigInt(amount))
|
||||
if err = k.pbkeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(c)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
recipient := sdk.AccAddress(common.BytesToAddress(msg.To).Bytes())
|
||||
if err = k.pbkeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, recipient, sdk.NewCoins(c)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &types.MsgMintResponse{}, nil
|
||||
}
|
||||
|
||||
|
@ -181,8 +181,7 @@ var xxx_messageInfo_MsgSetMintCapResponse proto.InternalMessageInfo
|
||||
|
||||
type MsgMint struct {
|
||||
Minter []byte `protobuf:"bytes,1,opt,name=minter,proto3" json:"minter,omitempty"`
|
||||
To []byte `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"`
|
||||
Amount []byte `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"`
|
||||
Amount []byte `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgMint) Reset() { *m = MsgMint{} }
|
||||
@ -342,35 +341,34 @@ func init() {
|
||||
func init() { proto.RegisterFile("zgc/wrappeda0gibase/tx.proto", fileDescriptor_f80bf93a1fc022d3) }
|
||||
|
||||
var fileDescriptor_f80bf93a1fc022d3 = []byte{
|
||||
// 436 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xcf, 0x8b, 0xd3, 0x40,
|
||||
0x14, 0xc7, 0x93, 0x54, 0x76, 0xdd, 0xe7, 0xfa, 0x2b, 0xeb, 0x6a, 0x36, 0x94, 0x50, 0x82, 0x87,
|
||||
0x22, 0x34, 0x13, 0xd4, 0x8b, 0x47, 0x57, 0x44, 0x56, 0xc8, 0x25, 0x82, 0x0b, 0x1e, 0x94, 0x49,
|
||||
0x3a, 0x4e, 0x03, 0x9b, 0x4c, 0xc8, 0x4c, 0x70, 0xbb, 0x7f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, 0xc9, 0xd0, 0x75, 0x73, 0x89, 0x13, 0x09, 0x9f, 0xd4, 0xb7, 0x38, 0xcf,
|
||||
0x09, 0x8f, 0x0e, 0xaa, 0x73, 0x79, 0xf5, 0x2f, 0x00, 0x00, 0xff, 0xff, 0xeb, 0x19, 0x0a, 0x77,
|
||||
0xaf, 0x03, 0x00, 0x00,
|
||||
// 421 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0x4f, 0xab, 0xd3, 0x40,
|
||||
0x14, 0xc5, 0x93, 0x57, 0xe9, 0xf3, 0x5d, 0x2b, 0x6a, 0x6a, 0x6b, 0x1a, 0x4a, 0x28, 0xc1, 0x45,
|
||||
0x11, 0x9a, 0x09, 0xea, 0xc6, 0xa5, 0x15, 0x11, 0x85, 0x6c, 0x22, 0x58, 0x70, 0xa1, 0x4c, 0xd2,
|
||||
0x71, 0x1a, 0x68, 0x32, 0x21, 0x33, 0xc1, 0xb6, 0x9f, 0xc2, 0x8f, 0xd5, 0x65, 0x37, 0x82, 0x4b,
|
||||
0x6d, 0xbf, 0x88, 0x4c, 0xfe, 0xd4, 0xb4, 0xd8, 0x16, 0xde, 0x2e, 0xe7, 0x9c, 0x7b, 0x7f, 0x03,
|
||||
0x27, 0x5c, 0xe8, 0xaf, 0x68, 0x80, 0xbe, 0xa7, 0x38, 0x49, 0xc8, 0x14, 0x3b, 0x34, 0xf4, 0x31,
|
||||
0x27, 0x48, 0x2c, 0xec, 0x24, 0x65, 0x82, 0x69, 0xed, 0x15, 0x0d, 0xec, 0xa3, 0xd4, 0xe8, 0x05,
|
||||
0x8c, 0x47, 0x8c, 0x7f, 0xcd, 0x47, 0x50, 0x21, 0x8a, 0x79, 0xe3, 0x31, 0x65, 0x94, 0x15, 0xbe,
|
||||
0xfc, 0x2a, 0xdd, 0x1e, 0x65, 0x8c, 0xce, 0x09, 0xca, 0x95, 0x9f, 0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 0x78, 0x76, 0x79, 0x66, 0xcf, 0xff,
|
||||
0x00, 0x77, 0xf2, 0x62, 0xfb, 0xa7, 0x76, 0x64, 0x6a, 0x3c, 0x3d, 0x97, 0xd6, 0x59, 0x79, 0xad,
|
||||
0x27, 0x59, 0x32, 0x3d, 0xcd, 0xaa, 0xf7, 0x3a, 0xf6, 0xd6, 0x7f, 0x4c, 0x65, 0xbd, 0x35, 0xd5,
|
||||
0xcd, 0xd6, 0x54, 0x7f, 0x6f, 0x4d, 0xf5, 0xc7, 0xce, 0x54, 0x36, 0x3b, 0x53, 0xf9, 0xb5, 0x33,
|
||||
0x95, 0xcf, 0x2f, 0x69, 0x28, 0x66, 0x99, 0x6f, 0x07, 0x2c, 0x42, 0x0e, 0x9d, 0x63, 0x9f, 0x23,
|
||||
0x87, 0x8e, 0x82, 0x19, 0x0e, 0x63, 0xb4, 0xa8, 0x2e, 0x6f, 0x24, 0xe1, 0xa3, 0xe2, 0xf6, 0x96,
|
||||
0x09, 0xe1, 0x7e, 0x33, 0x3f, 0x8f, 0x17, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x6f, 0x43, 0x23,
|
||||
0x4d, 0x9f, 0x03, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -713,13 +711,6 @@ func (m *MsgMint) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
copy(dAtA[i:], m.Amount)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Amount)))
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
if len(m.To) > 0 {
|
||||
i -= len(m.To)
|
||||
copy(dAtA[i:], m.To)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.To)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if len(m.Minter) > 0 {
|
||||
@ -892,10 +883,6 @@ func (m *MsgMint) Size() (n int) {
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
l = len(m.To)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
l = len(m.Amount)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
@ -1374,40 +1361,6 @@ func (m *MsgMint) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field To", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.To = append(m.To[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.To == nil {
|
||||
m.To = []byte{}
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user