diff --git a/__local/test/test_data.mk b/__local/test/test_data.mk index 8fc72507..a53a5529 100644 --- a/__local/test/test_data.mk +++ b/__local/test/test_data.mk @@ -32,11 +32,9 @@ ROOT_DIR:=$(shell dirname $(MAKEFILE))/../../ .PHONY: deploy-test-tokens deploy-test-tokens: deploy-foo deploy-bar deploy-baz deploy-qux deploy-obl -.PHONY: deploy-packages -deploy-packages: deploy-uint256 deploy-int256 deploy-package-pool -.PHONY: deploy-common-realms -deploy-common-realms: deploy-consts deploy-common +.PHONY: deploy-libraries +deploy-libraries: deploy-uint256 deploy-int256 deploy-consts deploy-common deploy-package-pool .PHONY: deploy-base-tokens deploy-base-tokens: deploy-gns deploy-gnft @@ -75,7 +73,7 @@ unstake-token: unstake-token-1-5 unstake-token-6 # unstake-token-7 unstake-toke burn-position: burn-position-1 burn-position-2 burn-position-6 # burn-position-7 .PHONY: all -all: wait send-ugnot deploy-test-tokens deploy-packages deploy-common-realms deploy-base-tokens deploy-gnoswap-realms register-token faucet-test-accounts approve-gsa pool-create mint create-external-incentive stake-token set-protocol-fee swap collect-fee unstake-token burn-position +all: wait send-ugnot deploy-test-tokens deploy-libraries deploy-base-tokens deploy-gnoswap-realms register-token faucet-test-accounts approve-gsa pool-create mint create-external-incentive stake-token set-protocol-fee swap collect-fee unstake-token burn-position wait: @@ -194,69 +192,69 @@ register-token: # FAUCET faucet-lp01: $(info ************ facuet lp01 ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/foo -func Faucet -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/bar -func Faucet -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/baz -func Faucet -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/qux -func Faucet -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/foo -func Faucet -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/bar -func Faucet -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/baz -func Faucet -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/qux -func Faucet -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null @echo faucet-lp02: $(info ************ facuet lp02 ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/foo -func Faucet -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp02 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/bar -func Faucet -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp02 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/baz -func Faucet -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp02 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/qux -func Faucet -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp02 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/foo -func Faucet -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp02 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/bar -func Faucet -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp02 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/baz -func Faucet -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp02 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/qux -func Faucet -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp02 > /dev/null @echo faucet-tr01: $(info ************ facuet tr01 ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/foo -func Faucet -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_tr01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/bar -func Faucet -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_tr01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/baz -func Faucet -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_tr01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/qux -func Faucet -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_tr01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/foo -func Faucet -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_tr01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/bar -func Faucet -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_tr01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/baz -func Faucet -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_tr01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/qux -func Faucet -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_tr01 > /dev/null @echo approve-gsa: $(info ************ approve gsa ************) # approve pool creation fee ( to pool ) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gns -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gns -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null @echo pool-create-bar-baz: $(info ************ create pool bar:baz ************) # tick -10 ≈ x0.99900054978007157835406815138412639498710632324219 - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/pool -func CreatePool -args "gno.land/r/demo/bar" -args "gno.land/r/demo/baz" -args 100 -args 79188560314459151373725315960 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/pool -func CreatePool -args "gno.land/r/demo/bar" -args "gno.land/r/demo/baz" -args 100 -args 79188560314459151373725315960 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null # tick +10 ≈ x1.00100045012002092370551054045790806412696838378906 - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/pool -func CreatePool -args "gno.land/r/demo/bar" -args "gno.land/r/demo/baz" -args 500 -args 79267784519130042428790663799 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/pool -func CreatePool -args "gno.land/r/demo/bar" -args "gno.land/r/demo/baz" -args 500 -args 79267784519130042428790663799 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null # tick 46055 ≈ x100.00995593181238518809550441801548004150390625000000 - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/pool -func CreatePool -args "gno.land/r/demo/bar" -args "gno.land/r/demo/baz" -args 3000 -args 792321063670230269303669868814 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/pool -func CreatePool -args "gno.land/r/demo/bar" -args "gno.land/r/demo/baz" -args 3000 -args 792321063670230269303669868814 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null @echo pool-create-baz-qux: $(info ************ create pool baz:qux ************) # tick 23028 ≈ x10.00099779659037757539863378042355179786682128906250 - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/pool -func CreatePool -args "gno.land/r/demo/baz" -args "gno.land/r/demo/qux" -args 500 -args 250553947533412109193337304115 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/pool -func CreatePool -args "gno.land/r/demo/baz" -args "gno.land/r/demo/qux" -args 500 -args 250553947533412109193337304115 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null @echo pool-create-qux-foo: $(info ************ create pool qux:foo ************) # tick 6932 ≈ x2.00003632383094753777186269871890544891357421875000 - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/pool -func CreatePool -args "gno.land/r/demo/qux" -args "gno.land/r/demo/foo" -args 500 -args 112046559425783515914356180039 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/pool -func CreatePool -args "gno.land/r/demo/qux" -args "gno.land/r/demo/foo" -args 500 -args 112046559425783515914356180039 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null @echo pool-create-foo-gns: $(info ************ create pool foo:gns ************) # tick 6932 ≈ x2.00003632383094753777186269871890544891357421875000 - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/pool -func CreatePool -args "gno.land/r/demo/foo" -args "gno.land/r/demo/gns" -args 500 -args 112046559425783515914356180039 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/pool -func CreatePool -args "gno.land/r/demo/foo" -args "gno.land/r/demo/gns" -args 500 -args 112046559425783515914356180039 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null @echo pool-create-gns-wugnot: $(info ************ create pool gns:wugnot ************) # tick 0 = x1 - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/pool -func CreatePool -args "gno.land/r/demo/gns" -args "gno.land/r/demo/wugnot" -args 500 -args 79228162514264337593543950337 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/pool -func CreatePool -args "gno.land/r/demo/gns" -args "gnot" -args 100 -args 79228162514264337593543950337 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/pool -func CreatePool -args "gno.land/r/demo/gns" -args "gno.land/r/demo/wugnot" -args 500 -args 79228162514264337593543950337 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/pool -func CreatePool -args "gno.land/r/demo/gns" -args "gnot" -args 100 -args 79228162514264337593543950337 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null @echo @@ -264,18 +262,18 @@ mint-bar-baz: $(info ************ mint positions(1~5) to bar:baz // gnoswap_lp01 ************) # APPROVE FISRT - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/bar -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/baz -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/bar -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/baz -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null @echo # THEN MINT - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func Mint -args "gno.land/r/demo/bar" -args "gno.land/r/demo/baz" -args 100 -args "-20" -args 0 -args 20000000 -args 20000000 -args 0 -args 0 -args $(TX_EXPIRE) -args $(ADDR_LP01) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func Mint -args "gno.land/r/demo/bar" -args "gno.land/r/demo/baz" -args 100 -args 0 -args 10 -args 20000000 -args 20000000 -args 0 -args 0 -args $(TX_EXPIRE) -args $(ADDR_LP01) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func Mint -args "gno.land/r/demo/bar" -args "gno.land/r/demo/baz" -args 100 -args "-30" -args "-20" -args 20000000 -args 20000000 -args 0 -args 0 -args $(TX_EXPIRE) -args $(ADDR_LP01) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func Mint -args "gno.land/r/demo/bar" -args "gno.land/r/demo/baz" -args 100 -args "-20" -args 0 -args 20000000 -args 20000000 -args 0 -args 0 -args $(TX_EXPIRE) -args $(ADDR_LP01) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func Mint -args "gno.land/r/demo/bar" -args "gno.land/r/demo/baz" -args 100 -args 0 -args 10 -args 20000000 -args 20000000 -args 0 -args 0 -args $(TX_EXPIRE) -args $(ADDR_LP01) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func Mint -args "gno.land/r/demo/bar" -args "gno.land/r/demo/baz" -args 100 -args "-30" -args "-20" -args 20000000 -args 20000000 -args 0 -args 0 -args $(TX_EXPIRE) -args $(ADDR_LP01) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func Mint -args "gno.land/r/demo/bar" -args "gno.land/r/demo/baz" -args 500 -args 0 -args 20 -args 20000000 -args 20000000 -args 0 -args 0 -args $(TX_EXPIRE) -args $(ADDR_LP01) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func Mint -args "gno.land/r/demo/bar" -args "gno.land/r/demo/baz" -args 500 -args 0 -args 20 -args 20000000 -args 20000000 -args 0 -args 0 -args $(TX_EXPIRE) -args $(ADDR_LP01) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func Mint -args "gno.land/r/demo/bar" -args "gno.land/r/demo/baz" -args 3000 -args 36060 -args 56040 -args 100 -args 100 -args 0 -args 0 -args $(TX_EXPIRE) -args $(ADDR_LP01) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func Mint -args "gno.land/r/demo/bar" -args "gno.land/r/demo/baz" -args 3000 -args 36060 -args 56040 -args 100 -args 100 -args 0 -args 0 -args $(TX_EXPIRE) -args $(ADDR_LP01) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null @echo @@ -283,12 +281,12 @@ mint-baz-qux: $(info ************ mint position(6) to baz:qux // gnoswap_lp02 ************) # APPROVE FISRT - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/baz -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp02 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/qux -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp02 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/baz -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp02 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/qux -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp02 > /dev/null @echo # THEN MINT - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func Mint -args "gno.land/r/demo/baz" -args "gno.land/r/demo/qux" -args 500 -args 13030 -args 33030 -args 20000000 -args 20000000 -args 0 -args 0 -args $(TX_EXPIRE) -args $(ADDR_LP02) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp02 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func Mint -args "gno.land/r/demo/baz" -args "gno.land/r/demo/qux" -args 500 -args 13030 -args 33030 -args 20000000 -args 20000000 -args 0 -args 0 -args $(TX_EXPIRE) -args $(ADDR_LP02) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp02 > /dev/null @echo @@ -296,41 +294,41 @@ mint-qux-foo: $(info ************ mint position(7) to qux:foo // gnoswap_lp01 ************) # APPROVE FISRT - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/qux -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/foo -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/qux -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/foo -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null @echo # THEN MINT - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func Mint -args "gno.land/r/demo/qux" -args "gno.land/r/demo/foo" -args 500 -args 5930 -args 7930 -args 20000000 -args 20000000 -args 0 -args 0 -args $(TX_EXPIRE) -args $(ADDR_LP01) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func Mint -args "gno.land/r/demo/qux" -args "gno.land/r/demo/foo" -args 500 -args 5930 -args 7930 -args 20000000 -args 20000000 -args 0 -args 0 -args $(TX_EXPIRE) -args $(ADDR_LP01) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null @echo mint-foo-gns: $(info ************ mint position(8) to foo:gns // gnoswap_admin ************) # APPROVE FISRT - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/foo -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gns -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/foo -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gns -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null @echo # THEN MINT - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func Mint -args "gno.land/r/demo/foo" -args "gno.land/r/demo/gns" -args 500 -args 5930 -args 7930 -args 20000000 -args 20000000 -args 1 -args 1 -args $(TX_EXPIRE) -args $(ADDR_GSA) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func Mint -args "gno.land/r/demo/foo" -args "gno.land/r/demo/gns" -args 500 -args "-887270" -args "887270" -args 20000000 -args 20000000 -args 1 -args 1 -args $(TX_EXPIRE) -args $(ADDR_GSA) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null @echo mint-gns-gnot: $(info ************ mint position(9~10) to gns:wugnot // gnoswap_admin ************) # APPROVE FISRT - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gns -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/wugnot -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gns -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/wugnot -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null @echo # APPROVE WUGNOT TO POSITION, to get refund wugnot left after wrap -> mint - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/wugnot -func Approve -args $(ADDR_POSITION) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/wugnot -func Approve -args $(ADDR_POSITION) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null # THEN MINT - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func Mint -send "20000000ugnot" -args "gno.land/r/demo/gns" -args "gnot" -args 500 -args "-50000" -args "50000" -args 20000000 -args 20000000 -args 1 -args 1 -args $(TX_EXPIRE) -args $(ADDR_GSA) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func Mint -send "20000000ugnot" -args "gno.land/r/demo/gns" -args "gnot" -args 100 -args "-50000" -args "50000" -args 20000000 -args 20000000 -args 1 -args 1 -args $(TX_EXPIRE) -args $(ADDR_GSA) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func Mint -send "20000000ugnot" -args "gno.land/r/demo/gns" -args "gnot" -args 500 -args "-50000" -args "50000" -args 20000000 -args 20000000 -args 1 -args 1 -args $(TX_EXPIRE) -args $(ADDR_GSA) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func Mint -send "20000000ugnot" -args "gno.land/r/demo/gns" -args "gnot" -args 100 -args "-50000" -args "50000" -args 20000000 -args 20000000 -args 1 -args 1 -args $(TX_EXPIRE) -args $(ADDR_GSA) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null @echo increase-liquidity-position-01: @@ -351,72 +349,72 @@ create-external-incentive: @echo # THEN CREATE EXTERNAL INCENTIVE - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func CreateExternalIncentive -args "gno.land/r/demo/foo:gno.land/r/demo/gns:500" -args "gno.land/r/demo/obl" -args 100000000000000 -args $(TOMORROW_MIDNIGHT) -args $(INCENTIVE_END) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func CreateExternalIncentive -args "gno.land/r/demo/foo:gno.land/r/demo/gns:500" -args "gno.land/r/demo/obl" -args 100000000000000 -args $(TOMORROW_MIDNIGHT) -args $(INCENTIVE_END) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null @echo stake-token-1-5: $(info ************ stake token 1~5 // gnoswap_lp01 ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gnft -func Approve -args $(ADDR_STAKER) -args 1 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func StakeToken -args 1 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gnft -func Approve -args $(ADDR_STAKER) -args 1 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func StakeToken -args 1 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gnft -func Approve -args $(ADDR_STAKER) -args 2 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func StakeToken -args 2 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gnft -func Approve -args $(ADDR_STAKER) -args 2 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func StakeToken -args 2 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gnft -func Approve -args $(ADDR_STAKER) -args 3 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func StakeToken -args 3 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gnft -func Approve -args $(ADDR_STAKER) -args 3 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func StakeToken -args 3 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gnft -func Approve -args $(ADDR_STAKER) -args 4 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func StakeToken -args 4 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gnft -func Approve -args $(ADDR_STAKER) -args 4 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func StakeToken -args 4 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gnft -func Approve -args $(ADDR_STAKER) -args 5 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func StakeToken -args 5 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gnft -func Approve -args $(ADDR_STAKER) -args 5 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func StakeToken -args 5 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null @echo stake-token-6: $(info ************ stake token 6 // gnoswap_lp02 ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gnft -func Approve -args $(ADDR_STAKER) -args 6 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp02 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func StakeToken -args 6 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp02 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gnft -func Approve -args $(ADDR_STAKER) -args 6 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp02 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func StakeToken -args 6 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp02 > /dev/null @echo stake-token-7: $(info ************ stake token 7 // gnoswap_lp01 ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gnft -func Approve -args $(ADDR_STAKER) -args 7 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func StakeToken -args 7 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gnft -func Approve -args $(ADDR_STAKER) -args 7 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func StakeToken -args 7 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null @echo stake-token-8: $(info ************ stake token 8 // gnoswap_admin ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gnft -func Approve -args $(ADDR_STAKER) -args 8 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func StakeToken -args 8 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gnft -func Approve -args $(ADDR_STAKER) -args 8 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func StakeToken -args 8 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null @echo stake-token-9: $(info ************ stake token 9 // gnoswap_admin ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gnft -func Approve -args $(ADDR_STAKER) -args 9 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func StakeToken -args 9 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gnft -func Approve -args $(ADDR_STAKER) -args 9 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func StakeToken -args 9 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null @echo stake-token-10: $(info ************ stake token 10 // gnoswap_admin ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gnft -func Approve -args $(ADDR_STAKER) -args 10 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func StakeToken -args 10 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gnft -func Approve -args $(ADDR_STAKER) -args 10 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func StakeToken -args 10 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null @echo mint-and-stake: $(info ************ mint and stake(11), to same position with lpTokenId 1 // gnoswap_lp02 ************) # APPROVE FISRT - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/bar -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp02 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/baz -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp02 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/bar -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp02 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/baz -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp02 > /dev/null @echo - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func MintAndStake -args "gno.land/r/demo/bar" -args "gno.land/r/demo/baz" -args 100 -args "-200" -args "190" -args 50000000 -args 50000000 -args 0 -args 0 -args $(TX_EXPIRE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp02 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func MintAndStake -args "gno.land/r/demo/bar" -args "gno.land/r/demo/baz" -args 100 -args "-200" -args "190" -args 50000000 -args 50000000 -args 0 -args 0 -args $(TX_EXPIRE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp02 > /dev/null @echo set-protocol-fee: $(info ************ set (pool) protocol fee // gnoswap_admin ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/pool -func SetFeeProtocol -args 6 -args 8 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/pool -func SetFeeProtocol -args 6 -args 8 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null @echo swap-exact-in-single-bar-to-baz: @@ -425,12 +423,12 @@ swap-exact-in-single-bar-to-baz: $(info ************ swap bar -> baz, exact_in // gnoswap_tr01 ************) # approve INPUT TOKEN to POOL - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/bar -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_tr01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/bar -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_tr01 > /dev/null # approve OUTPUT TOKEN to ROUTER ( as 0.15% fee ) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/baz -func Approve -args $(ADDR_ROUTER) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_tr01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/baz -func Approve -args $(ADDR_ROUTER) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_tr01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/router -func SwapRoute -args "gno.land/r/demo/bar" -args "gno.land/r/demo/baz" -args 50000 -args "EXACT_IN" -args "gno.land/r/demo/bar:gno.land/r/demo/baz:100" -args "100" -args "1" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_tr01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/router -func SwapRoute -args "gno.land/r/demo/bar" -args "gno.land/r/demo/baz" -args 50000 -args "EXACT_IN" -args "gno.land/r/demo/bar:gno.land/r/demo/baz:100" -args "100" -args "1" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_tr01 > /dev/null @echo @$(MAKE) -f $(MAKEFILE) print-fee-collector @@ -440,34 +438,34 @@ swap-exact-in-single-baz-to-bar: $(info ************ swap baz -> bar, exact_in // gnoswap_tr01 ************) # approve INPUT TOKEN to POOL - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/baz -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_tr01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/baz -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_tr01 > /dev/null # approve OUTPUT TOKEN to ROUTER ( as 0.15% fee ) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/bar -func Approve -args $(ADDR_ROUTER) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_tr01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/bar -func Approve -args $(ADDR_ROUTER) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_tr01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/router -func SwapRoute -args "gno.land/r/demo/baz" -args "gno.land/r/demo/bar" -args 50000 -args "EXACT_IN" -args "gno.land/r/demo/baz:gno.land/r/demo/bar:100" -args "100" -args "1" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_tr01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/router -func SwapRoute -args "gno.land/r/demo/baz" -args "gno.land/r/demo/bar" -args 50000 -args "EXACT_IN" -args "gno.land/r/demo/baz:gno.land/r/demo/bar:100" -args "100" -args "1" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_tr01 > /dev/null @echo swap-exact-in-single-foo-to-gns: $(info ************ swap foo -> gns, exact_in // gnoswap_tr01 ************) # approve INPUT TOKEN to POOL - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/foo -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_tr01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/foo -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_tr01 > /dev/null # approve OUTPUT TOKEN to ROUTER ( as 0.15% fee ) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gns -func Approve -args $(ADDR_ROUTER) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_tr01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gns -func Approve -args $(ADDR_ROUTER) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_tr01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/router -func SwapRoute -args "gno.land/r/demo/foo" -args "gno.land/r/demo/gns" -args 50000 -args "EXACT_IN" -args "gno.land/r/demo/foo:gno.land/r/demo/gns:500" -args "100" -args "1" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_tr01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/router -func SwapRoute -args "gno.land/r/demo/foo" -args "gno.land/r/demo/gns" -args 50000 -args "EXACT_IN" -args "gno.land/r/demo/foo:gno.land/r/demo/gns:500" -args "100" -args "1" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_tr01 > /dev/null @echo swap-exact-out-single-foo-to-gns: $(info ************ swap foo -> gns, exact_out // gnoswap_tr01 ************) # approve INPUT TOKEN to POOL - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/foo -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_tr01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/foo -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_tr01 > /dev/null # approve OUTPUT TOKEN to ROUTER ( as 0.15% fee ) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gns -func Approve -args $(ADDR_ROUTER) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_tr01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/gns -func Approve -args $(ADDR_ROUTER) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_tr01 > /dev/null @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/router -func SwapRoute -args "gno.land/r/demo/foo" -args "gno.land/r/demo/gns" -args 50000 -args "EXACT_OUT" -args "gno.land/r/demo/foo:gno.land/r/demo/gns:500" -args "100" -args "50000" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100ugnot -gas-wanted 10000000 -memo "" gnoswap_tr01 > /dev/null @echo @@ -478,11 +476,12 @@ swap-exact-in-multi-foo-to-gns-to-wugnot: $(info ************ swap foo -> gns -> wugnot, exact_in // gnoswap_tr01 ************) # approve INPUT TOKEN to POOL - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/foo -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_tr01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/foo -func Approve -args $(ADDR_POOL) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_tr01 > /dev/null # approve OUTPUT TOKEN to ROUTER ( as 0.15% fee ) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/wugnot -func Approve -args $(ADDR_ROUTER) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_tr01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/wugnot -func Approve -args $(ADDR_ROUTER) -args $(MAX_UINT64) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_tr01 > /dev/null + # MORE_GAS @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/router -func SwapRoute -args "gno.land/r/demo/foo" -args "gno.land/r/demo/wugnot" -args 50000 -args "EXACT_IN" -args "gno.land/r/demo/foo:gno.land/r/demo/gns:500*POOL*gno.land/r/demo/gns:gno.land/r/demo/wugnot:500" -args "100" -args "1" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 20000000 -memo "" gnoswap_tr01 > /dev/null @echo @@ -529,61 +528,64 @@ collect-fee-position-11: unstake-token-1-5: $(info ************ unstake token 1~5 // gnoswap_lp01 ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func UnstakeToken -args 1 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func UnstakeToken -args 2 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func UnstakeToken -args 3 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func UnstakeToken -args 4 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func UnstakeToken -args 5 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func UnstakeToken -args 1 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func UnstakeToken -args 2 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func UnstakeToken -args 3 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func UnstakeToken -args 4 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func UnstakeToken -args 5 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null @echo unstake-token-6: $(info ************ unstake token 6 // gnoswap_lp02 ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func UnstakeToken -args 6 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp02 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func UnstakeToken -args 6 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp02 > /dev/null @echo unstake-token-7: $(info ************ unstake token 7 // gnoswap_lp01 ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func UnstakeToken -args 7 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func UnstakeToken -args 7 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp01 > /dev/null @echo unstake-token-8: $(info ************ unstake token 8 // gnoswap_admin ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func UnstakeToken -args 8 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func UnstakeToken -args 8 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null @echo unstake-token-9: $(info ************ unstake token 9 // gnoswap_admin ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func UnstakeToken -args 9 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func UnstakeToken -args 9 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null @echo unstake-token-10: $(info ************ unstake token 10 // gnoswap_admin ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func UnstakeToken -args 10 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func UnstakeToken -args 10 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null @echo unstake-token-11: $(info ************ unstake token 11 // gnoswap_lp02 ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func UnstakeToken -args 11 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_lp02 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func UnstakeToken -args 11 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_lp02 > /dev/null @echo + +# BURN REQUIRES 12000000 +# MORE_GAS burn-position-1: $(info ************ decrease entire liquidity(==burn) from position 1 // gnoswap_lp01 ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func DecreaseLiquidity -args 1 -args 100 -args 0 -args 0 -args $(TX_EXPIRE) -args "false" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 20000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func DecreaseLiquidity -args 1 -args 100 -args 0 -args 0 -args $(TX_EXPIRE) -args "false" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 12000000 -memo "" gnoswap_lp01 > /dev/null @echo burn-position-2: $(info ************ decrease entire liquidity(==burn) from position 2 // gnoswap_lp01 ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func DecreaseLiquidity -args 2 -args 100 -args 0 -args 0 -args $(TX_EXPIRE) -args "false" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 20000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func DecreaseLiquidity -args 2 -args 100 -args 0 -args 0 -args $(TX_EXPIRE) -args "false" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 12000000 -memo "" gnoswap_lp01 > /dev/null @echo burn-position-6: $(info ************ decrease entire liquidity(==burn) from position 6 // gnoswap_lp02 ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func DecreaseLiquidity -args 6 -args 100 -args 0 -args 0 -args $(TX_EXPIRE) -args "false" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 20000000 -memo "" gnoswap_lp02 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func DecreaseLiquidity -args 6 -args 100 -args 0 -args 0 -args $(TX_EXPIRE) -args "false" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 12000000 -memo "" gnoswap_lp02 > /dev/null @echo burn-position-7: $(info ************ decrease entire liquidity(==burn) from position 7 // gnoswap_lp01 ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func DecreaseLiquidity -args 7 -args 100 -args 0 -args 0 -args $(TX_EXPIRE) -args "false" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 20000000 -memo "" gnoswap_lp01 > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/position -func DecreaseLiquidity -args 7 -args 100 -args 0 -args 0 -args $(TX_EXPIRE) -args "false" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 12000000 -memo "" gnoswap_lp01 > /dev/null @echo print-fee-collector: diff --git a/_deploy/p/demo/gnoswap/uint256/gs_overflow_calculation_test.gno b/_deploy/p/demo/gnoswap/uint256/gs_overflow_calculation_test.gno deleted file mode 100644 index 6c3dfd0e..00000000 --- a/_deploy/p/demo/gnoswap/uint256/gs_overflow_calculation_test.gno +++ /dev/null @@ -1,25 +0,0 @@ -package uint256 - -import "testing" - -func TestMulDiv(t *testing.T) { - a := MustFromDecimal("3961170441225674086664416884948992") - b := MustFromDecimal("1461300573427867316490840528175048480732148624513") - c := MustFromDecimal("1461300573427867316570072651998408279850435624081") - - z := MulDiv(a, b, c) - if z.ToString() != "3961170441225674086449641121090634" { - t.Errorf("expected 3961170441225674086449641121090634, got %s", z.ToString()) - } -} - -func TestMulDivRoundingUp(t *testing.T) { - a := MustFromDecimal("3961170441225674086664416884948992") - b := MustFromDecimal("1461300573427867316490840528175048480732148624513") - c := MustFromDecimal("1461300573427867316570072651998408279850435624081") - - z := MulDivRoundingUp(a, b, c) - if z.ToString() != "3961170441225674086449641121090635" { - t.Errorf("expected 3961170441225674086449641121090635, got %s", z.ToString()) - } -} diff --git a/pool/_TEST_/_TEST_0_INIT_FAUCET_test.gno b/pool/_TEST_/_TEST_0_INIT_FAUCET_test.gno new file mode 100644 index 00000000..354c35ce --- /dev/null +++ b/pool/_TEST_/_TEST_0_INIT_FAUCET_test.gno @@ -0,0 +1,25 @@ +package pool + +import ( + "std" + + "gno.land/r/demo/bar" + "gno.land/r/demo/baz" + "gno.land/r/demo/foo" + "gno.land/r/demo/obl" + "gno.land/r/demo/qux" +) + +func init() { + std.TestSetPrevAddr(test1) + + // GIVE 100_000_000_000(u) ≈ 100_000 + for i := 0; i < 100; i++ { + foo.Faucet() + bar.Faucet() + baz.Faucet() + qux.Faucet() + obl.Faucet() + //gns.Faucet() + } +} diff --git a/pool/_TEST_/_TEST_0_INIT_TOKEN_REGISTER_test.gno b/pool/_TEST_/_TEST_0_INIT_TOKEN_REGISTER_test.gno new file mode 100644 index 00000000..3b7b6068 --- /dev/null +++ b/pool/_TEST_/_TEST_0_INIT_TOKEN_REGISTER_test.gno @@ -0,0 +1,178 @@ +package pool + +import ( + "std" + "testing" + + "gno.land/p/demo/testutils" + + "gno.land/r/demo/foo" + + "gno.land/r/demo/bar" + + "gno.land/r/demo/baz" + + "gno.land/r/demo/qux" + + "gno.land/r/demo/wugnot" + + "gno.land/r/demo/obl" + + "gno.land/r/demo/gns" + + "gno.land/r/demo/gnoswap/consts" + + pusers "gno.land/p/demo/users" +) + +type FooToken struct{} + +func (FooToken) Transfer() func(to pusers.AddressOrName, amount uint64) { + return foo.Transfer +} +func (FooToken) TransferFrom() func(from, to pusers.AddressOrName, amount uint64) { + return foo.TransferFrom +} +func (FooToken) BalanceOf() func(owner pusers.AddressOrName) uint64 { + return foo.BalanceOf +} +func (FooToken) Approve() func(spender pusers.AddressOrName, amount uint64) { + return foo.Approve +} + +type BarToken struct{} + +func (BarToken) Transfer() func(to pusers.AddressOrName, amount uint64) { + return bar.Transfer +} +func (BarToken) TransferFrom() func(from, to pusers.AddressOrName, amount uint64) { + return bar.TransferFrom +} +func (BarToken) BalanceOf() func(owner pusers.AddressOrName) uint64 { + return bar.BalanceOf +} +func (BarToken) Approve() func(spender pusers.AddressOrName, amount uint64) { + return bar.Approve +} + +type BazToken struct{} + +func (BazToken) Transfer() func(to pusers.AddressOrName, amount uint64) { + return baz.Transfer +} +func (BazToken) TransferFrom() func(from, to pusers.AddressOrName, amount uint64) { + return baz.TransferFrom +} +func (BazToken) BalanceOf() func(owner pusers.AddressOrName) uint64 { + return baz.BalanceOf +} +func (BazToken) Approve() func(spender pusers.AddressOrName, amount uint64) { + return baz.Approve +} + +type QuxToken struct{} + +func (QuxToken) Transfer() func(to pusers.AddressOrName, amount uint64) { + return qux.Transfer +} +func (QuxToken) TransferFrom() func(from, to pusers.AddressOrName, amount uint64) { + return qux.TransferFrom +} +func (QuxToken) BalanceOf() func(owner pusers.AddressOrName) uint64 { + return qux.BalanceOf +} +func (QuxToken) Approve() func(spender pusers.AddressOrName, amount uint64) { + return qux.Approve +} + +type WugnotToken struct{} + +func (WugnotToken) Transfer() func(to pusers.AddressOrName, amount uint64) { + return wugnot.Transfer +} +func (WugnotToken) TransferFrom() func(from, to pusers.AddressOrName, amount uint64) { + return wugnot.TransferFrom +} +func (WugnotToken) BalanceOf() func(owner pusers.AddressOrName) uint64 { + return wugnot.BalanceOf +} +func (WugnotToken) Approve() func(spender pusers.AddressOrName, amount uint64) { + return wugnot.Approve +} + +type OBLToken struct{} + +func (OBLToken) Transfer() func(to pusers.AddressOrName, amount uint64) { + return obl.Transfer +} +func (OBLToken) TransferFrom() func(from, to pusers.AddressOrName, amount uint64) { + return obl.TransferFrom +} +func (OBLToken) BalanceOf() func(owner pusers.AddressOrName) uint64 { + return obl.BalanceOf +} +func (OBLToken) Approve() func(spender pusers.AddressOrName, amount uint64) { + return obl.Approve +} + +type GNSToken struct{} + +func (GNSToken) Transfer() func(to pusers.AddressOrName, amount uint64) { + return gns.Transfer +} + +func (GNSToken) TransferFrom() func(from, to pusers.AddressOrName, amount uint64) { + return gns.TransferFrom +} + +func (GNSToken) BalanceOf() func(owner pusers.AddressOrName) uint64 { + return gns.BalanceOf +} + +func (GNSToken) Approve() func(spender pusers.AddressOrName, amount uint64) { + return gns.Approve +} + +func init() { + std.TestSetOrigCaller(consts.GNOSWAP_ADMIN) + + RegisterGRC20Interface("gno.land/r/demo/bar", BarToken{}) + RegisterGRC20Interface("gno.land/r/demo/foo", FooToken{}) + RegisterGRC20Interface("gno.land/r/demo/baz", BazToken{}) + RegisterGRC20Interface("gno.land/r/demo/qux", QuxToken{}) + RegisterGRC20Interface("gno.land/r/demo/wugnot", WugnotToken{}) + RegisterGRC20Interface("gno.land/r/demo/obl", OBLToken{}) + RegisterGRC20Interface("gno.land/r/demo/gns", GNSToken{}) +} + +func TestGetRegisteredTokens(t *testing.T) { + shouldEQ(t, len(GetRegisteredTokens()), 7) +} + +func TestRegisterGRC20Interface(t *testing.T) { + shouldPanic(t, + func() { + RegisterGRC20Interface("gno.land/r/demo/bar", BarToken{}) + }, + ) +} + +func TestUnregisterGRC20Interface(t *testing.T) { + dummy := testutils.TestAddress("dummy") + std.TestSetOrigCaller(dummy) + + shouldPanic(t, + func() { + UnregisterGRC20Interface("gno.land/r/demo/bar") + }, + ) + + shouldEQ(t, len(GetRegisteredTokens()), 7) + + std.TestSetOrigCaller(consts.GNOSWAP_ADMIN) + UnregisterGRC20Interface("gno.land/r/demo/bar") + shouldEQ(t, len(GetRegisteredTokens()), 6) + + // re-register to avoid panic in other tests + RegisterGRC20Interface("gno.land/r/demo/bar", BarToken{}) +} diff --git a/pool/_TEST_/_TEST_0_INIT_VARIABLE_AND_HELPER_test.gno b/pool/_TEST_/_TEST_0_INIT_VARIABLE_AND_HELPER_test.gno new file mode 100644 index 00000000..7ec3977a --- /dev/null +++ b/pool/_TEST_/_TEST_0_INIT_VARIABLE_AND_HELPER_test.gno @@ -0,0 +1,73 @@ +package pool + +import ( + "std" + "testing" + + "gno.land/r/demo/gnoswap/consts" +) + +var ( + gsa std.Address = consts.GNOSWAP_ADMIN + test1 std.Address = std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") + + fooPath string = "gno.land/r/demo/foo" + barPath string = "gno.land/r/demo/bar" + bazPath string = "gno.land/r/demo/baz" + quxPath string = "gno.land/r/demo/qux" + + oblPath string = "gno.land/r/demo/obl" + // wugnotPath string = "gno.land/r/demo/wugnot" // from consts + // gnsPath string = "gno.land/r/demo/gns" // from consts + + fee100 uint32 = 100 + fee500 uint32 = 500 + fee3000 uint32 = 3000 + + maxApprove uint64 = 18446744073709551615 +) + +/* HELPER */ +func shouldEQ(t *testing.T, got, expected interface{}) { + if got != expected { + t.Errorf("got %v, expected %v", got, expected) + } +} + +func shouldNEQ(t *testing.T, got, expected interface{}) { + if got == expected { + t.Errorf("got %v, didn't expected %v", got, expected) + } +} + +func shouldGT(t *testing.T, l, r interface{}) { + if !(l < r) { + t.Errorf("expected %v < %v", l, r) + } +} + +func shouldLT(t *testing.T, l, r interface{}) { + if !(l > r) { + t.Errorf("expected %v > %v", l, r) + } +} + +func shouldPanic(t *testing.T, f func()) { + defer func() { + if r := recover(); r == nil { + t.Errorf("expected panic") + } + }() + f() +} + +func ugnotBalanceOf(addr std.Address) uint64 { + testBanker := std.GetBanker(std.BankerTypeRealmIssue) + + coins := testBanker.GetCoins(addr) + if len(coins) == 0 { + return 0 + } + + return uint64(testBanker.GetCoins(addr)[0].Amount) +} diff --git a/pool/_TEST_/_TEST_pool_dryswap_and_swap_test.gnoA b/pool/_TEST_/_TEST_pool_dryswap_and_swap_test.gnoA new file mode 100644 index 00000000..3a1e3f4d --- /dev/null +++ b/pool/_TEST_/_TEST_pool_dryswap_and_swap_test.gnoA @@ -0,0 +1,127 @@ +package pool + +import ( + "std" + "testing" + + "gno.land/r/demo/gnoswap/consts" + + "gno.land/r/demo/bar" + "gno.land/r/demo/foo" + + "gno.land/r/demo/gns" +) + +var ( + sqrtPrice = "130621891405341611593710811006" + + tickLower = int32(9000) + tickUpper = int32(11000) + liquidityExpect = "100000000000" + + currentTick = int32(10000) +) + +func TestCreatePool(t *testing.T) { + // call gns faucet to get creation fee + std.TestSetPrevAddr(test1) + gns.Faucet() + gns.Faucet() + gns.Faucet() + gns.Faucet() + gns.Faucet() + + gns.Approve(a2u(consts.POOL_ADDR), consts.POOL_CREATION_FEE) + CreatePool(fooPath, barPath, fee500, sqrtPrice) + shouldEQ(t, len(pools), 1) +} + +func TestDrySwap_ZeroForOneTrue_AmountSpecified_Positive_16000(t *testing.T) { + std.TestSetPrevRealm(consts.POSITION_PATH) + std.TestSetOrigCaller(test1) + + // no mint == no liquidity => swap will fail + _, _, ok := DrySwap(fooPath, barPath, fee500, true, "16000", consts.MIN_PRICE) + shouldEQ(t, ok, false) + + // not enough mint == swap will fail + std.TestSetPrevAddr(test1) + foo.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) + bar.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) + + std.TestSetPrevRealm(consts.POSITION_PATH) + std.TestSetOrigCaller(test1) + Mint(fooPath, barPath, fee500, consts.POSITION_ADDR.String(), -tickUpper, -tickLower, "10") + _, _, ok = DrySwap(fooPath, barPath, fee500, true, "16000", consts.MIN_PRICE) + shouldEQ(t, ok, false) + + std.TestSetPrevAddr(test1) + + std.TestSetPrevRealm(consts.POSITION_PATH) + std.TestSetOrigCaller(test1) + Mint(fooPath, barPath, fee500, consts.POSITION_ADDR.String(), -tickUpper, -tickLower, liquidityExpect) // -11000 ~ -9000 + + // zeroForOne true + // amountSpecified 16000 + poolIn, poolOut, _ := DrySwap( + fooPath, // fooPath + barPath, // barPath + fee500, // fee500 + true, // zeroForOne + "16000", // amountSpecified + consts.MIN_PRICE, // sqrtPriceLimitX96 + ) + shouldEQ(t, poolIn, "16000") + shouldEQ(t, poolOut, "-5883") +} + +func TestDrySwap_ZeroForOneTrue_AmountSpecified_Negative_16000(t *testing.T) { + // zeroForOne true + // amountSpecified -16000 + + poolIn, poolOut, _ := DrySwap( + fooPath, // fooPath + barPath, // barPath + fee500, // fee500 + true, // zeroForOne + "-16000", // amountSpecified + consts.MIN_PRICE, // sqrtPriceLimitX96 + ) + + shouldEQ(t, poolIn, "43513") + shouldEQ(t, poolOut, "-16000") +} + +// func TestDrySwap_ZeroForOneFalse_AmountSpecified_Positive_16000(t *testing.T) { +// // zeroForOne false +// // amountSpecified 16000 + +// poolOut, poolIn, _ := DrySwap( +// fooPath, // fooPath +// barPath, // barPath +// fee500, // fee500 +// "_", // recipient +// false, // zeroForOne +// "16000", // amountSpecified +// consts.MAX_PRICE, // sqrtPriceLimitX96 +// ) + +// shouldEQ(t, poolOut, "-43468") +// shouldEQ(t, poolIn, "16000") +// } + +// func TestDrySwap_ZeroForOneFalse_AmountSpecified_Negative_16000(t *testing.T) { +// // zeroForOne false +// // amountSpecified -16000 +// poolOut, poolIn, _ := DrySwap( +// fooPath, // fooPath +// barPath, // barPath +// fee500, // fee500 +// "_", // recipient +// false, // zeroForOne +// "-16000", // amountSpecified +// consts.MAX_PRICE, // sqrtPriceLimitX96 +// ) +// shouldEQ(t, poolOut, "-16000") +// shouldEQ(t, poolIn, "5888") +// } diff --git a/pool/_TEST_/_TEST_pool_multi_token_test.gn b/pool/_TEST_/_TEST_pool_multi_token_test.gn new file mode 100644 index 00000000..e67271a1 --- /dev/null +++ b/pool/_TEST_/_TEST_pool_multi_token_test.gn @@ -0,0 +1,378 @@ +package pool + +import ( + "std" + "strconv" + "testing" + + "gno.land/r/demo/gnoswap/consts" + + "gno.land/r/demo/bar" + "gno.land/r/demo/baz" + "gno.land/r/demo/foo" + + "gno.land/r/demo/gns" + + u256 "gno.land/p/demo/gnoswap/uint256" +) + +var ( + test_tickLower = int32(9000) + test_tickUpper = int32(11000) + test_liquidityExpectStr = "100000000" + test_liquidityExpect256 = u256.NewUint(100_000_000) +) + +// Create Foo:Bar Pool +func TestCreateFooBarPool(t *testing.T) { + // call gns faucet to get creation fee + std.TestSetPrevAddr(test1) + gns.Faucet() + gns.Faucet() + gns.Faucet() + gns.Faucet() + gns.Faucet() + + gns.Approve(a2u(consts.POOL_ADDR), consts.POOL_CREATION_FEE) + + CreatePool(fooPath, barPath, fee500, "130621891405341611593710811006") + shouldEQ(t, len(pools), 1) +} + +// Create Bar:Baz Pool +func TestCreateBarBazPool(t *testing.T) { + // call gns faucet to get creation fee + std.TestSetPrevAddr(test1) + gns.Faucet() + gns.Faucet() + gns.Faucet() + gns.Faucet() + gns.Faucet() + + gns.Approve(a2u(consts.POOL_ADDR), consts.POOL_CREATION_FEE) + + CreatePool(barPath, bazPath, fee500, "130621891405341611593710811006") + shouldEQ(t, len(pools), 2) +} + +// Mint Foo:Bar Liquidity by test1 +func TestMintFooBarLiquidity(t *testing.T) { + std.TestSetPrevAddr(test1) + foo.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) + bar.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) + + std.TestSetPrevRealm(consts.POSITION_PATH) + std.TestSetOrigCaller(test1) + amount0, amount1 := Mint( + fooPath, + barPath, + fee500, + consts.POSITION_ADDR.String(), + -test_tickUpper, + -test_tickLower, + test_liquidityExpectStr, + ) + shouldEQ(t, amount0, "8040316") + shouldEQ(t, amount1, "2958014") +} + +// Mint Bar:Baz Liquidity by test1 +func TestMintBarBazLiquidity(t *testing.T) { + std.TestSetPrevAddr(test1) + bar.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) + baz.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) + + std.TestSetPrevRealm(consts.POSITION_PATH) + std.TestSetOrigCaller(test1) + amount0, amount1 := Mint( + barPath, + bazPath, + fee500, + consts.POSITION_ADDR.String(), + test_tickLower, + test_tickUpper, + test_liquidityExpectStr, + ) + shouldEQ(t, amount0, "2958015") + shouldEQ(t, amount1, "8040315") +} + +// Swap Foo:Bar Foo > Bar by test1 +func TestSwapFooBarFooToBar(t *testing.T) { + oldTest1Bar := balanceOfByRegisterCall(barPath, test1) + oldTest1Foo := balanceOfByRegisterCall(fooPath, test1) + + oldPoolBar := balanceOfByRegisterCall(barPath, consts.POOL_ADDR) + oldPoolFoo := balanceOfByRegisterCall(fooPath, consts.POOL_ADDR) + + std.TestSetPrevAddr(test1) + bar.Approve(a2u(consts.POOL_ADDR), 16000) + + std.TestSetPrevRealm(consts.ROUTER_PATH) + std.TestSetOrigCaller(test1) + poolIn, poolOut := Swap( + barPath, + fooPath, + fee500, + test1.String(), + true, + "16000", + consts.MIN_PRICE, + std.GetOrigCaller().String(), + ) + shouldEQ(t, poolIn, "16000") + shouldEQ(t, poolOut, "-5882") + + newTest1Bar := balanceOfByRegisterCall(barPath, test1) + newTest1Foo := balanceOfByRegisterCall(fooPath, test1) + + newPoolBar := balanceOfByRegisterCall(barPath, consts.POOL_ADDR) + newPoolFoo := balanceOfByRegisterCall(fooPath, consts.POOL_ADDR) + + shouldEQ(t, oldTest1Bar-newTest1Bar, 16000) + shouldEQ(t, newTest1Foo-oldTest1Foo, 5882) + + shouldEQ(t, newPoolBar-oldPoolBar, 16000) + shouldEQ(t, oldPoolFoo-newPoolFoo, 5882) +} + +// Swap Bar:Baz Bar > Baz by test1 +func TestSwapBarBazBarToBaz(t *testing.T) { + oldTest1Token0Balance := balanceOfByRegisterCall(barPath, test1) + oldtest1BazBalance := balanceOfByRegisterCall(bazPath, test1) + oldPoolToken0Balance := balanceOfByRegisterCall(barPath, consts.POOL_ADDR) + oldPoolBazBalance := balanceOfByRegisterCall(bazPath, consts.POOL_ADDR) + + std.TestSetPrevAddr(test1) + bar.Approve(a2u(consts.POOL_ADDR), 16000) + + std.TestSetPrevRealm(consts.ROUTER_PATH) + std.TestSetOrigCaller(test1) + poolIn, poolOut := Swap( + barPath, + bazPath, + fee500, + test1.String(), + true, + "16000", + consts.MIN_PRICE, + std.GetOrigCaller().String(), + ) + shouldEQ(t, poolIn, "16000") + shouldEQ(t, poolOut, "-43457") + + newTest1Token0Balance := balanceOfByRegisterCall(barPath, test1) + newtest1BazBalance := balanceOfByRegisterCall(bazPath, test1) + newPoolToken0Balance := balanceOfByRegisterCall(barPath, consts.POOL_ADDR) + newPoolBazBalance := balanceOfByRegisterCall(bazPath, consts.POOL_ADDR) + + shouldEQ(t, oldTest1Token0Balance-newTest1Token0Balance, 16000) + shouldEQ(t, newtest1BazBalance-oldtest1BazBalance, 43457) + shouldEQ(t, newPoolToken0Balance-oldPoolToken0Balance, 16000) + shouldEQ(t, oldPoolBazBalance-newPoolBazBalance, 43457) +} + +// Collect Foo:Bar Fees by test1 +func TestCollectFooBarFees(t *testing.T) { + std.TestSetPrevRealm(consts.POSITION_PATH) + std.TestSetOrigCaller(test1) + + oldTest1Token1Balance := balanceOfByRegisterCall(fooPath, test1) + oldTest1Token0Balance := balanceOfByRegisterCall(barPath, test1) + oldPoolToken1Balance := balanceOfByRegisterCall(fooPath, consts.POOL_ADDR) + oldPoolToken0Balance := balanceOfByRegisterCall(barPath, consts.POOL_ADDR) + + // burn 0 to collect swap fees + Burn(fooPath, barPath, fee500, -test_tickUpper, -test_tickLower, "0") + + c0, c1 := Collect( + fooPath, + barPath, + fee500, + test1.String(), + -test_tickUpper, + -test_tickLower, + "100000", + "100000", + ) + + shouldNEQ(t, c0, "0") // swap was foo > bar, so only foo has fees + shouldEQ(t, c1, "0") // swap was foo > bar, so bar has no fees + + newTest1Token1Balance := balanceOfByRegisterCall(fooPath, test1) + newTest1Token0Balance := balanceOfByRegisterCall(barPath, test1) + newPoolToken1Balance := balanceOfByRegisterCall(fooPath, consts.POOL_ADDR) + newPoolToken0Balance := balanceOfByRegisterCall(barPath, consts.POOL_ADDR) + + shouldEQ(t, newTest1Token1Balance-oldTest1Token1Balance, c1) + shouldEQ(t, newTest1Token0Balance-oldTest1Token0Balance, strToUint64(c0)) + shouldEQ(t, oldPoolToken1Balance-newPoolToken1Balance, c1) + shouldEQ(t, oldPoolToken0Balance-newPoolToken0Balance, strToUint64(c0)) +} + +// Collect Bar:Baz Fees by test1 +func TestCollectBarBazFees(t *testing.T) { + std.TestSetPrevRealm(consts.POSITION_PATH) + std.TestSetOrigCaller(test1) + + oldTest1Token0Balance := balanceOfByRegisterCall(barPath, test1) + oldtest1BazBalance := balanceOfByRegisterCall(bazPath, test1) + oldPoolToken0Balance := balanceOfByRegisterCall(barPath, consts.POOL_ADDR) + oldPoolBazBalance := balanceOfByRegisterCall(bazPath, consts.POOL_ADDR) + + // burn 0 to collect swap fees + Burn(barPath, bazPath, fee500, test_tickLower, test_tickUpper, "0") + + c0, c1 := Collect( + barPath, + bazPath, + fee500, + test1.String(), + test_tickLower, + test_tickUpper, + "100000", + "100000", + ) + + shouldNEQ(t, c0, "0") // swap was foo > bar, so only foo has fees + shouldEQ(t, c1, "0") // swap was foo > bar, so bar has no fees + + newTest1Token0Balance := balanceOfByRegisterCall(barPath, test1) + newtest1BazBalance := balanceOfByRegisterCall(bazPath, test1) + newPoolToken0Balance := balanceOfByRegisterCall(barPath, consts.POOL_ADDR) + newPoolBazBalance := balanceOfByRegisterCall(bazPath, consts.POOL_ADDR) + + shouldEQ(t, newTest1Token0Balance-oldTest1Token0Balance, strToUint64(c0)) + shouldEQ(t, newtest1BazBalance-oldtest1BazBalance, c1) + shouldEQ(t, oldPoolToken0Balance-newPoolToken0Balance, strToUint64(c0)) + shouldEQ(t, oldPoolBazBalance-newPoolBazBalance, c1) +} + +// Burn Foo:Bar Liquidity by test1 +func TestBurnFooBarLiquidity(t *testing.T) { + std.TestSetOrigCaller(test1) + std.TestSetPrevRealm(consts.POSITION_PATH) + + pool := GetPool(fooPath, barPath, fee500) + poolOldLiquidity := pool.PoolGetLiquidity() + + b0, b1 := Burn( + fooPath, + barPath, + fee500, + -test_tickUpper, + -test_tickLower, + test_liquidityExpectStr, + ) + + shouldNEQ(t, b0, "0") + shouldNEQ(t, b1, "0") + + poolNewLiquidity := pool.PoolGetLiquidity() + + shouldEQ(t, true, new(u256.Uint).Sub(poolOldLiquidity, poolNewLiquidity).Eq(test_liquidityExpect256)) +} + +// Burn Bar:Baz Liquidity by test1 +func TestBurnBarBazLiquidity(t *testing.T) { + std.TestSetOrigCaller(test1) + std.TestSetPrevRealm(consts.POSITION_PATH) + + pool := GetPool(barPath, bazPath, fee500) + poolOldLiquidity := pool.PoolGetLiquidity() + + b0, b1 := Burn( + barPath, + bazPath, + fee500, + test_tickLower, + test_tickUpper, + test_liquidityExpectStr, + ) + + shouldNEQ(t, b0, "0") + shouldNEQ(t, b1, "0") + + poolNewLiquidity := pool.PoolGetLiquidity() + + // shouldEQ(t, poolOldLiquidity-poolNewLiquidity, test_liquidityExpect256) +} + +// Collect Foo:Bar burned Liquidity by test1 +func TestCollectFooBarLiquidity(t *testing.T) { + std.TestSetOrigCaller(test1) + std.TestSetPrevRealm(consts.POSITION_PATH) + + oldTest1Token1Balance := balanceOfByRegisterCall(fooPath, test1) + oldTest1Token0Balance := balanceOfByRegisterCall(barPath, test1) + oldPoolToken1Balance := balanceOfByRegisterCall(fooPath, consts.POOL_ADDR) + oldPoolToken0Balance := balanceOfByRegisterCall(barPath, consts.POOL_ADDR) + + c0, c1 := Collect( + fooPath, + barPath, + fee500, + test1.String(), + -test_tickUpper, + -test_tickLower, + "100000", + "100000", + ) + + shouldNEQ(t, c0, "0") + shouldNEQ(t, c1, "0") + + newTest1Token1Balance := balanceOfByRegisterCall(fooPath, test1) + newTest1Token0Balance := balanceOfByRegisterCall(barPath, test1) + newPoolToken1Balance := balanceOfByRegisterCall(fooPath, consts.POOL_ADDR) + newPoolToken0Balance := balanceOfByRegisterCall(barPath, consts.POOL_ADDR) + + shouldEQ(t, newTest1Token1Balance-oldTest1Token1Balance, strToUint64(c0)) + shouldEQ(t, newTest1Token0Balance-oldTest1Token0Balance, strToUint64(c1)) + shouldEQ(t, oldPoolToken1Balance-newPoolToken1Balance, strToUint64(c0)) + shouldEQ(t, oldPoolToken0Balance-newPoolToken0Balance, strToUint64(c1)) +} + +// Collect Bar:Baz burned Liquidity by test1 +func TestCollectBarBazLiquidity(t *testing.T) { + std.TestSetOrigCaller(test1) + std.TestSetPrevRealm(consts.POSITION_PATH) + + oldTest1Token0Balance := balanceOfByRegisterCall(barPath, test1) + oldtest1BazBalance := balanceOfByRegisterCall(bazPath, test1) + oldPoolToken0Balance := balanceOfByRegisterCall(barPath, consts.POOL_ADDR) + oldPoolBazBalance := balanceOfByRegisterCall(bazPath, consts.POOL_ADDR) + + c0, c1 := Collect( + barPath, + bazPath, + fee500, + test1.String(), + test_tickLower, + test_tickUpper, + "100000", + "100000", + ) + + shouldNEQ(t, c0, "0") + shouldNEQ(t, c1, "0") + + newTest1Token0Balance := balanceOfByRegisterCall(barPath, test1) + newtest1BazBalance := balanceOfByRegisterCall(bazPath, test1) + newPoolToken0Balance := balanceOfByRegisterCall(barPath, consts.POOL_ADDR) + newPoolBazBalance := balanceOfByRegisterCall(bazPath, consts.POOL_ADDR) + + shouldEQ(t, newTest1Token0Balance-oldTest1Token0Balance, strToUint64(c0)) + shouldEQ(t, newtest1BazBalance-oldtest1BazBalance, strToUint64(c1)) + shouldEQ(t, oldPoolToken0Balance-newPoolToken0Balance, strToUint64(c0)) + shouldEQ(t, oldPoolBazBalance-newPoolBazBalance, strToUint64(c1)) +} + +// UTILs // +func strToUint64(s string) uint64 { + i, err := strconv.Atoi(s) + if err != nil { + panic("strToUint64") + } + return uint64(i) +} diff --git a/pool/_TEST_/_TEST_pool_native_swap_test.gn b/pool/_TEST_/_TEST_pool_native_swap_test.gn new file mode 100644 index 00000000..b45acd55 --- /dev/null +++ b/pool/_TEST_/_TEST_pool_native_swap_test.gn @@ -0,0 +1,135 @@ +package pool + +import ( + "std" + "testing" + + "gno.land/r/demo/gnoswap/consts" + + "gno.land/r/demo/gns" + + "gno.land/r/demo/foo" + "gno.land/r/demo/wugnot" +) + +var ( + test_tickLower = int32(9000) + test_tickUpper = int32(11000) +) + +// 1. Init & Create Pool +func TestPoolInitCreatePool(t *testing.T) { + // call gns faucet to get creation fee + std.TestSetPrevAddr(test1) + gns.Faucet() + gns.Faucet() + gns.Faucet() + gns.Faucet() + gns.Faucet() + + gns.Approve(a2u(consts.POOL_ADDR), consts.POOL_CREATION_FEE) + CreatePool(fooPath, consts.WRAPPED_WUGNOT, fee500, "130621891405341611593710811006") // x2.7 +} + +// 2. Mint LP and Get GNFT +func TestMint(t *testing.T) { + token0, token1 := fooPath, consts.WRAPPED_WUGNOT + if token1 < token0 { + token0, token1 = token1, token0 + } + + // prepare ugnot + testBanker := std.GetBanker(std.BankerTypeRealmIssue) + testBanker.IssueCoin(test1, "ugnot", 804_032) + + // simulate transfer & decrase + std.TestSetOrigSend(std.Coins{{"ugnot", 804_032}}, nil) + testBanker.RemoveCoin(std.GetOrigCaller(), "ugnot", 804_032) + + // Deposit(wrap) + std.TestSetPrevAddr(test1) + wugnot.Deposit() + + std.TestSetPrevAddr(test1) + foo.Approve(a2u(consts.POOL_ADDR), 295802) + wugnot.Approve(a2u(consts.POOL_ADDR), 804032) + + // Mint + std.TestSetPrevRealm(consts.POSITION_PATH) + amount0, amount1 := Mint( + fooPath, + consts.WRAPPED_WUGNOT, + fee500, + consts.POSITION_ADDR.String(), + test_tickLower, + test_tickUpper, + "10000000", + ) + + shouldEQ(t, amount0, "295802") + shouldEQ(t, amount1, "804031") +} + +func TestSwapBuyNative(t *testing.T) { + pool := GetPool(fooPath, consts.WRAPPED_WUGNOT, fee500) + + test1OldT0Bal := balanceOfByRegisterCall(pool.token0Path, test1) + test1OldT1Bal := balanceOfByRegisterCall(pool.token1Path, test1) + shouldEQ(t, test1OldT0Bal, 9999704198) // foo + shouldEQ(t, test1OldT1Bal, 1) // wugnot + + std.TestSetPrevAddr(test1) + foo.Approve(a2u(consts.POOL_ADDR), 10000) + + std.TestSetPrevRealm(consts.ROUTER_PATH) + std.TestSetOrigCaller(test1) + amount0, amount1 := Swap( + fooPath, // token0 + consts.WRAPPED_WUGNOT, // token1 + fee500, + test1.String(), + true, + "10000", + consts.MIN_PRICE, + std.GetOrigCaller().String(), + ) + shouldEQ(t, amount0, "10000") + shouldEQ(t, amount1, "-27123") + + test1NewT0Bal := balanceOfByRegisterCall(pool.token0Path, test1) + test1NewT1Bal := balanceOfByRegisterCall(pool.token1Path, test1) + shouldEQ(t, test1NewT0Bal, 9999694198) // - 10_000 // user sells 10_000 + shouldEQ(t, test1NewT1Bal, 27124) // gets WGNOT +} + +func TestSwapSellNative(t *testing.T) { + pool := GetPool(fooPath, consts.WRAPPED_WUGNOT, fee500) + + test1OldT0Bal := balanceOfByRegisterCall(pool.token0Path, test1) + test1OldT1Bal := balanceOfByRegisterCall(pool.token1Path, test1) + shouldEQ(t, test1OldT0Bal, 9999694198) // foo + shouldEQ(t, test1OldT1Bal, 27124) // wugnot + + std.TestSetPrevAddr(test1) + wugnot.Approve(a2u(consts.POOL_ADDR), 27123) + + std.TestSetPrevRealm(consts.ROUTER_PATH) + std.TestSetOrigCaller(test1) + amount0, amount1 := Swap( // ugnot 10_000 > foo ?? + fooPath, // token0 + consts.WRAPPED_WUGNOT, // token1 + fee500, + test1.String(), + false, + "10000", + consts.MAX_PRICE, + std.GetOrigCaller().String(), + ) + shouldEQ(t, amount0, "-3687") // pool sent + shouldEQ(t, amount1, "10000") // pool recv + + test1NewT0Bal := balanceOfByRegisterCall(pool.token0Path, test1) + test1NewT1Bal := balanceOfByRegisterCall(pool.token1Path, test1) + shouldEQ(t, test1NewT0Bal, 9999697885) // foo + shouldEQ(t, test1NewT1Bal, 17124) // wugnot +} diff --git a/pool/_TEST_/_TEST_pool_single_lp_test.gn b/pool/_TEST_/_TEST_pool_single_lp_test.gn new file mode 100644 index 00000000..342455a2 --- /dev/null +++ b/pool/_TEST_/_TEST_pool_single_lp_test.gn @@ -0,0 +1,379 @@ +package pool + +import ( + "std" + "strconv" + "testing" + + "gno.land/r/demo/bar" + "gno.land/r/demo/foo" + "gno.land/r/demo/gns" + + "gno.land/r/demo/gnoswap/consts" + + "gno.land/p/demo/json" + + u256 "gno.land/p/demo/gnoswap/uint256" +) + +var ( + test_tickLower = int32(9000) + test_tickUpper = int32(11000) + test_liquidityExpectStr = "1000" + test_liquidityExpect256 = u256.NewUint(1000) + + test_tickLower2 = int32(50000) + test_tickUpper2 = int32(100000) +) + +// 1. reate Pool using Factory Contract by Gnoswap Admin +func TestInitCreatePool(t *testing.T) { + // call gns faucet to get creation fee + std.TestSetPrevAddr(test1) + gns.Faucet() + gns.Faucet() + gns.Faucet() + gns.Faucet() + gns.Faucet() + + gns.Approve(a2u(consts.POOL_ADDR), consts.POOL_CREATION_FEE) + CreatePool(barPath, fooPath, fee500, "130621891405341611593710811006") // x2.7 +} + +// 2. Mint by test1 +func TestMint(t *testing.T) { + std.TestSetPrevAddr(test1) + + bar.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) + foo.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) + + std.TestSetPrevRealm(consts.POSITION_PATH) + std.TestSetOrigCaller(test1) + amount0, amount1 := Mint( + fooPath, + barPath, + fee500, + consts.POSITION_ADDR.String(), + test_tickLower, + test_tickUpper, + test_liquidityExpectStr, + ) + shouldEQ(t, amount0, "30") + shouldEQ(t, amount1, "80") + + pool := GetPool(barPath, fooPath, fee500) + test_liquidity := pool.PoolGetLiquidity() + shouldEQ(t, test_liquidity.Dec(), test_liquidityExpectStr) + + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower, test_tickUpper, test_liquidityExpectStr) + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower, test_tickUpper, test_liquidityExpectStr) + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower, test_tickUpper, test_liquidityExpectStr) + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower, test_tickUpper, test_liquidityExpectStr) + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower, test_tickUpper, test_liquidityExpectStr) + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower, test_tickUpper, test_liquidityExpectStr) + + m81, m82 := Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower, test_tickUpper, test_liquidityExpectStr) + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower, test_tickUpper, test_liquidityExpectStr) + m101, m102 := Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower, test_tickUpper, test_liquidityExpectStr) + + shouldNEQ(t, m81, "0") + shouldNEQ(t, m82, "0") + shouldEQ(t, m81, m101) + shouldEQ(t, m82, m102) + + test_liquidity = pool.PoolGetLiquidity() + shouldEQ(t, true, test_liquidity.Eq(new(u256.Uint).Mul(test_liquidityExpect256, u256.NewUint(10)))) + + // tickLower > currentTick == don't add to current liquidity + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower2, test_tickUpper2, test_liquidityExpectStr) + + // tickUpper < current tick == don't add to current liquidity + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), -test_tickUpper2, -test_tickLower2, test_liquidityExpectStr) + + // tickUpper < tickLower == don't add to current liquidity + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), -test_tickUpper, -test_tickLower, test_liquidityExpectStr) + + // test_liquidity = pool.PoolGetLiquidity() + shouldEQ(t, true, test_liquidity.Eq(new(u256.Uint).Mul(test_liquidityExpect256, u256.NewUint(10)))) + + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower, test_tickUpper, test_liquidityExpectStr) + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower, test_tickUpper, test_liquidityExpectStr) + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower, test_tickUpper, test_liquidityExpectStr) + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower, test_tickUpper, test_liquidityExpectStr) + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower, test_tickUpper, test_liquidityExpectStr) + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower, test_tickUpper, test_liquidityExpectStr) + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower, test_tickUpper, test_liquidityExpectStr) + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower, test_tickUpper, test_liquidityExpectStr) + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower, test_tickUpper, test_liquidityExpectStr) + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower, test_tickUpper, test_liquidityExpectStr) + + test_liquidity = pool.PoolGetLiquidity() + shouldEQ(t, true, test_liquidity.Eq(new(u256.Uint).Mul(test_liquidityExpect256, u256.NewUint(20)))) + +} + +// 3. Burn by test1 +func TestBurn(t *testing.T) { + std.TestSetPrevRealm(consts.POSITION_PATH) + std.TestSetOrigCaller(test1) + + b11, b12 := Burn(barPath, fooPath, fee500, test_tickLower, test_tickUpper, test_liquidityExpectStr) + b21, b22 := Burn(barPath, fooPath, fee500, test_tickLower, test_tickUpper, test_liquidityExpectStr) + shouldEQ(t, b11, b21) + shouldEQ(t, b12, b22) + + pool := GetPool(barPath, fooPath, fee500) + test_liquidity := pool.PoolGetLiquidity() + shouldEQ(t, true, test_liquidity.Eq(new(u256.Uint).Mul(test_liquidityExpect256, u256.NewUint(18)))) + + Burn(barPath, fooPath, fee500, test_tickLower, test_tickUpper, new(u256.Uint).Mul(test_liquidityExpect256, u256.NewUint(8)).ToString()) + test_liquidity = pool.PoolGetLiquidity() + shouldEQ(t, true, test_liquidity.Eq(new(u256.Uint).Mul(test_liquidityExpect256, u256.NewUint(10)))) + + Burn(barPath, fooPath, fee500, test_tickLower, test_tickUpper, "1") + test_liquidity = pool.PoolGetLiquidity() + shouldEQ(t, test_liquidity.ToString(), "9999") + + Burn(barPath, fooPath, fee500, test_tickLower, test_tickUpper, "999") + test_liquidity = pool.PoolGetLiquidity() + shouldEQ(t, true, test_liquidity.Eq(new(u256.Uint).Mul(test_liquidityExpect256, u256.NewUint(9)))) + + Burn(barPath, fooPath, fee500, test_tickLower, test_tickUpper, new(u256.Uint).Mul(test_liquidityExpect256, u256.NewUint(9)).ToString()) + test_liquidity = pool.PoolGetLiquidity() + shouldEQ(t, test_liquidity.ToString(), "0") +} + +// 4. Collect +func TestCollect(t *testing.T) { + std.TestSetPrevRealm(consts.POSITION_PATH) + std.TestSetOrigCaller(test1) + + // withdraw all token before test `Collect` + Collect(barPath, fooPath, fee500, test1.String(), test_tickLower, test_tickUpper, "50000000", "50000000") + + // pool should have zero liquidity + pool := GetPool(barPath, fooPath, fee500) + test_liquidity := pool.PoolGetLiquidity() + shouldEQ(t, test_liquidity.ToString(), "0") + + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower, test_tickUpper, new(u256.Uint).Mul(test_liquidityExpect256, u256.NewUint(15)).ToString()) + Burn(barPath, fooPath, fee500, test_tickLower, test_tickUpper, new(u256.Uint).Mul(test_liquidityExpect256, u256.NewUint(15)).ToString()) + c11, c12 := Collect(barPath, fooPath, fee500, test1.String(), test_tickLower, test_tickUpper, "50000000", "50000000") + + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower, test_tickUpper, new(u256.Uint).Mul(test_liquidityExpect256, u256.NewUint(15)).ToString()) + Burn(barPath, fooPath, fee500, test_tickLower, test_tickUpper, new(u256.Uint).Mul(test_liquidityExpect256, u256.NewUint(15)).ToString()) + c21, c22 := Collect(barPath, fooPath, fee500, test1.String(), test_tickLower, test_tickUpper, "50000000", "50000000") + + shouldEQ(t, c11, c21) // 443 + shouldEQ(t, c12, c22) // 1206 + + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower, test_tickUpper, new(u256.Uint).Mul(test_liquidityExpect256, u256.NewUint(15)).ToString()) + Burn(barPath, fooPath, fee500, test_tickLower, test_tickUpper, new(u256.Uint).Mul(test_liquidityExpect256, u256.NewUint(15)).ToString()) + c31, c32 := Collect(barPath, fooPath, fee500, test1.String(), test_tickLower, test_tickUpper, "100", "100") + shouldEQ(t, c31, "100") + shouldEQ(t, c32, "100") + + c41, c42 := Collect(barPath, fooPath, fee500, test1.String(), test_tickLower, test_tickUpper, "50000000", "50000000") + shouldEQ(t, c41, "343") // 343 = c21 - 100 + shouldEQ(t, c42, "1106") // 1106 = c22 - 100 + + // Mint > No Burn => nothing to collect + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower, test_tickUpper, new(u256.Uint).Mul(test_liquidityExpect256, u256.NewUint(15)).ToString()) + // Burn(barPath, fooPath, fee500, test_tickLower, test_tickUpper, test_liquidityExpectStr*15) + c51, c52 := Collect(barPath, fooPath, fee500, test1.String(), test_tickLower, test_tickUpper, "50000000", "50000000") + shouldEQ(t, c51, "0") + shouldEQ(t, c52, "0") + + // Burn Now => something to collect + Burn(barPath, fooPath, fee500, test_tickLower, test_tickUpper, new(u256.Uint).Mul(test_liquidityExpect256, u256.NewUint(15)).ToString()) + c61, c62 := Collect(barPath, fooPath, fee500, test1.String(), test_tickLower, test_tickUpper, "50000000", "50000000") + shouldNEQ(t, c61, "0") + shouldNEQ(t, c62, "0") +} + +// 5. Swap by test1 +func TestSwap(t *testing.T) { + pool := GetPool(barPath, fooPath, fee500) + test_liquidity := pool.PoolGetLiquidity() + shouldEQ(t, test_liquidity.ToString(), "0") + + std.TestSetPrevRealm(consts.POSITION_PATH) + std.TestSetOrigCaller(test1) + Mint(barPath, fooPath, fee500, consts.POSITION_ADDR.String(), test_tickLower, test_tickUpper, new(u256.Uint).Mul(test_liquidityExpect256, u256.NewUint(20000)).ToString()) + + // Swap several times + std.TestSetPrevRealm(consts.ROUTER_PATH) + std.TestSetOrigCaller(test1) + test_price := consts.MIN_PRICE + { + poolOldToken0Bal := balanceOfByRegisterCall(pool.token0Path, consts.POOL_ADDR) + poolOldToken1Bal := balanceOfByRegisterCall(pool.token1Path, consts.POOL_ADDR) + + userOldToken0Bal := balanceOfByRegisterCall(pool.token0Path, test1) + userOldToken1Bal := balanceOfByRegisterCall(pool.token1Path, test1) + + amount0, amount1 := Swap( + fooPath, // token0Path + barPath, // token1Path + fee500, // fee + test1.String(), // recipient + true, // zeroForOne + "10000", // _amountSpecified + test_price, // _sqrtPriceLimitX96 + std.GetOrigCaller().String(), // payer + ) + shouldNEQ(t, amount0, "0") + shouldNEQ(t, amount1, "0") + intAmount0, _ := strconv.Atoi(amount0) + intAmount1, _ := strconv.Atoi(amount1) + + poolNewToken0Bal := balanceOfByRegisterCall(pool.token0Path, consts.POOL_ADDR) + poolNewToken1Bal := balanceOfByRegisterCall(pool.token1Path, consts.POOL_ADDR) + + userNewToken0Bal := balanceOfByRegisterCall(pool.token0Path, test1) + userNewToken1Bal := balanceOfByRegisterCall(pool.token1Path, test1) + + shouldEQ(t, userOldToken0Bal-userNewToken0Bal, int64(intAmount0)) + shouldEQ(t, userNewToken1Bal-userOldToken1Bal, int64(-intAmount1)) + shouldEQ(t, poolNewToken0Bal-poolOldToken0Bal, int64(intAmount0)) + shouldEQ(t, poolOldToken1Bal-poolNewToken1Bal, int64(-intAmount1)) + } + + { + poolOldToken0Bal := balanceOfByRegisterCall(pool.token0Path, consts.POOL_ADDR) + poolOldToken1Bal := balanceOfByRegisterCall(pool.token1Path, consts.POOL_ADDR) + + userOldToken0Bal := balanceOfByRegisterCall(pool.token0Path, test1) + userOldToken1Bal := balanceOfByRegisterCall(pool.token1Path, test1) + + amount0, amount1 := Swap(barPath, fooPath, fee500, test1.String(), true, "5000", test_price, std.GetOrigCaller().String()) // give enough amount to take fees away + intAmount0, _ := strconv.Atoi(amount0) + intAmount1, _ := strconv.Atoi(amount1) + + poolNewToken0Bal := balanceOfByRegisterCall(pool.token0Path, consts.POOL_ADDR) + poolNewToken1Bal := balanceOfByRegisterCall(pool.token1Path, consts.POOL_ADDR) + + userNewToken0Bal := balanceOfByRegisterCall(pool.token0Path, test1) + userNewToken1Bal := balanceOfByRegisterCall(pool.token1Path, test1) + + shouldEQ(t, userOldToken0Bal-userNewToken0Bal, int64(intAmount0)) + shouldEQ(t, userNewToken1Bal-userOldToken1Bal, int64(-intAmount1)) + shouldEQ(t, poolNewToken0Bal-poolOldToken0Bal, int64(intAmount0)) + shouldEQ(t, poolOldToken1Bal-poolNewToken1Bal, int64(-intAmount1)) + } + + { + poolOldToken0Bal := balanceOfByRegisterCall(pool.token0Path, consts.POOL_ADDR) + poolOldToken1Bal := balanceOfByRegisterCall(pool.token1Path, consts.POOL_ADDR) + + userOldToken0Bal := balanceOfByRegisterCall(pool.token0Path, test1) + userOldToken1Bal := balanceOfByRegisterCall(pool.token1Path, test1) + + amount0, amount1 := Swap(barPath, fooPath, fee500, test1.String(), true, "1000", test_price, std.GetOrigCaller().String()) // give enough amount to take fees away + intAmount0, _ := strconv.Atoi(amount0) + intAmount1, _ := strconv.Atoi(amount1) + + poolNewToken0Bal := balanceOfByRegisterCall(pool.token0Path, consts.POOL_ADDR) + poolNewToken1Bal := balanceOfByRegisterCall(pool.token1Path, consts.POOL_ADDR) + + userNewToken0Bal := balanceOfByRegisterCall(pool.token0Path, test1) + userNewToken1Bal := balanceOfByRegisterCall(pool.token1Path, test1) + + shouldEQ(t, userOldToken0Bal-userNewToken0Bal, int64(intAmount0)) + shouldEQ(t, userNewToken1Bal-userOldToken1Bal, int64(-intAmount1)) + shouldEQ(t, poolNewToken0Bal-poolOldToken0Bal, int64(intAmount0)) + shouldEQ(t, poolOldToken1Bal-poolNewToken1Bal, int64(-intAmount1)) + } + + // Swap token1 -> token0 + { + poolOldToken0Bal := balanceOfByRegisterCall(pool.token0Path, consts.POOL_ADDR) + poolOldToken1Bal := balanceOfByRegisterCall(pool.token1Path, consts.POOL_ADDR) + + userOldToken0Bal := balanceOfByRegisterCall(pool.token0Path, test1) + userOldToken1Bal := balanceOfByRegisterCall(pool.token1Path, test1) + + amount0, amount1 := Swap(barPath, fooPath, fee500, test1.String(), false, "16000", consts.MAX_PRICE, std.GetOrigCaller().String()) // give enough amount to take fees away + intAmount0, _ := strconv.Atoi(amount0) + intAmount1, _ := strconv.Atoi(amount1) + + poolNewToken0Bal := balanceOfByRegisterCall(pool.token0Path, consts.POOL_ADDR) + poolNewToken1Bal := balanceOfByRegisterCall(pool.token1Path, consts.POOL_ADDR) + + userNewToken0Bal := balanceOfByRegisterCall(pool.token0Path, test1) + userNewToken1Bal := balanceOfByRegisterCall(pool.token1Path, test1) + + shouldEQ(t, userOldToken0Bal-userNewToken0Bal, int64(intAmount0)) + shouldEQ(t, userNewToken1Bal-userOldToken1Bal, int64(-intAmount1)) + shouldEQ(t, poolNewToken0Bal-poolOldToken0Bal, int64(intAmount0)) + shouldEQ(t, poolOldToken1Bal-poolNewToken1Bal, int64(-intAmount1)) + } +} + +// 6. SetFeeProtocol by Gnoswap Admin +func TestSetFeeProtocol(t *testing.T) { + // non admin call + std.TestSetOrigCaller(gsa) + shouldPanic(t, func() { SetFeeProtocol(2, 2) }) + + // admin call + std.TestSetOrigCaller(gsa) + SetFeeProtocol(6, 8) + + for _, pool := range pools { + shouldEQ(t, pool.PoolGetSlot0().feeProtocol, 134) + } +} + +// 7. CollectProtocol by Gnoswap Admin +func TestCollectProtocol(t *testing.T) { + std.TestSetOrigCaller(gsa) + SetFeeProtocol(6, 8) + pool := GetPool(barPath, fooPath, fee500) + test_slot0 := pool.PoolGetSlot0() + shouldEQ(t, test_slot0.feeProtocol, 134) + + // Make ProtocolFee via Swap by test1 ( Mint by test1 ) + std.TestSetOrigCaller(test1) + { + + std.TestSetPrevRealm(consts.ROUTER_PATH) + std.TestSetOrigCaller(test1) + Swap(barPath, fooPath, fee500, test1.String(), true, "200000", consts.MIN_PRICE, std.GetOrigCaller().String()) // swap token0 -> token1 => fee only in token0 + + test1OldToken0Bal := balanceOfByRegisterCall(pool.token0Path, test1) + test1OldToken1Bal := balanceOfByRegisterCall(pool.token1Path, test1) + + std.TestSetPrevAddr(gsa) + amount0, amount1 := CollectProtocol(barPath, fooPath, fee500, test1.String(), "100000", "100000") + + test1NewToken0Bal := balanceOfByRegisterCall(pool.token0Path, test1) + test1NewToken1Bal := balanceOfByRegisterCall(pool.token1Path, test1) + + _token0Diff := test1NewToken0Bal - test1OldToken0Bal + _token1Diff := test1NewToken1Bal - test1OldToken1Bal + + token0DiffStr := strconv.Itoa(int(_token0Diff)) + token1DiffStr := strconv.Itoa(int(_token1Diff)) + + shouldEQ(t, token0DiffStr, amount0) + shouldEQ(t, token1DiffStr, amount1) + } +} + +// GETTER_API TEST +func TestApiGetPools(t *testing.T) { + gpls := ApiGetPools() + + root, err := json.Unmarshal([]byte(gpls)) + if err != nil { + panic(err) + } + + response, err := root.GetKey("response") + if err != nil { + panic(err) + } + + shouldEQ(t, response.Size(), 1) +} diff --git a/pool/_TEST_/_TEST_pool_test.gn b/pool/_TEST_/_TEST_pool_test.gn new file mode 100644 index 00000000..cebbcd70 --- /dev/null +++ b/pool/_TEST_/_TEST_pool_test.gn @@ -0,0 +1,124 @@ +package pool + +import ( + "std" + "testing" + + "gno.land/p/demo/json" + + "gno.land/r/demo/bar" + "gno.land/r/demo/baz" + "gno.land/r/demo/foo" + + "gno.land/r/demo/gnoswap/consts" + + "gno.land/r/demo/gns" +) + +var ( + test_tickLower = int32(9000) + test_tickUpper = int32(11000) + test_liquidityExpectStr = "100000000" +) + +// 1. Create Foo:Bar Pool +func TestCreateFooBarPool(t *testing.T) { + // call gns faucet to get creation fee + std.TestSetPrevAddr(test1) + gns.Faucet() + gns.Faucet() + gns.Faucet() + gns.Faucet() + gns.Faucet() + std.TestSkipHeights(5) + + gns.Approve(a2u(consts.POOL_ADDR), consts.POOL_CREATION_FEE) + std.TestSkipHeights(1) + + CreatePool(fooPath, barPath, fee500, "130621891405341611593710811006") // tick 10000 + shouldEQ(t, len(pools), 1) + std.TestSkipHeights(1) +} + +// 2. Create Bar:Baz Pool +func TestCreateBarBazPool(t *testing.T) { + // call gns faucet to get creation fee + std.TestSetPrevAddr(test1) + std.TestSetPrevAddr(test1) + gns.Faucet() + gns.Faucet() + gns.Faucet() + gns.Faucet() + gns.Faucet() + std.TestSkipHeights(5) + + gns.Approve(a2u(consts.POOL_ADDR), consts.POOL_CREATION_FEE) + std.TestSkipHeights(1) + + CreatePool(barPath, bazPath, fee500, "130621891405341611593710811006") // tick 10000 + shouldEQ(t, len(pools), 2) + std.TestSkipHeights(1) +} + +// 3. Mint Foo:Bar Liquidity by test1 +func TestMintFooBarLiquidity(t *testing.T) { + std.TestSetPrevAddr(test1) + foo.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) + bar.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) + std.TestSkipHeights(4) + + std.TestSetPrevRealm(consts.POSITION_PATH) + std.TestSetOrigCaller(test1) + amount0, amount1 := Mint( + barPath, + fooPath, + fee500, + consts.POSITION_ADDR.String(), + -11000, // -11000 + -9000, // -9000 + test_liquidityExpectStr, + ) + shouldEQ(t, amount0, "8040316") + shouldEQ(t, amount1, "2958014") + std.TestSkipHeights(1) +} + +// 4. Mint Bar:Baz Liquidity by test1 +func TestMintBarBazLiquidity(t *testing.T) { + std.TestSetPrevAddr(test1) + bar.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) + baz.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) + std.TestSkipHeights(2) + + std.TestSetPrevRealm(consts.POSITION_PATH) + std.TestSetOrigCaller(test1) + amount0, amount1 := Mint( + barPath, + bazPath, + fee500, + consts.POSITION_ADDR.String(), + test_tickLower, + test_tickUpper, + test_liquidityExpectStr, + ) + shouldEQ(t, amount0, "2958015") + shouldEQ(t, amount1, "8040315") + std.TestSkipHeights(1) +} + +// GETTER_API TEST +func TestApiGetPools(t *testing.T) { + gpls := ApiGetPools() + + root, err := json.Unmarshal([]byte(gpls)) + if err != nil { + panic(err) + } + + response, err := root.GetKey("response") + if err != nil { + panic(err) + } + + shouldEQ(t, response.Size(), 2) +} diff --git a/pool/_TEST_/z0_rpc_filetest.gno b/pool/_TEST_/z0_rpc_filetest.gno index 36d9c735..c05f4452 100644 --- a/pool/_TEST_/z0_rpc_filetest.gno +++ b/pool/_TEST_/z0_rpc_filetest.gno @@ -239,8 +239,11 @@ func mintFooBar() { -9000, // -9000 "100000000", ) - if amount0 != "8040316" || amount1 != "2958014" { - panic("mint foo bar") + if amount0 != "8040316" { + panic(amount0) + } + if amount1 != "2958015" { + panic(amount1) } } @@ -261,9 +264,13 @@ func mintBarBaz() { 11000, "100000000", ) - if amount0 != "2958015" || amount1 != "8040315" { - panic("mint bar baz") + if amount0 != "2958015" { + panic(amount0) + } + if amount1 != "8040316" { + panic(amount1) } + } func apiGetPools() { diff --git a/pool/_TEST_/z1_single_lp_filetest.gno b/pool/_TEST_/z1_single_lp_filetest.gno index f9c2c61d..38994a7b 100644 --- a/pool/_TEST_/z1_single_lp_filetest.gno +++ b/pool/_TEST_/z1_single_lp_filetest.gno @@ -236,8 +236,11 @@ func mint() { 11000, "1000", ) - if amount0 != "30" || amount1 != "80" { - panic("mint foo bar 1") + if amount0 != "30" { + panic(amount0) + } + if amount1 != "81" { + panic(amount1) } pool := pl.GetPool(barPath, fooPath, fee500) @@ -478,11 +481,14 @@ func collectProtocol() { std.TestSetPrevAddr(gsa) protocolFee0, protocolFee1 := pl.CollectProtocol(barPath, fooPath, fee500, test1.String(), "100000", "100000") - if protocolFee0 != "7" || protocolFee1 != "0" { - panic("collect protocol") + if protocolFee0 != "8" { + panic(protocolFee0) + } + if protocolFee1 != "0" { + panic(protocolFee1) } - } + func apiGetPools() { gpls := pl.ApiGetPools() diff --git a/pool/_TEST_/z2_native_swap_filetest.gno b/pool/_TEST_/z2_native_swap_filetest.gno index 16209d18..255a29f9 100644 --- a/pool/_TEST_/z2_native_swap_filetest.gno +++ b/pool/_TEST_/z2_native_swap_filetest.gno @@ -251,8 +251,11 @@ func mint() { test_tickUpper, "10000000", ) - if amount0 != "295802" || amount1 != "804031" { - panic("mint foo wugnot") + if amount0 != "295802" { + panic(amount0) + } + if amount1 != "804032" { + panic(amount1) } } diff --git a/pool/_TEST_/z3_dryswap_and_swap_filetest.gno b/pool/_TEST_/z3_dryswap_and_swap_filetest.gno index e1f3de25..6d09aa6b 100644 --- a/pool/_TEST_/z3_dryswap_and_swap_filetest.gno +++ b/pool/_TEST_/z3_dryswap_and_swap_filetest.gno @@ -255,8 +255,11 @@ func drySwap_ZeroForOneTrue_AmountSpecified_Positive_16000() { "16000", // amountSpecified consts.MIN_PRICE, // sqrtPriceLimitX96 ) - if !(poolIn == "16000" && poolOut == "-5883") { - panic("expected 16000, -5883") + if poolIn != "16000" { + panic("expected poolIn 16000") + } + if poolOut != "-5883" { + panic("expected poolOut -5883") } } @@ -271,8 +274,11 @@ func drySwap_ZeroForOneTrue_AmountSpecified_Negative_16000() { "-16000", // amountSpecified consts.MIN_PRICE, // sqrtPriceLimitX96 ) - if !(poolIn == "43512" && poolOut == "-16000") { - panic("expected 43512, -16000") + if poolIn != "43513" { + panic("expected poolIn 43513") + } + if poolOut != "-16000" { + panic("expected poolOut -16000") } } @@ -287,8 +293,11 @@ func drySwap_ZeroForOneFalse_AmountSpecified_Positive_16000() { "16000", // amountSpecified consts.MAX_PRICE, // sqrtPriceLimitX96 ) - if !(poolIn == "-43468" && poolOut == "16000") { - panic("expected -43468, 16000") + if poolIn != "-43468" { + panic("expected poolIn -43468") + } + if poolOut != "16000" { + panic("expected poolOut 16000") } } @@ -303,7 +312,10 @@ func drySwap_ZeroForOneFalse_AmountSpecified_Negative_16000() { "-16000", // amountSpecified consts.MAX_PRICE, // sqrtPriceLimitX96 ) - if !(poolIn == "-16000" && poolOut == "5888") { - panic("expected -16000, 5888") + if poolIn != "-16000" { + panic(poolIn) + } + if poolOut != "5890" { + panic("expected poolOut 5890") } } diff --git a/position/_TEST_0_INIT_FAUCET_test.gno b/position/_TEST_0_INIT_FAUCET_test.gno new file mode 100644 index 00000000..1991c811 --- /dev/null +++ b/position/_TEST_0_INIT_FAUCET_test.gno @@ -0,0 +1,25 @@ +package position + +import ( + "std" + + "gno.land/r/demo/bar" + "gno.land/r/demo/baz" + "gno.land/r/demo/foo" + "gno.land/r/demo/obl" + "gno.land/r/demo/qux" +) + +func init() { + std.TestSetPrevAddr(test1) + + // GIVE 100_000_000_000(u) ≈ 100_000 + for i := 0; i < 100; i++ { + foo.Faucet() + bar.Faucet() + baz.Faucet() + qux.Faucet() + obl.Faucet() + //gns.Faucet() + } +} diff --git a/position/_TEST_0_INIT_TOKEN_REGISTER_test.gno b/position/_TEST_0_INIT_TOKEN_REGISTER_test.gno new file mode 100644 index 00000000..6699bba9 --- /dev/null +++ b/position/_TEST_0_INIT_TOKEN_REGISTER_test.gno @@ -0,0 +1,145 @@ +package position + +import ( + "std" + + "gno.land/r/demo/foo" + + "gno.land/r/demo/bar" + + "gno.land/r/demo/baz" + + "gno.land/r/demo/qux" + + "gno.land/r/demo/wugnot" + + "gno.land/r/demo/obl" + + "gno.land/r/demo/gns" + + "gno.land/r/demo/gnoswap/consts" + + pusers "gno.land/p/demo/users" + + pl "gno.land/r/demo/pool" +) + +type FooToken struct{} + +func (FooToken) Transfer() func(to pusers.AddressOrName, amount uint64) { + return foo.Transfer +} +func (FooToken) TransferFrom() func(from, to pusers.AddressOrName, amount uint64) { + return foo.TransferFrom +} +func (FooToken) BalanceOf() func(owner pusers.AddressOrName) uint64 { + return foo.BalanceOf +} +func (FooToken) Approve() func(spender pusers.AddressOrName, amount uint64) { + return foo.Approve +} + +type BarToken struct{} + +func (BarToken) Transfer() func(to pusers.AddressOrName, amount uint64) { + return bar.Transfer +} +func (BarToken) TransferFrom() func(from, to pusers.AddressOrName, amount uint64) { + return bar.TransferFrom +} +func (BarToken) BalanceOf() func(owner pusers.AddressOrName) uint64 { + return bar.BalanceOf +} +func (BarToken) Approve() func(spender pusers.AddressOrName, amount uint64) { + return bar.Approve +} + +type BazToken struct{} + +func (BazToken) Transfer() func(to pusers.AddressOrName, amount uint64) { + return baz.Transfer +} +func (BazToken) TransferFrom() func(from, to pusers.AddressOrName, amount uint64) { + return baz.TransferFrom +} +func (BazToken) BalanceOf() func(owner pusers.AddressOrName) uint64 { + return baz.BalanceOf +} +func (BazToken) Approve() func(spender pusers.AddressOrName, amount uint64) { + return baz.Approve +} + +type QuxToken struct{} + +func (QuxToken) Transfer() func(to pusers.AddressOrName, amount uint64) { + return qux.Transfer +} +func (QuxToken) TransferFrom() func(from, to pusers.AddressOrName, amount uint64) { + return qux.TransferFrom +} +func (QuxToken) BalanceOf() func(owner pusers.AddressOrName) uint64 { + return qux.BalanceOf +} +func (QuxToken) Approve() func(spender pusers.AddressOrName, amount uint64) { + return qux.Approve +} + +type WugnotToken struct{} + +func (WugnotToken) Transfer() func(to pusers.AddressOrName, amount uint64) { + return wugnot.Transfer +} +func (WugnotToken) TransferFrom() func(from, to pusers.AddressOrName, amount uint64) { + return wugnot.TransferFrom +} +func (WugnotToken) BalanceOf() func(owner pusers.AddressOrName) uint64 { + return wugnot.BalanceOf +} +func (WugnotToken) Approve() func(spender pusers.AddressOrName, amount uint64) { + return wugnot.Approve +} + +type OBLToken struct{} + +func (OBLToken) Transfer() func(to pusers.AddressOrName, amount uint64) { + return obl.Transfer +} +func (OBLToken) TransferFrom() func(from, to pusers.AddressOrName, amount uint64) { + return obl.TransferFrom +} +func (OBLToken) BalanceOf() func(owner pusers.AddressOrName) uint64 { + return obl.BalanceOf +} +func (OBLToken) Approve() func(spender pusers.AddressOrName, amount uint64) { + return obl.Approve +} + +type GNSToken struct{} + +func (GNSToken) Transfer() func(to pusers.AddressOrName, amount uint64) { + return gns.Transfer +} + +func (GNSToken) TransferFrom() func(from, to pusers.AddressOrName, amount uint64) { + return gns.TransferFrom +} + +func (GNSToken) BalanceOf() func(owner pusers.AddressOrName) uint64 { + return gns.BalanceOf +} + +func (GNSToken) Approve() func(spender pusers.AddressOrName, amount uint64) { + return gns.Approve +} + +func init() { + std.TestSetOrigCaller(consts.GNOSWAP_ADMIN) + + pl.RegisterGRC20Interface("gno.land/r/demo/bar", BarToken{}) + pl.RegisterGRC20Interface("gno.land/r/demo/foo", FooToken{}) + pl.RegisterGRC20Interface("gno.land/r/demo/baz", BazToken{}) + pl.RegisterGRC20Interface("gno.land/r/demo/qux", QuxToken{}) + pl.RegisterGRC20Interface("gno.land/r/demo/wugnot", WugnotToken{}) + pl.RegisterGRC20Interface("gno.land/r/demo/obl", OBLToken{}) + pl.RegisterGRC20Interface("gno.land/r/demo/gns", GNSToken{}) +} diff --git a/position/_TEST_0_INIT_VARS_HELPERS_test.gno b/position/_TEST_0_INIT_VARS_HELPERS_test.gno new file mode 100644 index 00000000..482dcb5e --- /dev/null +++ b/position/_TEST_0_INIT_VARS_HELPERS_test.gno @@ -0,0 +1,94 @@ +package position + +import ( + "std" + "testing" + + "gno.land/r/demo/gnoswap/consts" + + "gno.land/r/demo/gnft" + + pl "gno.land/r/demo/pool" +) + +var ( + gsa std.Address = consts.GNOSWAP_ADMIN + test1 std.Address = std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") + + fooPath string = "gno.land/r/demo/foo" + barPath string = "gno.land/r/demo/bar" + bazPath string = "gno.land/r/demo/baz" + quxPath string = "gno.land/r/demo/qux" + + oblPath string = "gno.land/r/demo/obl" + // wugnotPath string = "gno.land/r/demo/wugnot" // from consts + // gnsPath string = "gno.land/r/demo/gns" // from consts + + fee100 uint32 = 100 + fee500 uint32 = 500 + fee3000 uint32 = 3000 + + max_timeout int64 = 9999999999 +) + +/* HELPER */ +func shouldEQ(t *testing.T, got, expected interface{}) { + if got != expected { + t.Errorf("got %v, expected %v", got, expected) + } +} + +func shouldNEQ(t *testing.T, got, expected interface{}) { + if got == expected { + t.Errorf("got %v, didn't expected %v", got, expected) + } +} + +func shouldGT(t *testing.T, l, r interface{}) { + if !(l < r) { + t.Errorf("expected %v < %v", l, r) + } +} + +func shouldLT(t *testing.T, l, r interface{}) { + if !(l > r) { + t.Errorf("expected %v > %v", l, r) + } +} + +func shouldPanic(t *testing.T, f func()) { + defer func() { + if r := recover(); r == nil { + t.Errorf("expected panic") + } + }() + f() +} + +func ugnotBalanceOf(addr std.Address) uint64 { + testBanker := std.GetBanker(std.BankerTypeRealmIssue) + + coins := testBanker.GetCoins(addr) + if len(coins) == 0 { + return 0 + } + + return uint64(testBanker.GetCoins(addr)[0].Amount) +} + +func isOwner(t *testing.T, tokenId uint64, addr std.Address) bool { + owner := gnft.OwnerOf(tid(tokenId)) + + if owner == addr { + return true + } + + t.Errorf("expected owner %v, got %v", addr, owner) + return false +} + +func getPoolFromLpTokenId(lpTokenId uint64) *pl.Pool { + position := positions[lpTokenId] + + return pl.GetPoolFromPoolPath(position.poolKey) +} diff --git a/position/_TEST_position_full_test.gno b/position/_TEST_position_full_test.gno new file mode 100644 index 00000000..c897d64e --- /dev/null +++ b/position/_TEST_position_full_test.gno @@ -0,0 +1,66 @@ +package position + +import ( + // @notJoon JSON + "std" + "testing" + + "gno.land/r/demo/gnoswap/common" + "gno.land/r/demo/gnoswap/consts" + + pl "gno.land/r/demo/pool" + + "gno.land/r/demo/bar" + "gno.land/r/demo/foo" + + "gno.land/r/demo/gns" + + i256 "gno.land/p/demo/gnoswap/int256" +) + +func TestPoolInitCreatePool(t *testing.T) { + std.TestSetPrevAddr(test1) + gns.Faucet() + gns.Faucet() + gns.Faucet() + gns.Faucet() + gns.Faucet() + + gns.Approve(a2u(consts.POOL_ADDR), consts.POOL_CREATION_FEE) + pl.CreatePool(barPath, fooPath, fee500, common.TickMathGetSqrtRatioAtTick(1).ToString()) +} + +func TestMintPositionFullInRange(t *testing.T) { + std.TestSetPrevAddr(test1) + bar.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) + foo.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) + + tokenId, liquidity, amount0, amount1 := Mint( + barPath, + fooPath, + fee500, + -887270, + 887270, + "50000", + "50000", + "0", + "0", + max_timeout, + test1.String(), + ) + shouldEQ(t, tokenId, 1) + shouldEQ(t, getNextId(), 2) + + position := positions[tokenId] + + currentX96 := common.TickMathGetSqrtRatioAtTick(1) + lowerX96 := common.TickMathGetSqrtRatioAtTick(position.tickLower) + upperX96 := common.TickMathGetSqrtRatioAtTick(position.tickUpper) + + token0Balance, token1Balance := common.GetAmountsForLiquidity( + currentX96, + lowerX96, + upperX96, + i256.FromUint256(position.liquidity), + ) +} diff --git a/position/sqrt_price_math.gno b/position/sqrt_price_math.gno deleted file mode 100644 index bcf980ca..00000000 --- a/position/sqrt_price_math.gno +++ /dev/null @@ -1,182 +0,0 @@ -package position - -import ( - "gno.land/r/demo/gnoswap/consts" - - i256 "gno.land/p/demo/gnoswap/int256" - u256 "gno.land/p/demo/gnoswap/uint256" -) - -func sqrtPriceMathGetNextSqrtPriceFromAmount0RoundingUp( - sqrtPX96 *u256.Uint, // uint160 - liquidity *u256.Uint, // uint128 - amount *u256.Uint, // uint256 - add bool, -) *u256.Uint { // uint160 - if amount.IsZero() { - return sqrtPX96 - } - - numerator1 := new(u256.Uint).Lsh(liquidity, 96) - product := new(u256.Uint).Mul(amount, sqrtPX96) - - if add { - if new(u256.Uint).Div(product, amount).Eq(sqrtPX96) { - denominator := new(u256.Uint).Add(numerator1, product) - - if denominator.Gte(numerator1) { - return u256.MulDiv(numerator1, sqrtPX96, denominator) - } - } - - _value1 := new(u256.Uint).Div(numerator1, sqrtPX96) - _value2 := new(u256.Uint).Add(_value1, amount) - return u256.DivRoundingUp(numerator1, _value2) - } else { - cond1 := new(u256.Uint).Div(product, amount).Eq(sqrtPX96) - cond2 := numerator1.Gt(product) - - if !(cond1 && cond2) { - panic("position_sqrt price math #1") - } - denominator := new(u256.Uint).Sub(numerator1, product) - - return u256.MulDiv(numerator1, sqrtPX96, denominator) - } -} - -func sqrtPriceMathGetNextSqrtPriceFromAmount1RoundingDown( - sqrtPX96 *u256.Uint, // uint160 - liquidity *u256.Uint, // uint1288 - amount *u256.Uint, // uint256 - add bool, -) *u256.Uint { // uint160 - quotient := u256.Zero() - - if !(amount.Lte(u256.MustFromDecimal(consts.MAX_UINT160))) { - quotient = u256.MulDiv(amount, u256.MustFromDecimal(consts.Q96), liquidity) - } - - if add { - if amount.Lte(u256.MustFromDecimal(consts.MAX_UINT160)) { - quotient = new(u256.Uint).Lsh(amount, 96) - quotient = new(u256.Uint).Div(quotient, liquidity) - } - - quotient = new(u256.Uint).Sub(quotient, u256.One()) - return new(u256.Uint).Add(sqrtPX96, quotient) - } else { - if amount.Lte(u256.MustFromDecimal(consts.MAX_UINT160)) { - quotient = new(u256.Uint).Lsh(amount, 96) - quotient = u256.DivRoundingUp(quotient, liquidity) - } - - if !(sqrtPX96.Gt(quotient)) { - panic("position_sqrt price math #2") - } - - // roundDown - quotient = new(u256.Uint).Sub(quotient, u256.One()) - return new(u256.Uint).Sub(sqrtPX96, quotient) - } -} - -func sqrtPriceMathGetNextSqrtPriceFromInput( - sqrtPX96 *u256.Uint, // uint160 - liquidity *u256.Uint, // uint128 - amountIn *u256.Uint, // uint256 - zeroForOne bool, // bool -) *u256.Uint { // uint160 - if zeroForOne { - return sqrtPriceMathGetNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity, amountIn, true) - } - return sqrtPriceMathGetNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity, amountIn, true) -} - -func sqrtPriceMathGetNextSqrtPriceFromOutput( - sqrtPX96 *u256.Uint, // uint160 - liquidity *u256.Uint, // uint128 - amountOut *u256.Uint, // uint256 - zeroForOne bool, // bool -) *u256.Uint { // uint160 - if zeroForOne { - return sqrtPriceMathGetNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity, amountOut, false) - } - - return sqrtPriceMathGetNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity, amountOut, false) -} - -func sqrtPriceMathGetAmount0DeltaHelper( - sqrtRatioAX96 *u256.Uint, // uint160 - sqrtRatioBX96 *u256.Uint, // uint160 - liquidity *u256.Uint, // uint160 - roundUp bool, -) *u256.Uint { // uint256 - if sqrtRatioAX96.Gt(sqrtRatioBX96) { - sqrtRatioAX96, sqrtRatioBX96 = sqrtRatioBX96, sqrtRatioAX96 - } - - if !(sqrtRatioAX96.Gt(u256.Zero())) { - panic("position_sqrt price math #3") - } - - numerator1 := new(u256.Uint).Lsh(liquidity, 96) - numerator2 := new(u256.Uint).Sub(sqrtRatioBX96, sqrtRatioAX96) - value := u256.MulDiv(numerator1, numerator2, sqrtRatioBX96) - - if roundUp { - return u256.DivRoundingUp(value, sqrtRatioAX96) - } else { - return new(u256.Uint).Div(value, sqrtRatioAX96) - } - -} - -func sqrtPriceMathGetAmount1DeltaHelper( - sqrtRatioAX96 *u256.Uint, // uint160 - sqrtRatioBX96 *u256.Uint, // uint160 - liquidity *u256.Uint, // uint160 - roundUp bool, -) *u256.Uint { // uint256 - if sqrtRatioAX96.Gt(sqrtRatioBX96) { - sqrtRatioAX96, sqrtRatioBX96 = sqrtRatioBX96, sqrtRatioAX96 - } - - value := new(u256.Uint).Sub(sqrtRatioBX96, sqrtRatioAX96) - - if roundUp { - return u256.MulDiv(liquidity, value, u256.MustFromDecimal(consts.Q96)) - } else { - return u256.MulDiv(liquidity, value, u256.MustFromDecimal(consts.Q96)) - } -} - -func sqrtPriceMathGetAmount0Delta( - sqrtRatioAX96 *u256.Uint, // uint160 - sqrtRatioBX96 *u256.Uint, // uint160 - liquidity *i256.Int, // int128 -) *i256.Int { // int256 - - if liquidity.IsNeg() { - u := sqrtPriceMathGetAmount0DeltaHelper(sqrtRatioAX96, sqrtRatioBX96, liquidity.Abs(), false) - i := i256.FromUint256(u) - return i256.Zero().Neg(i) - } - u := sqrtPriceMathGetAmount0DeltaHelper(sqrtRatioAX96, sqrtRatioBX96, liquidity.Abs(), true) - return i256.FromUint256(u) -} - -func sqrtPriceMathGetAmount1Delta( - sqrtRatioAX96 *u256.Uint, // uint160 - sqrtRatioBX96 *u256.Uint, // uint160 - liquidity *i256.Int, // int128 -) *i256.Int { // int256 - if liquidity.IsNeg() { - u := sqrtPriceMathGetAmount1DeltaHelper(sqrtRatioAX96, sqrtRatioBX96, liquidity.Abs(), false) - i := i256.FromUint256(u) - return i256.Zero().Neg(i) - } - - u := sqrtPriceMathGetAmount1DeltaHelper(sqrtRatioAX96, sqrtRatioBX96, liquidity.Abs(), true) - return i256.FromUint256(u) -} diff --git a/router/_TEST_/z2_swap_route_1route_1hop_filetest.gno b/router/_TEST_/z2_swap_route_1route_1hop_filetest.gno index 64a078ce..fdbc0cba 100644 --- a/router/_TEST_/z2_swap_route_1route_1hop_filetest.gno +++ b/router/_TEST_/z2_swap_route_1route_1hop_filetest.gno @@ -237,8 +237,11 @@ func mint() { std.TestSetPrevRealm(consts.STAKER_PATH) _, _, amount0, amount1 := pn.Mint(barPath, bazPath, fee500, int32(9000), int32(11000), "100000", "100000", "0", "0", maxTimeout, test1.String()) - if !(amount0 == "36790" && amount1 == "99999") { - panic("amount0 and amount1 should be 36790 and 99999") + if amount0 != "36790" { + "router_z2_mint() || amount0 should be 36790" + } + if amount1 != "100000" { + "router_z2_mint() || amount1 should be 100000" } } @@ -254,7 +257,7 @@ func drySwapBarBazExactIn() { "100", // quoteArr ) if dryResult != "2711" { - panic("dryResult should be 2711") + panic("router_z2_drySwapBarBazExactIn() || dryResult should be 2711") } } @@ -273,12 +276,11 @@ func swapBarBazExactIn() { "100", // quoteArr "2700", // tokenAmountLimit ) - if amountIn != "1000" { - panic("amountIn should be 1000") + "router_z2_swapBarBazExactIn() || amountIn should be 1000" } if amountOut != "-2707" { - panic("amountOut should be -2707") + "router_z2_swapBarBazExactIn() || amountOut should be -2707" } } @@ -293,8 +295,8 @@ func drySwapBarBazExactOut() { "gno.land/r/demo/bar:gno.land/r/demo/baz:500", // strRouteArr "100", // quoteArr ) - if dryResult != "370" { - panic("dryResult should be 370") + if dryResult != "371" { + panic("router_z2_drySwapBarBazExactOut() || dryResult should be 371") } } @@ -311,13 +313,13 @@ func swapBarBazExactOut() { "EXACT_OUT", // swapType "gno.land/r/demo/bar:gno.land/r/demo/baz:500", // strRouteArr "100", // quoteArr - "370", // tokenAmountLimit + "371", // tokenAmountLimit ) - if amountIn != "370" { - panic("amountIn should be 370") + if amountIn != "371" { + "router_z2_swapBarBazExactOut() || amountIn should be 371" } - if amountOut != "-999" { - panic("amountOut should be -999") + if amountOut != "-1000" { + "router_z2_swapBarBazExactOut() || amountOut should be -1000" } } @@ -333,7 +335,7 @@ func drySwapBazBarExactIn() { "100", // quoteArr ) if dryResult != "368" { - panic("dryResult should be 368") + panic("router_z2_drySwapBazBarExactIn() || dryResult should be 368") } } @@ -353,10 +355,10 @@ func swapBazBarExactIn() { "360", // tokenAmountLimit ) if amountIn != "1000" { - panic("amountIn should be 1000") + "router_z2_swapBarBazExactOut() || amountIn should be 1000" } if amountOut != "-368" { - panic("amountOut should be -368") + "router_z2_swapBarBazExactOut() || amountOut should be -368" } } @@ -371,8 +373,8 @@ func drySwapBazBarExactOut() { "gno.land/r/demo/baz:gno.land/r/demo/bar:500", // strRouteArr "100", // quoteArr ) - if dryResult != "8169" { - panic("dryResult should be 8169") + if dryResult != "8171" { + panic("router_z2_drySwapBazBarExactOut() || dryResult should be 8171") } } @@ -389,10 +391,11 @@ func swapBazBarExactOut() { "100", // quoteArr "8200", // tokenAmountLimit ) - if amountIn != "8169" { - panic("amountIn should be 8169") + if amountIn != "8171" { + "router_z2_swapBazBarExactOut() || amountIn should be 8171" } if amountOut != "-2996" { - panic("amountOut should be -2996") + panic(amountOut) + "router_z2_swapBazBarExactOut() || amountOut should be -2996" } } diff --git a/router/_TEST_/z3_swap_route_1route_1hop_out_range_filetest.gno b/router/_TEST_/z3_swap_route_1route_1hop_out_range_filetest.gno index ca1c8e99..41640c5c 100644 --- a/router/_TEST_/z3_swap_route_1route_1hop_out_range_filetest.gno +++ b/router/_TEST_/z3_swap_route_1route_1hop_out_range_filetest.gno @@ -231,8 +231,12 @@ func mint() { std.TestSetPrevRealm(consts.STAKER_PATH) _, _, amount0, amount1 := pn.Mint(barPath, bazPath, fee500, int32(12000), int32(15000), "100000", "100000", "0", "0", maxTimeout, test1.String()) - if !(amount0 == "100000" && amount1 == "0") { // only bar, no baz - panic("amount0 and amount1 should be 100000 and 0") + // only bar, no baz + if amount0 != "36790" { + "router_z3_mint() || amount0 should be 10000" + } + if amount1 != "100000" { + "router_z3_mint() || amount1 should be 0" } } @@ -248,7 +252,7 @@ func drySwapBarBazExactIn() { "100", // quoteArr ) if dryResult != "-1" { - panic("dryResult should be -1") + panic("router_z3_drySwapBarBazExactIn() || dryResult should be -1") } } diff --git a/router/_TEST_/z4_swap_route_1route_1hop_native_in_out_filetest.gno b/router/_TEST_/z4_swap_route_1route_1hop_native_in_out_filetest.gno index 79010e83..c32d962f 100644 --- a/router/_TEST_/z4_swap_route_1route_1hop_native_in_out_filetest.gno +++ b/router/_TEST_/z4_swap_route_1route_1hop_native_in_out_filetest.gno @@ -238,10 +238,10 @@ func mintBarBaz() { std.TestSetPrevRealm(consts.STAKER_PATH) _, _, amount0, amount1 := pn.Mint(barPath, bazPath, fee500, int32(9000), int32(11000), "100000", "100000", "0", "0", maxTimeout, test1.String()) if amount0 != "36790" { - panic("amount0 should be 36790") + "router_z4_mintBarBaz() || amount0 should be 36790" } - if amount1 != "99999" { - panic("amount1 should be 99999") + if amount1 != "100000" { + "router_z4_mintBarBaz() || amount1 should be 100000" } } @@ -253,10 +253,10 @@ func mintBazQux() { std.TestSetPrevRealm(consts.STAKER_PATH) _, _, amount0, amount1 := pn.Mint(bazPath, quxPath, fee500, int32(9000), int32(11000), "100000", "100000", "0", "0", maxTimeout, test1.String()) if amount0 != "36790" { - panic("amount0 should be 36790") + "router_z4_mintBazQux() || amount0 should be 36790" } - if amount1 != "99999" { - panic("amount1 should be 99999") + if amount1 != "100000" { + "router_z4_mintBazQux() || amount1 should be 100000" } } @@ -279,10 +279,10 @@ func mintQuxGnot() { std.TestSetPrevRealm(consts.STAKER_PATH) _, _, amount0, amount1 := pn.Mint(quxPath, consts.WRAPPED_WUGNOT, fee500, int32(9000), int32(11000), "100000", "100000", "0", "0", maxTimeout, test1.String()) if amount0 != "36790" { - panic("amount0 should be 36790") + "router_z4_mintQuxGnot() || amount0 should be 36790" } - if amount1 != "99999" { - panic("amount1 should be 99999") + if amount1 != "100000" { + "router_z4_mintQuxGnot() || amount1 should be 100000" } } @@ -298,7 +298,7 @@ func drySwapBarGnotExactIn() { "100", // quoteArr ) if dryResult != "19740" { - panic("dryResult should be 19740") + panic("router_z4_drySwapBarGnotExactIn() || dryResult should be 19740") } } @@ -313,8 +313,8 @@ func drySwapBarGnotExactOut() { "gno.land/r/demo/bar:gno.land/r/demo/baz:500*POOL*gno.land/r/demo/baz:gno.land/r/demo/qux:500*POOL*gno.land/r/demo/qux:gno.land/r/demo/wugnot:500", // strRouteArr "100", // quoteArr ) - if dryResult != "1012" { - panic("dryResult should be 1012") + if dryResult != "1014" { + panic("router_z4_drySwapBarGnotExactOut() || dryResult should be 1014") } } @@ -330,7 +330,7 @@ func drySwapGnotBarExactIn() { "100", // quoteArr ) if dryResult != "247" { - panic("dryResult should be 247") + panic("router_z4_drySwapGnotBarExactIn() || dryResult should be 247") } } @@ -345,7 +345,10 @@ func drySwapGnotBarExactOut() { "gno.land/r/demo/wugnot:gno.land/r/demo/qux:500*POOL*gno.land/r/demo/qux:gno.land/r/demo/baz:500*POOL*gno.land/r/demo/baz:gno.land/r/demo/bar:500", // strRouteArr "100", // quoteArr ) - if dryResult != "2003" { - panic("dryResult should be 2003") + if dryResult != "2027" { + panic("router_z4_drySwapGnotBarExactOut() || dryResult should be 2027") } } + +// Output: +// diff --git a/router/_TEST_/z5_swap_route_1route_2hop_wrapped_middle_filetest.gno b/router/_TEST_/z5_swap_route_1route_2hop_wrapped_middle_filetest.gno index 91e72094..d4fbac73 100644 --- a/router/_TEST_/z5_swap_route_1route_2hop_wrapped_middle_filetest.gno +++ b/router/_TEST_/z5_swap_route_1route_2hop_wrapped_middle_filetest.gno @@ -247,10 +247,10 @@ func mintGnsGnot() { std.TestSetPrevRealm(consts.STAKER_PATH) _, _, amount0, amount1 := pn.Mint(consts.GNS_PATH, consts.WRAPPED_WUGNOT, fee100, int32(9000), int32(11000), "100000", "100000", "0", "0", maxTimeout, test1.String()) if amount0 != "36790" { - panic("amount0 should be 36790") + "router_z5_mintGnsGnot() || amount0 should be 36790" } - if amount1 != "99999" { - panic("amount1 should be 99999") + if amount1 != "100000" { + "router_z5_mintGnsGnot() || amount1 should be 100000" } } diff --git a/router/_TEST_/z6_dry_and_swap_filetest.gno b/router/_TEST_/z6_dry_and_swap_filetest.gno new file mode 100644 index 00000000..d3b7781e --- /dev/null +++ b/router/_TEST_/z6_dry_and_swap_filetest.gno @@ -0,0 +1,510 @@ +package main + +import ( + "std" + "testing" + + "gno.land/r/demo/bar" + "gno.land/r/demo/baz" + "gno.land/r/demo/foo" + "gno.land/r/demo/gns" + "gno.land/r/demo/obl" + "gno.land/r/demo/qux" + "gno.land/r/demo/wugnot" + + pusers "gno.land/p/demo/users" + + "gno.land/r/demo/gnoswap/common" + "gno.land/r/demo/gnoswap/consts" + + pl "gno.land/r/demo/pool" + pn "gno.land/r/demo/position" + rr "gno.land/r/demo/router" +) + +var ( + gsa std.Address = consts.GNOSWAP_ADMIN + test1 std.Address = std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") + + fooPath string = "gno.land/r/demo/foo" + barPath string = "gno.land/r/demo/bar" + bazPath string = "gno.land/r/demo/baz" + quxPath string = "gno.land/r/demo/qux" + + oblPath string = "gno.land/r/demo/obl" + + fee100 uint32 = 100 + fee500 uint32 = 500 + fee3000 uint32 = 3000 + + maxTimeout int64 = 9999999999 + + maxApprove uint64 = 18446744073709551615 + + // TESTING + t *testing.T +) + +type FooToken struct{} + +func (FooToken) Transfer() func(to pusers.AddressOrName, amount uint64) { + return foo.Transfer +} +func (FooToken) TransferFrom() func(from, to pusers.AddressOrName, amount uint64) { + return foo.TransferFrom +} +func (FooToken) BalanceOf() func(owner pusers.AddressOrName) uint64 { + return foo.BalanceOf +} +func (FooToken) Approve() func(spender pusers.AddressOrName, amount uint64) { + return foo.Approve +} + +type BarToken struct{} + +func (BarToken) Transfer() func(to pusers.AddressOrName, amount uint64) { + return bar.Transfer +} +func (BarToken) TransferFrom() func(from, to pusers.AddressOrName, amount uint64) { + return bar.TransferFrom +} +func (BarToken) BalanceOf() func(owner pusers.AddressOrName) uint64 { + return bar.BalanceOf +} +func (BarToken) Approve() func(spender pusers.AddressOrName, amount uint64) { + return bar.Approve +} + +type BazToken struct{} + +func (BazToken) Transfer() func(to pusers.AddressOrName, amount uint64) { + return baz.Transfer +} +func (BazToken) TransferFrom() func(from, to pusers.AddressOrName, amount uint64) { + return baz.TransferFrom +} +func (BazToken) BalanceOf() func(owner pusers.AddressOrName) uint64 { + return baz.BalanceOf +} +func (BazToken) Approve() func(spender pusers.AddressOrName, amount uint64) { + return baz.Approve +} + +type QuxToken struct{} + +func (QuxToken) Transfer() func(to pusers.AddressOrName, amount uint64) { + return qux.Transfer +} +func (QuxToken) TransferFrom() func(from, to pusers.AddressOrName, amount uint64) { + return qux.TransferFrom +} +func (QuxToken) BalanceOf() func(owner pusers.AddressOrName) uint64 { + return qux.BalanceOf +} +func (QuxToken) Approve() func(spender pusers.AddressOrName, amount uint64) { + return qux.Approve +} + +type WugnotToken struct{} + +func (WugnotToken) Transfer() func(to pusers.AddressOrName, amount uint64) { + return wugnot.Transfer +} +func (WugnotToken) TransferFrom() func(from, to pusers.AddressOrName, amount uint64) { + return wugnot.TransferFrom +} +func (WugnotToken) BalanceOf() func(owner pusers.AddressOrName) uint64 { + return wugnot.BalanceOf +} +func (WugnotToken) Approve() func(spender pusers.AddressOrName, amount uint64) { + return wugnot.Approve +} + +type OBLToken struct{} + +func (OBLToken) Transfer() func(to pusers.AddressOrName, amount uint64) { + return obl.Transfer +} +func (OBLToken) TransferFrom() func(from, to pusers.AddressOrName, amount uint64) { + return obl.TransferFrom +} +func (OBLToken) BalanceOf() func(owner pusers.AddressOrName) uint64 { + return obl.BalanceOf +} +func (OBLToken) Approve() func(spender pusers.AddressOrName, amount uint64) { + return obl.Approve +} + +type GNSToken struct{} + +func (GNSToken) Transfer() func(to pusers.AddressOrName, amount uint64) { + return gns.Transfer +} + +func (GNSToken) TransferFrom() func(from, to pusers.AddressOrName, amount uint64) { + return gns.TransferFrom +} + +func (GNSToken) BalanceOf() func(owner pusers.AddressOrName) uint64 { + return gns.BalanceOf +} + +func (GNSToken) Approve() func(spender pusers.AddressOrName, amount uint64) { + return gns.Approve +} + +/* HELPER FUNCTIONS */ +func a2u(addr std.Address) pusers.AddressOrName { + return pusers.AddressOrName(addr) +} + +func ugnotBalanceOf(addr std.Address) uint64 { + testBanker := std.GetBanker(std.BankerTypeRealmIssue) + + coins := testBanker.GetCoins(addr) + if len(coins) == 0 { + return 0 + } + + return uint64(testBanker.GetCoins(addr)[0].Amount) +} + +func init() { + // FAUCET + std.TestSetPrevAddr(test1) + + for i := 0; i < 100; i++ { + foo.Faucet() + bar.Faucet() + baz.Faucet() + qux.Faucet() + obl.Faucet() + } + + // TOKEN REGISTER + std.TestSetPrevAddr(gsa) + pl.RegisterGRC20Interface("gno.land/r/demo/foo", FooToken{}) + pl.RegisterGRC20Interface("gno.land/r/demo/bar", BarToken{}) + pl.RegisterGRC20Interface("gno.land/r/demo/baz", BazToken{}) + pl.RegisterGRC20Interface("gno.land/r/demo/qux", QuxToken{}) + pl.RegisterGRC20Interface("gno.land/r/demo/obl", OBLToken{}) + pl.RegisterGRC20Interface("gno.land/r/demo/wugnot", WugnotToken{}) + pl.RegisterGRC20Interface("gno.land/r/demo/gns", GNSToken{}) + + rr.RegisterGRC20Interface("gno.land/r/demo/foo", FooToken{}) + rr.RegisterGRC20Interface("gno.land/r/demo/bar", BarToken{}) + rr.RegisterGRC20Interface("gno.land/r/demo/baz", BazToken{}) + rr.RegisterGRC20Interface("gno.land/r/demo/qux", QuxToken{}) + rr.RegisterGRC20Interface("gno.land/r/demo/obl", OBLToken{}) + rr.RegisterGRC20Interface("gno.land/r/demo/wugnot", WugnotToken{}) + rr.RegisterGRC20Interface("gno.land/r/demo/gns", GNSToken{}) +} + +/* START TEST */ +func main() { + createPool() + mintBarBaz() + mintBazFoo() + mintFooQux() + + drySwapBarBazExactIn() + swapBarBazExactIn() + + drySwapBazBarExactIn() + swapBazBarExactIn() + + drySwapBarBazExactOut() + swapBarBazExactOut() + + drySwapBarQuxExactIn() + swapBarQuxExactIn() + + drySwapQuxBarExactOut() + swapQuxBarExactOut() + +} + +func createPool() { + numPool := uint64(3) + + // call gns faucet to get creation fee + std.TestSetPrevAddr(test1) + + for i := uint64(0); i < (5 * numPool); i++ { + gns.Faucet() + std.TestSkipHeights(1) + } + + gns.Approve(a2u(consts.POOL_ADDR), consts.POOL_CREATION_FEE*numPool) + std.TestSkipHeights(1) + + // tick = 10_000, ratio = 2.71814592682522526700950038502924144268035888671875 + + // 1 BAR ≈ 2.7 BAZ + // 1 BAR ≈ 7.29 FOO + // 1 BAR ≈ 19.683 QUX + + // 1 BAZ = 0.37 BAR + // 1 BAZ = 2.7 FOO + // 1 BAZ = 7.29 QUX + + // 1 QUX = 0.05 BAR + // 1 QUX = 0.13 BAZ + // 1 QUX = 0.37 FOO + pl.CreatePool(barPath, bazPath, fee100, common.TickMathGetSqrtRatioAtTick(10_000).ToString()) + pl.CreatePool(bazPath, fooPath, fee100, common.TickMathGetSqrtRatioAtTick(10_000).ToString()) + pl.CreatePool(fooPath, quxPath, fee100, common.TickMathGetSqrtRatioAtTick(10_000).ToString()) + +} + +func mintBarBaz() { + std.TestSetPrevAddr(test1) + bar.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) + baz.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) + + std.TestSetPrevRealm(consts.STAKER_PATH) + _, _, amount0, amount1 := pn.Mint(barPath, bazPath, fee100, int32(9000), int32(11000), "100000000", "100000000", "0", "0", maxTimeout, test1.String()) + if amount0 != "36789784" { + panic("router_z6_mintBarBaz() || amount0 should be 36789784") + } + if amount1 != "100000000" { + panic("router_z6_mintBarBaz() || amount1 should be 100000000") + } +} + +func mintBazFoo() { + std.TestSetPrevAddr(test1) + baz.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) + foo.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) + + std.TestSetPrevRealm(consts.STAKER_PATH) + _, _, amount0, amount1 := pn.Mint(bazPath, fooPath, fee100, int32(9000), int32(11000), "100000000", "100000000", "0", "0", maxTimeout, test1.String()) + if amount0 != "36789784" { + panic("router_z6_mintBazFoo() || amount0 should be 36789784") + } + if amount1 != "100000000" { + panic("router_z6_mintBazFoo() || amount1 should be 100000000") + } +} + +func mintFooQux() { + std.TestSetPrevAddr(test1) + foo.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) + qux.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) + + std.TestSetPrevRealm(consts.STAKER_PATH) + _, _, amount0, amount1 := pn.Mint(fooPath, quxPath, fee100, int32(9000), int32(11000), "100000000", "100000000", "0", "0", maxTimeout, test1.String()) + if amount0 != "36789784" { + panic("router_z6_mintBazFoo() || amount0 should be 36789784") + } + if amount1 != "100000000" { + panic("router_z6_mintBazFoo() || amount1 should be 100000000") + } +} + +// BAR > BAZ > ExactIn || DRY +func drySwapBarBazExactIn() { + std.TestSetPrevAddr(test1) + + dryResult := rr.DrySwapRoute( + barPath, // inputToken + bazPath, // outputToken + "1000000", // amountSpecified + "EXACT_IN", // swapType + "gno.land/r/demo/bar:gno.land/r/demo/baz:100", // strRouteArr + "100", // quoteArr + ) + if dryResult != "2714276" { + panic("router_z6_drySwapBarBazExactIn() || dryResult should be 2714276") + } +} + +// BAR > BAZ > ExactIn || SWAP +func swapBarBazExactIn() { + std.TestSetPrevAddr(test1) + + bar.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) // swap input amount + baz.Approve(a2u(consts.ROUTER_ADDR), consts.UINT64_MAX) // 0.15% fee + + amountIn, amountOut := rr.SwapRoute( + barPath, // inputToken + bazPath, // outputToken + "1000000", // amountSpecified + "EXACT_IN", // swapType + "gno.land/r/demo/bar:gno.land/r/demo/baz:100", // strRouteArr + "100", // quoteArr + "0", // tokenAmountLimit + ) + if amountIn != "1000000" { + panic("router_z6_swapBarBazExactIn() || amountIn should be 1000000") + } + if amountOut != "-2710205" { + panic("router_z6_swapBarBazExactIn() || amountIn should be -2710205") + } +} + +// BAZ > BAR > ExactIn || DRY +func drySwapBazBarExactIn() { + std.TestSetPrevAddr(test1) + + dryResult := rr.DrySwapRoute( + bazPath, // inputToken + barPath, // outputToken + "2714276", // amountSpecified + "EXACT_IN", // swapType + "gno.land/r/demo/baz:gno.land/r/demo/bar:100", // strRouteArr + "100", // quoteArr + ) + if dryResult != "999799" { + panic("router_z6_drySwapBazBarExactIn() || dryResult should be 999799") + } +} + +// BAZ > BAR > ExactIn || SWAP +func swapBazBarExactIn() { + std.TestSetPrevAddr(test1) + + baz.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) // swap input amount + bar.Approve(a2u(consts.ROUTER_ADDR), consts.UINT64_MAX) // 0.15% fee + + amountIn, amountOut := rr.SwapRoute( + bazPath, // inputToken + barPath, // outputToken + "2714276", // amountSpecified + "EXACT_IN", // swapType + "gno.land/r/demo/baz:gno.land/r/demo/bar:100", // strRouteArr + "100", // quoteArr + "0", // tokenAmountLimit + ) + if amountIn != "2714276" { + panic("router_z6_swapBazBarExactIn() || amountIn should be 2714276") + } + if amountOut != "-998300" { + panic("router_z6_swapBazBarExactIn() || amountIn should be -998300") + } +} + +// BAR > BAZ > ExactOut || DRY +func drySwapBarBazExactOut() { + std.TestSetPrevAddr(test1) + + dryResult := rr.DrySwapRoute( + barPath, // inputToken + bazPath, // outputToken + "2714276", // amountSpecified + "EXACT_OUT", // swapType + "gno.land/r/demo/bar:gno.land/r/demo/baz:100", // strRouteArr + "100", // quoteArr + ) + if dryResult != "1000002" { + panic("router_z6_drySwapBarBazExactOut() || dryResult should be 1000002") // + } +} + +// BAR > BAZ > ExactOut || SWAP +func swapBarBazExactOut() { + std.TestSetPrevAddr(test1) + + bar.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) // swap input amount + baz.Approve(a2u(consts.ROUTER_ADDR), consts.UINT64_MAX) // 0.15% fee + + amountIn, amountOut := rr.SwapRoute( + barPath, // inputToken + bazPath, // outputToken + "2714276", // amountSpecified + "EXACT_OUT", // swapType + "gno.land/r/demo/bar:gno.land/r/demo/baz:100", // strRouteArr + "100", // quoteArr + "1000002", // tokenAmountLimit + ) + if amountIn != "1000002" { + panic("router_z6_swapBarBazExactOut() || amountIn should be 1000002") + } + if amountOut != "-2710205" { + panic("router_z6_swapBarBazExactOut() || amountIn should be 1000002") + } +} + +// BAR > QUX > ExactIn || DRY +func drySwapBarQuxExactIn() { + std.TestSetPrevAddr(test1) + + dryResult := rr.DrySwapRoute( + barPath, // inputToken + quxPath, // outputToken + "1000000", // amountSpecified + "EXACT_IN", // swapType + "gno.land/r/demo/bar:gno.land/r/demo/baz:100*POOL*gno.land/r/demo/baz:gno.land/r/demo/foo:100*POOL*gno.land/r/demo/foo:gno.land/r/demo/qux:100", // strRouteArr + "100", // quoteArr + ) + if dryResult != "19733647" { + panic("router_z6_drySwapBarQuxExactIn() || amountIn should be 19733647") + } +} + +// BAR > QUX > ExactIn || SWAP +func swapBarQuxExactIn() { + std.TestSetPrevAddr(test1) + + bar.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) // swap input amount + qux.Approve(a2u(consts.ROUTER_ADDR), consts.UINT64_MAX) // 0.15% fee + + amountIn, amountOut := rr.SwapRoute( + barPath, // inputToken + quxPath, // outputToken + "1000000", // amountSpecified + "EXACT_IN", // swapType + "gno.land/r/demo/bar:gno.land/r/demo/baz:100*POOL*gno.land/r/demo/baz:gno.land/r/demo/foo:100*POOL*gno.land/r/demo/foo:gno.land/r/demo/qux:100", // strRouteArr + "100", // quoteArr + "0", // tokenAmountLimit + ) + + if amountIn != "1000000" { + panic("router_z6_swapBarQuxExactIn() || amountIn should be 1000000") + } + if amountOut != "-19704047" { + panic("router_z6_swapBarQuxExactIn() || amountIn should be -19704047") + } +} + +// QUX > BAR > ExactOut || DRY +func drySwapQuxBarExactOut() { + std.TestSetPrevAddr(test1) + + dryResult := rr.DrySwapRoute( + quxPath, // inputToken + barPath, // outputToken + "2000000", // amountSpecified + "EXACT_OUT", // swapType + "gno.land/r/demo/qux:gno.land/r/demo/foo:100*POOL*gno.land/r/demo/foo:gno.land/r/demo/baz:100*POOL*gno.land/r/demo/baz:gno.land/r/demo/bar:100", // strRouteArr + "100", // quoteArr + ) + if dryResult != "40079942" { + panic("router_z6_drySwapQuxBarExactOut() || amountIn should be 40079942") + } +} + +// QUX > BAR > ExactOut || SWAP +func swapQuxBarExactOut() { + std.TestSetPrevAddr(test1) + + qux.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) // swap input amount + bar.Approve(a2u(consts.ROUTER_ADDR), consts.UINT64_MAX) // 0.15% fee + + amountIn, amountOut := rr.SwapRoute( + quxPath, // inputToken + barPath, // outputToken + "2000000", // amountSpecified + "EXACT_OUT", // swapType + "gno.land/r/demo/qux:gno.land/r/demo/foo:100*POOL*gno.land/r/demo/foo:gno.land/r/demo/baz:100*POOL*gno.land/r/demo/baz:gno.land/r/demo/bar:100", // strRouteArr + "100", // quoteArr + "40079942", // tokenAmountLimit + ) + + if amountIn != "40079942" { + panic("router_z6_swapQuxBarExactOut() || amountIn should be 40079942") + } + if amountOut != "-1997000" { + panic("router_z6_swapQuxBarExactOut() || amountIn should be -1997000") + } +} diff --git a/staker/_TEST_/z1_one_increase_external_filetest.gno b/staker/_TEST_/z1_one_increase_external_filetest.gno index 22e0e70a..04473b38 100644 --- a/staker/_TEST_/z1_one_increase_external_filetest.gno +++ b/staker/_TEST_/z1_one_increase_external_filetest.gno @@ -321,3 +321,6 @@ func stakeToken02() { sr.StakeToken(2) std.TestSkipHeights(2) } + +// Output: +// diff --git a/staker/_TEST_/z2_one_external_filetest.gno b/staker/_TEST_/z2_one_external_filetest.gno index 1e5b0edb..bf771966 100644 --- a/staker/_TEST_/z2_one_external_filetest.gno +++ b/staker/_TEST_/z2_one_external_filetest.gno @@ -343,3 +343,6 @@ func endExternalIncentive() { sr.EndExternalIncentive(std.GetOrigCaller().String(), "gno.land/r/demo/bar:gno.land/r/demo/foo:100", "gno.land/r/demo/obl") // use same parameter as CreateExternalIncentive() std.TestSkipHeights(1) } + +// Output: +// diff --git a/staker/_TEST_/z3_internal_external_filetest.gno b/staker/_TEST_/z3_internal_external_filetest.gno index 572d95f2..13680ccb 100644 --- a/staker/_TEST_/z3_internal_external_filetest.gno +++ b/staker/_TEST_/z3_internal_external_filetest.gno @@ -395,3 +395,6 @@ func collectExternalReward() { panic("collectExternalReward() || oblBal != 9000145306") } } + +// Output: +// diff --git a/staker/_TEST_/z4_mint_and_stake_filetest.gno b/staker/_TEST_/z4_mint_and_stake_filetest.gno index 3d2b4b88..9cf0601f 100644 --- a/staker/_TEST_/z4_mint_and_stake_filetest.gno +++ b/staker/_TEST_/z4_mint_and_stake_filetest.gno @@ -281,3 +281,6 @@ func unstakeToken() { std.TestSetPrevAddr(test1) sr.UnstakeToken(1) } + +// Output: +// diff --git a/staker/_TEST_/z5_manage_pool_tier_filetest.gno b/staker/_TEST_/z5_manage_pool_tier_filetest.gno index e83c4121..52117dca 100644 --- a/staker/_TEST_/z5_manage_pool_tier_filetest.gno +++ b/staker/_TEST_/z5_manage_pool_tier_filetest.gno @@ -281,3 +281,6 @@ func removePoolTier() { panic("pool tier not removed") } } + +// Output: +//