Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge master into future/peggy2 #3369

Draft
wants to merge 210 commits into
base: future/peggy2
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
210 commits
Select commit Hold shift + click to select a range
701f6ba
add pauser which will be user to pause and unpause Lock and Burn tran…
Apr 22, 2022
2692341
add set-pauser transaction to modify the pauser struct
Apr 22, 2022
ea8b473
Add a new query to check status of pauser
Apr 23, 2022
0ce83bc
Fixed minor lint issues
Apr 23, 2022
55d65e3
Revert tokenregistry admin to set initial state from genesisdata
Apr 23, 2022
c5824c1
Merge branch 'develop' into feature/bridge-pauser
Jedi2002 Apr 23, 2022
1c5044a
Add Unit test for lock
Apr 27, 2022
80f48c2
Remove unnecessary logs
Apr 27, 2022
ddf39b6
add test for message burn
Apr 27, 2022
868a6e7
fix simulator app for ethbridge
Apr 27, 2022
99d43fa
add unit test for ParseStringToBool
Apr 27, 2022
7543270
fixed linter for test table
Apr 27, 2022
ce93267
rename test cases for utils_test.go test table
Apr 27, 2022
031ac23
rename test cases for utils_test.go test table
Apr 27, 2022
79ac03a
Implemented change requests
May 12, 2022
8353e4d
Merge branch 'develop' into feature/bridge-pauser
Jedi2002 May 13, 2022
05e3522
Merge branch 'develop' into feature/bridge-pauser
Jedi2002 Jun 21, 2022
17a8ee5
WIP: update asymm add
joneskm Aug 8, 2022
ab756e1
Merge branch 'master' into feature/asymmetric-adds
joneskm Aug 10, 2022
3e585d3
WIP: asymmetric adds
joneskm Aug 11, 2022
7f889a7
Calculate swap amount for symmetric add
joneskm Aug 11, 2022
a287d0d
Merge branch 'feature/peggy-decimals' into feature/asymmetric-adds
joneskm Aug 12, 2022
20d0554
Calculate native swap amount for asymmetric add
joneskm Aug 15, 2022
7ced4eb
Calculate pool units
joneskm Aug 18, 2022
fa6d700
Clarify comment
joneskm Aug 18, 2022
395d5d8
Merge branch 'master' into feature/asymmetric-adds
joneskm Aug 31, 2022
027ab34
Cleanup pool unit calculation
joneskm Sep 1, 2022
9a5f024
Pass swapFeeRate to pool units calc
joneskm Sep 1, 2022
88fb867
Add unit tests and fix bugs
joneskm Sep 2, 2022
6a99634
Cleanup asymmetric add terms
joneskm Sep 5, 2022
558e722
Merge branch 'master' into feature/asymmetric-adds
joneskm Sep 5, 2022
6dda902
Swap in new CalculatePoolUnits function
joneskm Sep 5, 2022
f98882f
Add liquidity protection on asymmetric adds
joneskm Sep 6, 2022
f4be22c
Revert to using spot price instead of just price
joneskm Sep 7, 2022
d9e00ed
Merge branch 'fix/atom-pool' into release/v1.0-beta.13
timlind Sep 23, 2022
d1f6bb8
test add liquidity
timlind Sep 27, 2022
63d4a1e
Merge branch 'master' into feature/asymmetric-adds
joneskm Sep 27, 2022
777e821
Change default lock period to zero
joneskm Sep 30, 2022
ca18296
rebase master and fix unit tests
Jedi2002 Oct 2, 2022
7304f76
Add asymmetric add proposal and tutorial
joneskm Oct 3, 2022
2bf8be2
Update asymmetric-adds.md
joneskm Oct 3, 2022
1519aaf
Add add liquidity unit test
joneskm Oct 3, 2022
3582b97
clean open position
timlind Oct 4, 2022
6a0e390
verify pool and lp units on add
timlind Oct 4, 2022
af5414e
Changed RountInt to TruncateInt in calcualtions.go
Jedi2002 Oct 5, 2022
220c89c
Merge branch 'master' into test/integration-test
timlind Oct 5, 2022
ffc026c
verify remove
timlind Oct 6, 2022
999c9e5
siftest verify remove
timlind Oct 6, 2022
eb3196c
Merge branch 'master' into test/integration-test
timlind Oct 6, 2022
b97ab4f
siftest verify add
timlind Oct 7, 2022
8778ded
siftest verify close
timlind Oct 10, 2022
3314a53
include final interest payment
timlind Oct 10, 2022
0db6e5a
more outputs for verify close
timlind Oct 11, 2022
09ceda1
readme
timlind Oct 11, 2022
313a299
readme for add
timlind Oct 11, 2022
b040ddf
readme for remove
timlind Oct 11, 2022
4346dd2
readme for installation
timlind Oct 11, 2022
39e66cc
readme usage
timlind Oct 11, 2022
590e267
Merge branch 'master' into test/integration-test
timlind Oct 12, 2022
d9451d3
Fix bug in add liquidity DLP calc
joneskm Oct 12, 2022
7c6a0a0
Merge branch 'master' into feature/asymmetric-adds
joneskm Oct 12, 2022
3e9b3b3
Fix lint errors
joneskm Oct 12, 2022
3aa113c
use new swap fee endpoint
timlind Oct 12, 2022
558269b
show unexpected lp diff value
timlind Oct 13, 2022
88bc42f
Set default value of param to false
Jedi2002 Oct 13, 2022
588b59e
Merge pull request #3325 from Sifchain/chore/update-version
joneskm Oct 13, 2022
3ed9a61
Fix asymmetric adds proposal
joneskm Oct 13, 2022
52d1bd6
Fix asymmetric adds proposal
joneskm Oct 13, 2022
323984d
Fix asymmetric adds proposal
joneskm Oct 13, 2022
1c7fc64
show pool diff for add liquidity
timlind Oct 14, 2022
bd56ca7
cosmos sdk v0.45.8
timlind Oct 14, 2022
ec5aea9
ibc go 2.4.1
timlind Oct 14, 2022
f0bf1f0
semver
timlind Oct 14, 2022
a74514b
cosmos sdk v0.45.9
timlind Oct 14, 2022
17122cc
ics23 replace
timlind Oct 14, 2022
5bb8a10
ics23 replace v0.8.0
timlind Oct 14, 2022
31a7033
1.0.14-rc.1
timlind Oct 14, 2022
db66db1
fix app_test and lint
timlind Oct 14, 2022
4228a88
revert upgrade of ibc-go
timlind Oct 15, 2022
f6850cf
1.0.13-rc.1
timlind Oct 15, 2022
a391531
Not needed, can break build.
khdegraaf Oct 15, 2022
35e970f
Merge pull request #3327 from Sifchain/feature/cosmos-v0.45.8
khdegraaf Oct 15, 2022
9a9e269
Bump version
joneskm Oct 15, 2022
ea4cb0b
Merge pull request #3330 from Sifchain/chore/version-bump
gzukel Oct 15, 2022
15d64db
split files
timlind Oct 18, 2022
329f049
Add parameterized swap fee rates and remove min swap fee
joneskm Oct 18, 2022
ee639da
Add parameterized swap fees proposal and tutorial
joneskm Oct 18, 2022
9c4af0a
setup test
timlind Oct 18, 2022
0151163
store and compare results
timlind Oct 19, 2022
4e8a004
Add product spec to parameterized swap fee rate proposal
joneskm Oct 19, 2022
1d674c7
Bump version and upgrade swapFeeParams
joneskm Oct 19, 2022
184f26d
Merge pull request #3332 from Sifchain/feature/parameterized-swap-fee…
joneskm Oct 19, 2022
8c3e683
fix: 🐛 RC1 version
canercandan Oct 19, 2022
dda19e9
Merge pull request #3335 from Sifchain/fix/version
canercandan Oct 19, 2022
db0c787
readme
timlind Oct 20, 2022
3432575
test case struct
timlind Oct 20, 2022
cdf305d
Merge branch 'master' into feature/integration-test
timlind Oct 20, 2022
bbbe488
readme for setup
timlind Oct 20, 2022
6150012
feat: 🎸 use default swap fee rate on margin
canercandan Oct 20, 2022
d21dbc2
fix: 🐛 RC2
canercandan Oct 20, 2022
b7d3a5d
Add test to test lock behavior when setpauser was never called
Oct 21, 2022
4a3c1b1
add unit test file
juniuszhou Oct 21, 2022
56e5e40
Merge branch 'master' into feature/bridge-pauser
juniuszhou Oct 21, 2022
5fbcf6c
Merge pull request #3337 from Sifchain/feature/default-swap-fee-on-ma…
canercandan Oct 21, 2022
b0fa9f6
dynamic message execution
timlind Oct 21, 2022
e4e1bc3
policy setup
timlind Oct 21, 2022
a48272b
Merge branch 'master' into feature/bridge-pauser
Brando753 Oct 21, 2022
ec5eb3e
Update cli prompt
Oct 21, 2022
8da5778
fix: 🐛 bump to 14-beta
canercandan Oct 21, 2022
b533064
Merge future/peggy2 /smartcontracts/ directory into master in anticip…
Brando753 Oct 23, 2022
bfd393e
Updated github actions tests to use hardhat tests over truffle tests.
Brando753 Oct 23, 2022
9c2d683
Merge pull request #3341 from Sifchain/mergeSmartContracts
Brando753 Oct 23, 2022
1f4937d
more test cases
timlind Oct 24, 2022
fe8419c
Revert early merge of peggy2 contracts as they broke other integratio…
Brando753 Oct 24, 2022
a6f1ceb
Merge pull request #3345 from Sifchain/revertPeggy2Contract
khdegraaf Oct 24, 2022
b21a937
Merge branch 'master' into feature/integration-test
timlind Oct 25, 2022
47067c8
indented json
timlind Oct 25, 2022
e67e268
Merge remote-tracking branch 'origin/feature/integration-test' into f…
timlind Oct 25, 2022
f6b06c2
lint: write file permission
timlind Oct 25, 2022
8dc9ff7
lint
timlind Oct 25, 2022
05d8d50
Merge branch 'master' into test/integration-test
timlind Oct 25, 2022
f6faf3a
fix merge
timlind Oct 25, 2022
bd56d2a
pr feedback
timlind Oct 31, 2022
f232130
Merge branch 'master' into fix/version-14-beta
canercandan Oct 31, 2022
02f2b8b
Merge pull request #3340 from Sifchain/fix/version-14-beta
canercandan Oct 31, 2022
1e378f9
Merge branch 'master' into test/integration-test
timlind Oct 31, 2022
1da95a6
Update parameterized_swap_fees.md
ghuznee Oct 31, 2022
5207375
Merge pull request #3352 from Sifchain/ghuznee-patch-1
khdegraaf Oct 31, 2022
e09e331
Update parameterized_swap_fees.md
ghuznee Oct 31, 2022
07d431f
Update parameterized_swap_fees.md
ghuznee Oct 31, 2022
2440eb0
Merge pull request #3354 from Sifchain/ghuznee-patch-2
khdegraaf Oct 31, 2022
5561035
Margin test logic
jzvikart Aug 31, 2022
6ca6f92
Margin testing
jzvikart Aug 31, 2022
3ae7af5
Disable noisy loggers
jzvikart Sep 14, 2022
d2839af
Fix typos
jzvikart Oct 31, 2022
d316d58
Cleanup asymmetric adds tutorial
joneskm Nov 1, 2022
d1f769d
Merge branch 'master' into feature/asymmetric-adds
joneskm Nov 1, 2022
810b2d5
Merge branch 'master' into feature/integration-test
canercandan Nov 1, 2022
3e49456
Merge pull request #3333 from Sifchain/feature/integration-test
timlind Nov 2, 2022
1767690
Merge branch 'master' into jure/min-commission
Nov 2, 2022
5d98770
Merge pull request #3356 from Sifchain/jure/min-commission
khdegraaf Nov 2, 2022
db109a5
min fee for submit proposal
timlind Nov 3, 2022
eefa5de
Merge branch 'master' into feature/asymmetric-adds
joneskm Nov 3, 2022
9d6e5c3
Merge pull request #3316 from Sifchain/feature/asymmetric-adds
joneskm Nov 3, 2022
e1c1daa
Merge branch 'master' into feature/submit-proposal-min-fee
canercandan Nov 3, 2022
ea0ba3c
Merge pull request #3360 from Sifchain/feature/submit-proposal-min-fee
canercandan Nov 3, 2022
438759a
Merge branch 'master' into feature/bridge-pauser
Nov 3, 2022
1c2e329
Move peggy2 burn logic into own control flow
Nov 2, 2022
c85e81a
Add WIP integration test for pausing/unpausing ethbridge lock/burn fu…
Nov 3, 2022
6ef0b10
Add comment on wip
Nov 3, 2022
33517d1
Add siftool implementation for calling peggy1 ethbridge modue set-pau…
Nov 3, 2022
c879656
Add sifchain ethbridge module admin account to sifnoded class
Nov 3, 2022
62fa2e7
Add incomplete test impl. Add unimplemented test for calling pause/un…
Nov 3, 2022
4f10830
dynamic propsal fee
timlind Nov 4, 2022
c6b19d5
upgrade handler
timlind Nov 4, 2022
16b37e7
Merge branch 'master' into feature/dynamic-proposal-fee
canercandan Nov 4, 2022
7dd7290
fix tests
timlind Nov 4, 2022
cf65d62
Merge remote-tracking branch 'origin/feature/dynamic-proposal-fee' in…
timlind Nov 4, 2022
1a40659
default fee
timlind Nov 4, 2022
4aa8bef
Merge pull request #3361 from Sifchain/feature/dynamic-proposal-fee
canercandan Nov 4, 2022
fb43bbf
Update siftool's pause peggy bridge impl with missing params
Nov 4, 2022
7901784
Remove unused home param, add silent-yes args, and remove response ma…
Nov 5, 2022
eeea780
Move pausing/unpausing impl into DRY function, pause/unpause_peggy_br…
Nov 5, 2022
7ccfba5
Set broadcasting mode to block, wont return until tx is mined
Nov 5, 2022
706a55f
fix: 🐛 DLP discounted sent amount
canercandan Nov 5, 2022
92d8619
Add complete impl for pause unpause no error. WIP lock/burn test
Nov 7, 2022
d357030
feat: 🎸 include discounted swap amount to add liquidity
canercandan Nov 7, 2022
708e790
Merge pull request #3362 from Sifchain/feature/dlp-discounted-sent-am…
canercandan Nov 7, 2022
d2c4e2d
Add complete impl for peggy1 lock/burn
Nov 8, 2022
7c0094e
Add helper method to retrieve bridgetoken contract
Nov 8, 2022
8f37ccb
Add impl for int. test
Nov 8, 2022
265bc48
Cleanup remove printouts
Nov 8, 2022
821660d
Remove unneeded assertion, pausing will be available in peggy2 after …
Nov 8, 2022
610f32d
Remove sleep, replace with siftool's wait for balance change method f…
Nov 8, 2022
9cfc40c
Proper tenses for return string
Nov 8, 2022
ad71869
Merge branch 'master' into feature/bridge-pauser
Nov 8, 2022
b6d26a8
Add siftool return type hint
Nov 8, 2022
3669b6b
Merge master into future/peggy2
banshee Nov 8, 2022
fafd7cd
Update change pauser to pause, update proto, proto-generated file, an…
Nov 8, 2022
4beb1fd
Merge branch 'master' into ghuznee-patch-1
canercandan Nov 8, 2022
3cdd257
Merge branch 'master' into test/integration-test
canercandan Nov 8, 2022
296b9c2
Styling
Nov 8, 2022
400de8f
Merge pull request #3353 from Sifchain/ghuznee-patch-1
canercandan Nov 8, 2022
90ec422
fix: 🐛 support asym adds
canercandan Nov 8, 2022
4703c5f
Add unit test to encapsulate idempotency behavior
Nov 9, 2022
679086a
Add validatebasic impl to err on empty signer, add unit test to encap…
Nov 9, 2022
9419428
Rename test
Nov 9, 2022
831b9cc
Merge branch 'master' into feature/bridge-pauser
juniuszhou Nov 9, 2022
c5eb0e0
Cleanup
Nov 9, 2022
9b19d0d
Merge pull request #3370 from Sifchain/test/integration-test-asym-add
timlind Nov 9, 2022
39a8834
Merge branch 'master' into test/integration-test
timlind Nov 9, 2022
ccca98f
Use more precise method
Nov 9, 2022
2cf762c
Added comment
Nov 9, 2022
bdd2d0e
Add integration test to github action
Nov 9, 2022
aa57bc7
Add logging to debug int env issue
Nov 9, 2022
ee85e50
Revert "Add logging to debug int env issue"
Nov 9, 2022
087f66c
Revert "Add integration test to github action"
Nov 9, 2022
4401737
Merge pull request #2665 from Sifchain/feature/bridge-pauser
Brando753 Nov 9, 2022
9fa71a2
Merge branch 'master' into test/integration-test
canercandan Nov 9, 2022
0e448ff
Merge pull request #3304 from Sifchain/test/integration-test
timlind Nov 9, 2022
4f70ad4
chore: 🤖 increment version
canercandan Nov 9, 2022
a06133d
Merge pull request #3375 from Sifchain/chore/increment_version
canercandan Nov 9, 2022
a3a79e0
Merge branch 'master' into fix/clp-formulae
timlind Nov 11, 2022
482802e
update expected test values
timlind Nov 11, 2022
e3a5d02
Merge pull request #3301 from Sifchain/fix/clp-formulae
timlind Nov 11, 2022
4f358c6
Fix up go.mod and go.sum files after merge
banshee Nov 11, 2022
c66e7d1
Merge remote-tracking branch 'origin/master' into merge_master_peggy2
banshee Nov 21, 2022
cdf4569
Merge cleanup
banshee Nov 21, 2022
76127be
work in progress
banshee Nov 22, 2022
1716822
work in progress
banshee Nov 22, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ jobs:
run: sudo add-apt-repository -y ppa:ethereum/ethereum && sudo apt-get update && sudo apt-get install ethereum
- name: install golangcli-lint
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.47.3

- name: Get dependencies
run: |
go get -v -t -d ./...

- name: Build
run: make install
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ smart_contract_file=cmd/ebrelayer/contract/generated/artifacts/contracts/BridgeR
BUILD_TAGS ?= ${IMAGE_TAG}
BUILD_FLAGS := -ldflags '$(ldflags)' -tags "$(GOTAGS) ${BUILD_TAGS}"

BINARIES=./cmd/sifnoded ./cmd/sifgen ./cmd/ebrelayer
BINARIES=./cmd/sifnoded ./cmd/sifgen ./cmd/ebrelayer ./cmd/siftest

# You can regenerate proto_files with
# find . -name *.proto | sort | grep -v node_mo | grep -v test/integration | xargs echo
Expand Down
18 changes: 13 additions & 5 deletions app/ante/ante.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package ante

import (
clptypes "github.com/Sifchain/sifnode/x/clp/types"
"strings"

adminkeeper "github.com/Sifchain/sifnode/x/admin/keeper"
clptypes "github.com/Sifchain/sifnode/x/clp/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"

disptypes "github.com/Sifchain/sifnode/x/dispensation/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand All @@ -24,8 +26,8 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
sigGasConsumer = ante.DefaultSigVerificationGasConsumer
}
return sdk.ChainAnteDecorators(
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
NewAdjustGasPriceDecorator(), // Custom decorator to adjust gas price for specific msg types
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
NewAdjustGasPriceDecorator(options.AdminKeeper), // Custom decorator to adjust gas price for specific msg types
ante.NewRejectExtensionOptionsDecorator(),
ante.NewMempoolFeeDecorator(),
ante.NewValidateBasicDecorator(),
Expand All @@ -45,15 +47,19 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {

// AdjustGasPriceDecorator is a custom decorator to reduce fee prices .
type AdjustGasPriceDecorator struct {
adminKeeper adminkeeper.Keeper
}

// NewAdjustGasPriceDecorator create a new instance of AdjustGasPriceDecorator
func NewAdjustGasPriceDecorator() AdjustGasPriceDecorator {
return AdjustGasPriceDecorator{}
func NewAdjustGasPriceDecorator(adminKeeper adminkeeper.Keeper) AdjustGasPriceDecorator {
return AdjustGasPriceDecorator{adminKeeper: adminKeeper}
}

// AnteHandle adjusts the gas price based on the tx type.
func (r AdjustGasPriceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {
adminParams := r.adminKeeper.GetParams(ctx)
submitProposalFee := adminParams.SubmitProposalFee

msgs := tx.GetMsgs()
if len(msgs) == 1 && (strings.Contains(strings.ToLower(sdk.MsgTypeURL(msgs[0])), strings.ToLower(disptypes.MsgTypeCreateDistribution)) ||
strings.Contains(strings.ToLower(sdk.MsgTypeURL(msgs[0])), strings.ToLower(disptypes.MsgTypeRunDistribution))) {
Expand All @@ -80,6 +86,8 @@ func (r AdjustGasPriceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate
minFee = sdk.NewInt(100000000000000000) // 0.1
} else if strings.Contains(msgTypeURLLower, "transfer") && minFee.LTE(sdk.NewInt(10000000000000000)) {
minFee = sdk.NewInt(10000000000000000) // 0.01
} else if strings.Contains(msgTypeURLLower, "submitproposal") || strings.Contains(msgTypeURLLower, govtypes.TypeMsgSubmitProposal) {
minFee = sdk.NewIntFromBigInt(submitProposalFee.BigInt())
}
}
if minFee.Equal(sdk.ZeroInt()) {
Expand Down
4 changes: 2 additions & 2 deletions app/ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestAdjustGasPriceDecorator_AnteHandle(t *testing.T) {
app.AccountKeeper.SetParams(ctx, authtypes.DefaultParams())
initTokens := sdk.TokensFromConsensusPower(1000, sdk.DefaultPowerReduction)
addrs := sifapp.AddTestAddrs(app, ctx, 6, initTokens)
decorator := ante.AdjustGasPriceDecorator{}
decorator := ante.NewAdjustGasPriceDecorator(app.AdminKeeper)
highGasPrice := sdk.DecCoin{
Denom: "rowan",
Amount: sdk.MustNewDecFromStr("0.5"),
Expand Down Expand Up @@ -76,7 +76,7 @@ func TestAdjustGasPriceDecorator_AnteHandle_MinFee(t *testing.T) {
app.AccountKeeper.SetParams(ctx, authtypes.DefaultParams())
initTokens := sdk.TokensFromConsensusPower(1000, sdk.DefaultPowerReduction)
addrs := sifapp.AddTestAddrs(app, ctx, 6, initTokens)
decorator := ante.AdjustGasPriceDecorator{}
decorator := ante.NewAdjustGasPriceDecorator(app.AdminKeeper)
highFee := sdk.NewCoins(sdk.NewCoin("rowan", sdk.NewInt(100000000000000000))) // 0.1
lowFee := sdk.NewCoins(sdk.NewCoin("rowan", sdk.NewInt(10000000000000000))) // 0.01

Expand Down
2 changes: 2 additions & 0 deletions app/ante/handler_options.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ante

import (
adminkeeper "github.com/Sifchain/sifnode/x/admin/keeper"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
Expand All @@ -13,6 +14,7 @@ import (
// HandlerOptions defines the list of module keepers required to run the Sifnode
// AnteHandler decorators.
type HandlerOptions struct {
AdminKeeper adminkeeper.Keeper
AccountKeeper ante.AccountKeeper
BankKeeper bankkeeper.Keeper
FeegrantKeeper ante.FeegrantKeeper
Expand Down
1 change: 1 addition & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,7 @@ func NewSifAppWithBlacklist(
app.MountMemoryStores(memKeys)
anteHandler, err := sifchainAnte.NewAnteHandler(
sifchainAnte.HandlerOptions{
AdminKeeper: app.AdminKeeper,
AccountKeeper: app.AccountKeeper,
BankKeeper: app.BankKeeper,
StakingKeeper: app.StakingKeeper,
Expand Down
6 changes: 3 additions & 3 deletions app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func TestAppUpgrade_CannotDeleteLatestVersion(t *testing.T) {
encCfg,
EmptyAppOptions{},
func(app *baseapp.BaseApp) {
cms := rootmulti.NewStore(db)
cms := rootmulti.NewStore(db, app.Logger())
cms.SetPruning(storetypes.PruneDefault)
app.SetCMS(cms)
},
Expand Down Expand Up @@ -156,7 +156,7 @@ func TestAppUpgrade_CannotLoadCorruptStoreUsingLatestHeight(t *testing.T) {
encCfg,
EmptyAppOptions{},
func(app *baseapp.BaseApp) {
cms := rootmulti.NewStore(db)
cms := rootmulti.NewStore(db, app.Logger())
cms.SetPruning(storetypes.PruneDefault)
app.SetCMS(cms)
},
Expand Down Expand Up @@ -190,7 +190,7 @@ func TestAppUpgrade_CannotLoadCorruptStoreUsingLatestHeight(t *testing.T) {
encCfg,
EmptyAppOptions{},
func(app *baseapp.BaseApp) {
cms := rootmulti.NewStore(db)
cms := rootmulti.NewStore(db, app.Logger())
cms.SetPruning(storetypes.PruneDefault)
app.SetCMS(cms)
},
Expand Down
8 changes: 7 additions & 1 deletion app/setup_handlers.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
package app

import (
admintypes "github.com/Sifchain/sifnode/x/admin/types"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
m "github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

const releaseVersion = "1.0-beta.13"
const releaseVersion = "1.1.0-beta.rc1"

func SetupHandlers(app *SifchainApp) {
app.UpgradeKeeper.SetUpgradeHandler(releaseVersion, func(ctx sdk.Context, plan types.Plan, vm m.VersionMap) (m.VersionMap, error) {
app.Logger().Info("Running upgrade handler for " + releaseVersion)

app.AdminKeeper.SetParams(ctx, &admintypes.Params{
SubmitProposalFee: sdk.NewUintFromString("5000000000000000000000"),
})

return app.mm.RunMigrations(ctx, app.configurator, vm)
})

Expand Down
146 changes: 146 additions & 0 deletions cmd/siftest/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
package main

import (
"fmt"
"os"

"github.com/Sifchain/sifnode/app"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/config"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/server"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)

func main() {
encodingConfig := app.MakeTestEncodingConfig()
initClientCtx := client.Context{}.
WithCodec(encodingConfig.Marshaler).
WithInterfaceRegistry(encodingConfig.InterfaceRegistry).
WithTxConfig(encodingConfig.TxConfig).
WithLegacyAmino(encodingConfig.Amino).
WithInput(os.Stdin).
WithAccountRetriever(authtypes.AccountRetriever{}).
WithBroadcastMode(flags.BroadcastBlock).
WithHomeDir(app.DefaultNodeHome).
WithViper("")
app.SetConfig(false)

rootCmd := &cobra.Command{
Use: "siftest",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
initClientCtx, err := client.ReadPersistentCommandFlags(initClientCtx, cmd.Flags())
if err != nil {
return err
}
initClientCtx, err = config.ReadFromClientConfig(initClientCtx)
if err != nil {
return err
}
if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil {
return err
}
return server.InterceptConfigsPreRunHandler(cmd, "", nil)
},
//RunE: run,
}

rootCmd.AddCommand(GetVerifyCmd(), GetTestCmd())

err := svrcmd.Execute(rootCmd, app.DefaultNodeHome)
if err != nil {
panic(err)
}
}

func GetTestCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "test",
Short: "Run tests",
RunE: runTest,
}
flags.AddTxFlagsToCmd(cmd)
cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID")
return cmd
}

func GetVerifyCmd() *cobra.Command {
verifyCmd := &cobra.Command{
Use: "verify",
Short: "Verify transaction results",
}

verifyCmd.AddCommand(GetVerifyRemove(), GetVerifyAdd(), GetVerifyOpen(), GetVerifyClose())

return verifyCmd
}

/* VerifySwap verifies amounts sent and received from wallet address.
*/
func VerifySwap(clientCtx client.Context, key keyring.Info) {

}

func GetVerifyOpen() *cobra.Command {
cmd := &cobra.Command{
Use: "open-position --height --from --collateralAmount --leverage --collateral-asset --borrow-asset",
Short: "Verify a margin long position open",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Printf("verifying open...\n")
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}

collateralAmount := sdk.NewUintFromString(viper.GetString("collateralAmount"))
leverageDec, err := sdk.NewDecFromStr(viper.GetString("leverage"))
if err != nil {
panic(err)
}

err = VerifyOpenLong(clientCtx,
viper.GetString("from"),
int64(viper.GetUint64("height")),
collateralAmount,
viper.GetString("collateral-asset"),
viper.GetString("borrow-asset"),
leverageDec)
if err != nil {
panic(err)
}

return nil
},
}

flags.AddQueryFlagsToCmd(cmd)
//cmd.Flags().Uint64("height", 0, "height of transaction")
cmd.Flags().String("from", "", "address of transactor")
cmd.Flags().String("collateralAmount", "0", "collateral provided")
cmd.Flags().String("leverage", "0", "leverage")
cmd.Flags().String("collateral-asset", "", "collateral asset")
cmd.Flags().String("borrow-asset", "", "borrow asset")
_ = cmd.MarkFlagRequired("from")
_ = cmd.MarkFlagRequired("collateralAmount")
_ = cmd.MarkFlagRequired("leverage")
_ = cmd.MarkFlagRequired("collateral-asset")
_ = cmd.MarkFlagRequired("height")
return cmd
}

func VerifyOpenLong(clientCtx client.Context,
from string,
height int64,
collateralAmount sdk.Uint,
collateralAsset,
borrowAsset string,
leverage sdk.Dec) error {

return nil
}
Loading