Add minting algorithm to dposV3 contract - #1334
Conversation
|
|
||
|
|
||
| // MintToDPOS adds loom coins to the loom coin DPOS contract balance, and updates the total supply. | ||
| func (c *Coin) MintToDPOS(ctx contract.Context, req *MintToDPOSRequest) error { |
There was a problem hiding this comment.
Don't need this, the DPOS contract will only mint ERC20
| func MintERC20CmdV3() *cobra.Command { | ||
| var flags cli.ContractCallFlags | ||
| cmd := &cobra.Command{ | ||
| Use: "mint-erc20 [amount] [erc20token Address]", |
|
|
||
| func loadERC20Token(ctx contract.Context, tokenAddr loom.Address) (*erc20Context, error) { | ||
| erc20 := newERC20Context(ctx, tokenAddr) | ||
| return erc20,nil |
| } | ||
|
|
||
| //MintVouchers method to the DPOS contract that can be called only by delegators - Mints Loom Coin | ||
| func (c *DPOS) MintVoucher(ctx contract.Context, req *MintVoucherRequest) error { |
| } | ||
|
|
||
| //MintVouchersERC20 method to the DPOS contract that can be called only by delegators - Mints Generic ERC20 Token | ||
| func (c *DPOS) MintVoucherERC20(ctx contract.Context, req *MintVoucherERC20Request) error { |
There was a problem hiding this comment.
Check req.Amount != nil and greater than zero before doing anything else.
There was a problem hiding this comment.
And this new method should return an error if dpos:v3.6 feature is not enabled.
There was a problem hiding this comment.
Added nil check for VoucherTokenAddress as well.
| sender := ctx.Message().Sender | ||
| for _, d := range delegations { | ||
| if loom.UnmarshalAddressPB(d.Delegator).Compare(sender) == 0 { | ||
| erc20, err := loadERC20Token(ctx, loom.UnmarshalAddressPB(req.TokenAddress)) |
There was a problem hiding this comment.
VoucherTokenAddress should be stored in state.Params.VoucherTokenAddress, not passed in the request.
…ontract balance, and updates the total supply.
2)Add req.Amount=nil or zero check
d4777f7 to
33bb821
Compare
…oomnetwork/loomchain into Add_Minting_Algorithm_To_DPOS_Contract
In this case minting does not take place as request must come from a delegator
(require msg.sender == dpos) This is for access control for minting SampleERC20Token.sol
|
https://ci.kanwisher.com/blue/organizations/jenkins/loom-sdk-pipeline-prbuilder/detail/loom-sdk-pipeline-prbuilder/5138/pipeline/ Replayed build is building fine. |
|
Will revisit this at a later date. |
Add minting algorithm to dposV3 contract
Adds new MintVouchers method to the DPOS contract that can be called only by delegators