-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Delete pools list * Get things to compile * Update go pools Update agent info * Update agent info * Fix agent liquidation value command * Deprecate preview functionality * Deprecate preview flags * Improve agent info again * Update go pools * Remove unecessary calls * Update go pools * Add ability to override routes via config file for mainnet/calibnet testing (#159) * Finalize CLI * Fix withdraw redeem --------- Co-authored-by: Jim Pick <[email protected]>
- Loading branch information
1 parent
e8666a6
commit adc9874
Showing
18 changed files
with
369 additions
and
761 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
This file was deleted.
Oops, something went wrong.
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,61 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
|
||
"github.com/briandowns/spinner" | ||
"github.com/ethereum/go-ethereum/accounts/abi/bind" | ||
"github.com/glifio/go-pools/abigen" | ||
"github.com/glifio/go-pools/util" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var iFILAllowanceCmd = &cobra.Command{ | ||
Use: "allowance [owner] [spender]", | ||
Short: "Get the iFIL balance of an address", | ||
Args: cobra.ExactArgs(2), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
owner := args[0] | ||
spender := args[1] | ||
fmt.Printf("Checking iFIL allowance of spender: %s on behalf of owner: %s ...", spender, owner) | ||
|
||
s := spinner.New(spinner.CharSets[9], 100*time.Millisecond) | ||
s.Start() | ||
defer s.Stop() | ||
ownerAddr, err := AddressOrAccountNameToEVM(cmd.Context(), owner) | ||
if err != nil { | ||
logFatalf("Failed to parse owner address %s", err) | ||
} | ||
|
||
spenderAddr, err := AddressOrAccountNameToEVM(cmd.Context(), spender) | ||
if err != nil { | ||
logFatalf("Failed to parse spender address %s", err) | ||
} | ||
|
||
client, err := PoolsSDK.Extern().ConnectEthClient() | ||
if err != nil { | ||
logFatalf("Failed to get iFIL balance %s", err) | ||
} | ||
defer client.Close() | ||
|
||
poolToken, err := abigen.NewPoolTokenCaller(PoolsSDK.Query().IFIL(), client) | ||
if err != nil { | ||
logFatalf("Failed to get iFIL balance %s", err) | ||
} | ||
|
||
allow, err := poolToken.Allowance(&bind.CallOpts{}, ownerAddr, spenderAddr) | ||
if err != nil { | ||
logFatalf("Failed to get iFIL allowance %s", err) | ||
} | ||
|
||
s.Stop() | ||
|
||
fmt.Printf("iFIL allowance for spender: %s on behalf of owner: %s is %.09f\n", spender, owner, util.ToFIL(allow)) | ||
|
||
}, | ||
} | ||
|
||
func init() { | ||
iFILCmd.AddCommand(iFILAllowanceCmd) | ||
} |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.