mirror of
https://github.com/galacticship/terra.git
synced 2024-11-09 01:37:51 +00:00
add galactic punks staking contract
This commit is contained in:
parent
5224955822
commit
85c0bf9099
32
protocols/galacticpunks/staking.go
Normal file
32
protocols/galacticpunks/staking.go
Normal file
@ -0,0 +1,32 @@
|
||||
package galacticpunks
|
||||
|
||||
import (
|
||||
"github.com/galacticship/terra"
|
||||
"github.com/galacticship/terra/cosmos"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type Staking struct {
|
||||
*terra.Contract
|
||||
}
|
||||
|
||||
func NewStaking(querier *terra.Querier) (*Staking, error) {
|
||||
contract, err := terra.NewContract(querier, "terra10t4pgfs6s3qeykqgfq9r74s89jmu7zx5gfkga5")
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "init contract object")
|
||||
}
|
||||
|
||||
return &Staking{
|
||||
Contract: contract,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Staking) NewWithdrawRewardsMessage(sender cosmos.AccAddress, tokenId string) (cosmos.Msg, error) {
|
||||
var q struct {
|
||||
WithdrawRewards struct {
|
||||
TokenId string `json:"token_id"`
|
||||
} `json:"withdraw_rewards"`
|
||||
}
|
||||
q.WithdrawRewards.TokenId = tokenId
|
||||
return s.NewMsgExecuteContract(sender, q)
|
||||
}
|
Loading…
Reference in New Issue
Block a user