-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from eoscanada/feature/rex
Feature/rex
- Loading branch information
Showing
23 changed files
with
608 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright © 2018 EOS Canada <[email protected]> | ||
|
||
package cmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var rexCmd = &cobra.Command{ | ||
Use: "rex", | ||
Short: "EOS REX interactions", | ||
} | ||
|
||
func init() { | ||
RootCmd.AddCommand(rexCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright © 2018 EOS Canada <[email protected]> | ||
|
||
package cmd | ||
|
||
import ( | ||
"github.com/eoscanada/eos-go/rex" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var rexBuy = &cobra.Command{ | ||
Use: "buy [account] [quantity]", | ||
Short: "Buy REX tokens using EOS tokens.", | ||
Long: "Buy REX tokens using EOS tokens within your REX fund.", | ||
Args: cobra.ExactArgs(2), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
account := toAccount(args[0], "account") | ||
quantity := toEOSAsset(args[1], "quantity") | ||
|
||
pushEOSCActions(getAPI(), rex.NewBuyREX( | ||
account, | ||
quantity, | ||
)) | ||
}, | ||
} | ||
|
||
func init() { | ||
rexCmd.AddCommand(rexBuy) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright © 2018 EOS Canada <[email protected]> | ||
|
||
package cmd | ||
|
||
import ( | ||
"github.com/eoscanada/eos-go/rex" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var rexCancel = &cobra.Command{ | ||
Use: "cancel [account]", | ||
Short: "Cancels any unfilled sell orders.", | ||
Long: "Cancels any unfilled sell orders for REX tokens.", | ||
Args: cobra.ExactArgs(1), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
account := toAccount(args[0], "account") | ||
|
||
pushEOSCActions(getAPI(), rex.NewCancelREXOrder( | ||
account, | ||
)) | ||
}, | ||
} | ||
|
||
func init() { | ||
rexCmd.AddCommand(rexCancel) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright © 2018 EOS Canada <[email protected]> | ||
|
||
package cmd | ||
|
||
import ( | ||
"github.com/eoscanada/eos-go/rex" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var rexClose = &cobra.Command{ | ||
Use: "close [account]", | ||
Short: "Removes all REX related entries from table.", | ||
Long: "Free RAM from an account by removing its entry in the REX table. This action will fail if the account has any pending loans, refunds, or REX tokens.", | ||
Args: cobra.ExactArgs(1), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
account := toAccount(args[0], "account") | ||
|
||
pushEOSCActions(getAPI(), rex.NewCloseREX( | ||
account, | ||
)) | ||
}, | ||
} | ||
|
||
func init() { | ||
rexCmd.AddCommand(rexClose) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright © 2018 EOS Canada <[email protected]> | ||
|
||
package cmd | ||
|
||
import ( | ||
"github.com/eoscanada/eos-go/rex" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var rexConsolidate = &cobra.Command{ | ||
Use: "consolidate [account]", | ||
Short: "Consolidates any active REX maturity buckets.", | ||
Long: "Consolidates any active REX maturity buckets into a single bucket that will mature in 4 days.", | ||
Args: cobra.ExactArgs(1), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
account := toAccount(args[0], "account") | ||
|
||
pushEOSCActions(getAPI(), rex.NewConsolidate( | ||
account, | ||
)) | ||
}, | ||
} | ||
|
||
func init() { | ||
rexCmd.AddCommand(rexConsolidate) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright © 2018 EOS Canada <[email protected]> | ||
|
||
package cmd | ||
|
||
import ( | ||
"github.com/eoscanada/eos-go/rex" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var rexDefundCPU = &cobra.Command{ | ||
Use: "defund-cpu [account] [loan number] [quantity]", | ||
Short: "Remove EOS tokens set for renewal of a CPU loan.", | ||
Long: "Remove EOS tokens set for renewal of a CPU loan.", | ||
Args: cobra.ExactArgs(3), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
account := toAccount(args[0], "account") | ||
loanNumber := toUint64(args[1], "loan number") | ||
quantity := toEOSAsset(args[2], "quantity") | ||
|
||
pushEOSCActions(getAPI(), rex.NewDefundCPULoan( | ||
account, | ||
loanNumber, | ||
quantity, | ||
)) | ||
}, | ||
} | ||
|
||
func init() { | ||
rexCmd.AddCommand(rexDefundCPU) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright © 2018 EOS Canada <[email protected]> | ||
|
||
package cmd | ||
|
||
import ( | ||
"github.com/eoscanada/eos-go/rex" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var rexDefundNet = &cobra.Command{ | ||
Use: "defund-net [account] [loan number] [quantity]", | ||
Short: "Remove EOS tokens set for renewal of a Network loan.", | ||
Long: "Remove EOS tokens set for renewal of a Network loan.", | ||
Args: cobra.ExactArgs(3), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
account := toAccount(args[0], "account") | ||
loanNumber := toUint64(args[1], "loan number") | ||
quantity := toEOSAsset(args[2], "quantity") | ||
|
||
pushEOSCActions(getAPI(), rex.NewDefundNetLoan( | ||
account, | ||
loanNumber, | ||
quantity, | ||
)) | ||
}, | ||
} | ||
|
||
func init() { | ||
rexCmd.AddCommand(rexDefundNet) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright © 2018 EOS Canada <[email protected]> | ||
|
||
package cmd | ||
|
||
import ( | ||
"github.com/eoscanada/eos-go/rex" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var rexDeposit = &cobra.Command{ | ||
Use: "deposit [account] [quantity]", | ||
Short: "Deposit EOS tokens into your REX fund.", | ||
Long: "Deposit EOS tokens into your REX fund, to be used to purchase REX tokens.", | ||
Args: cobra.ExactArgs(2), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
account := toAccount(args[0], "account") | ||
quantity := toEOSAsset(args[1], "quantity") | ||
|
||
pushEOSCActions(getAPI(), rex.NewDeposit( | ||
account, | ||
quantity, | ||
)) | ||
}, | ||
} | ||
|
||
func init() { | ||
rexCmd.AddCommand(rexDeposit) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright © 2018 EOS Canada <[email protected]> | ||
|
||
package cmd | ||
|
||
import ( | ||
"github.com/eoscanada/eos-go/rex" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var rexExec = &cobra.Command{ | ||
Use: "exec [account] [max count]", | ||
Short: "Perform maintenance on the REX contract.", | ||
Long: "Perform maintenance on the REX contract (process expired loans or pending sell orders). [max count] needs to be low enough to allow the transaction to be executed within a block.", | ||
Args: cobra.ExactArgs(2), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
account := toAccount(args[0], "account") | ||
maxCount := toUint16(args[1], "max count") | ||
|
||
pushEOSCActions(getAPI(), rex.NewREXExec( | ||
account, | ||
maxCount, | ||
)) | ||
}, | ||
} | ||
|
||
func init() { | ||
rexCmd.AddCommand(rexExec) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright © 2018 EOS Canada <[email protected]> | ||
|
||
package cmd | ||
|
||
import ( | ||
"github.com/eoscanada/eos-go/rex" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var rexFromSavings = &cobra.Command{ | ||
Use: "from-savings [account] [quantity]", | ||
Short: "Withdraw REX tokens from your savings bucket.", | ||
Long: "Withdraw REX tokens from your savings bucket into your REX fund. Those funds will become available in 4 days.", | ||
Args: cobra.ExactArgs(2), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
account := toAccount(args[0], "account") | ||
quantity := toREXAsset(args[1], "quantity") | ||
|
||
pushEOSCActions(getAPI(), rex.NewMoveFromSavings( | ||
account, | ||
quantity, | ||
)) | ||
}, | ||
} | ||
|
||
func init() { | ||
rexCmd.AddCommand(rexFromSavings) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright © 2018 EOS Canada <[email protected]> | ||
|
||
package cmd | ||
|
||
import ( | ||
"github.com/eoscanada/eos-go/rex" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var rexFundCPU = &cobra.Command{ | ||
Use: "fund-cpu [account] [loan number] [quantity]", | ||
Short: "Set EOS tokens to renew a CPU loan upon expiry.", | ||
Long: "Set an amount of EOS tokens from your REX fund to be used to renew a CPU loan upon expiry.", | ||
Args: cobra.ExactArgs(3), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
account := toAccount(args[0], "account") | ||
loanNumber := toUint64(args[1], "loan number") | ||
quantity := toEOSAsset(args[2], "quantity") | ||
|
||
pushEOSCActions(getAPI(), rex.NewFundCPULoan( | ||
account, | ||
loanNumber, | ||
quantity, | ||
)) | ||
}, | ||
} | ||
|
||
func init() { | ||
rexCmd.AddCommand(rexFundCPU) | ||
} |
Oops, something went wrong.