diff --git a/compose.yaml b/compose.yaml index 9f8e012..01b800b 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,7 +1,7 @@ services: gnodev: build: ./contract/ - command: gnodev -paths gno.land/r/volos/**,gno.land/r/gnoswap/** -node-rpc-listener 0.0.0.0:26657 -web-listener 0.0.0.0:8888 + command: gnodev -paths gno.land/r/volos/**,gno.land/r/gnoswap/** -deploy-key g1e9mkmle8rgx4jy2398dal9320uul7g00tkyh42 -node-rpc-listener 0.0.0.0:26657 -web-listener 0.0.0.0:8888 develop: watch: - action: sync diff --git a/contract/Dockerfile b/contract/Dockerfile index e01238d..9ef1d54 100644 --- a/contract/Dockerfile +++ b/contract/Dockerfile @@ -25,11 +25,8 @@ COPY --from=builder /go/bin/gnokey /app/gnokey COPY --from=builder /app/src /app/src -COPY ./r/gnoswap/v1/test_token/bar/ /app/src/examples/gno.land/r/gnoswap/v1/test_token/bar/ -COPY ./p/gnoswap/consts/ /app/src/examples/gno.land/p/gnoswap/consts/ - -# temporary -COPY ./r/volos/core/volos.gno /app/src/examples/gno.land/r/volos/core/volos.gno +COPY ./r/gnoswap/test_token/ /app/src/examples/gno.land/r/gnoswap/test_token/ +COPY ./r/gnoswap/rbac/consts.gno /app/src/examples/gno.land/r/gnoswap/rbac/consts.gno COPY ./keys.db /root/.config/gno/data/keys.db diff --git a/contract/p/gnoswap/consts/consts.gno b/contract/p/gnoswap/consts/consts.gno deleted file mode 100644 index 9061e37..0000000 --- a/contract/p/gnoswap/consts/consts.gno +++ /dev/null @@ -1,143 +0,0 @@ -package consts - -import ( - "std" -) - -// INITIAL ADDRESSES -const ( - ADMIN std.Address = "g1e9mkmle8rgx4jy2398dal9320uul7g00tkyh42" - DEV_OPS std.Address = "g1e9mkmle8rgx4jy2398dal9320uul7g00tkyh42" -) - -// WRAP & UNWRAP -const ( - GNOT string = "gnot" - UGNOT string = "ugnot" - WRAPPED_WUGNOT string = "gno.land/r/demo/wugnot" - - // defined in https://github.com/gnolang/gno/blob/81a88a2976ba9f2f9127ebbe7fb7d1e1f7fa4bd4/examples/gno.land/r/demo/wugnot/wugnot.gno#L19 - UGNOT_MIN_DEPOSIT_TO_WRAP uint64 = 1000 -) - -// INITIAL CONTRACT PATH & ADDRESS -const ( - POOL_PATH string = "gno.land/r/gnoswap/v1/pool" - POOL_ADDR std.Address = "g148tjamj80yyrm309z7rk690an22thd2l3z8ank" - - POSITION_PATH string = "gno.land/r/gnoswap/v1/position" - POSITION_ADDR std.Address = "g1q646ctzhvn60v492x8ucvyqnrj2w30cwh6efk5" - - ROUTER_PATH string = "gno.land/r/gnoswap/v1/router" - ROUTER_ADDR std.Address = "g1lm2l7tf49h3mykesct7rhfml30yx8dw5xrval7" - - STAKER_PATH string = "gno.land/r/gnoswap/v1/staker" - STAKER_ADDR std.Address = "g1cceshmzzlmrh7rr3z30j2t5mrvsq9yccysw9nu" - - GNS_PATH string = "gno.land/r/gnoswap/v1/gns" - GNS_ADDR std.Address = "g1jgqwaa2le3yr63d533fj785qkjspumzv22ys5m" - - GNFT_PATH string = "gno.land/r/gnoswap/v1/gnft" - GNFT_ADDR std.Address = "g1wxv2rdfn53qc84nt3nn646f9yh3nly8lm7j89t" - - WUGNOT_PATH string = "gno.land/r/demo/wugnot" - WUGNOT_ADDR std.Address = "g1pf6dv9fjk3rn0m4jjcne306ga4he3mzmupfjl6" - - EMISSION_PATH string = "gno.land/r/gnoswap/v1/emission" - EMISSION_ADDR std.Address = "g10xg6559w9e93zfttlhvdmaaa0er3zewcr7nh20" - - PROTOCOL_FEE_PATH string = "gno.land/r/gnoswap/v1/protocol_fee" - PROTOCOL_FEE_ADDR std.Address = "g1f7wpek7q67tkns27sw495u5yuu3a5wwjxw5l6l" - - COMMUNITY_POOL_PATH string = "gno.land/r/gnoswap/v1/community_pool" - COMMUNITY_POOL_ADDR std.Address = "g100fnnlz5eh87p5hvwt8pf279lxaelm8k8md049" - - GOV_XGNS_PATH string = "gno.land/r/gnoswap/v1/gov/xgns" - GOV_XGNS_ADDR std.Address = "g1wwh55uwzlz2zzr2qcvvxf83qhcvmx2t8779l9r" - - GOV_STAKER_PATH string = "gno.land/r/gnoswap/v1/gov/staker" - GOV_STAKER_ADDR std.Address = "g17e3ykyqk9jmqe2y9wxe9zhep3p7cw56davjqwa" - - GOV_GOVERNANCE_PATH string = "gno.land/r/gnoswap/v1/gov/governance" - GOV_GOVERNANCE_ADDR std.Address = "g17s8w2ve7k85fwfnrk59lmlhthkjdted8whvqxd" - - COMMON_PATH string = "gno.land/r/gnoswap/v1/common" - COMMON_ADDR std.Address = "g14ytarn5u7h3xywygt8hzhs3m23frljz72ta9xk" - - LAUNCHPAD_PATH string = "gno.land/r/gnoswap/v1/launchpad" - LAUNCHPAD_ADDR std.Address = "g122mau2lp2rc0scs8d27pkkuys4w54mdy2tuer3" - - ACCESS_PATH string = "gno.land/r/gnoswap/v1/access" - ACCESS_ADDR std.Address = "g1yyw4t7pywpgpq6z2p745y05qejwur97xud4arw" - - HALT_PATH string = "gno.land/r/gnoswap/v1/halt" - HALT_ADDR std.Address = "g1q67vstyzqycl75yv7ern98n4u8qrgc8hxkmsxt" -) - -// NUMBER -const ( - // calculated by https://mathiasbynens.be/demo/integer-range - MAX_UINT8 string = "255" - UINT8_MAX uint8 = 255 - - MAX_UINT16 string = "65535" - UINT16_MAX uint16 = 65535 - - MAX_UINT32 string = "4294967295" - UINT32_MAX uint32 = 4294967295 - - MAX_UINT64 string = "18446744073709551615" - UINT64_MAX uint64 = 18446744073709551615 - - MAX_INT64 string = "9223372036854775807" - INT64_MAX int64 = 9223372036854775807 - - MAX_UINT128 string = "340282366920938463463374607431768211455" - MAX_UINT160 string = "1461501637330902918203684832716283019655932542975" - MAX_UINT256 string = "115792089237316195423570985008687907853269984665640564039457584007913129639935" - - MAX_INT128 string = "170141183460469231731687303715884105727" - MAX_INT256 string = "57896044618658097711785492504343953926634992332820282019728792003956564819967" - - // Tick Related - MIN_TICK int32 = -887272 - MAX_TICK int32 = 887272 - - MIN_SQRT_RATIO string = "4295128739" // same as TickMathGetSqrtRatioAtTick(MIN_TICK) - MAX_SQRT_RATIO string = "1461446703485210103287273052203988822378723970342" // same as TickMathGetSqrtRatioAtTick(MAX_TICK) - - MIN_PRICE string = "4295128740" // MIN_SQRT_RATIO + 1 - MAX_PRICE string = "1461446703485210103287273052203988822378723970341" // MAX_SQRT_RATIO - 1 - - // ETC - Q64 string = "18446744073709551616" // 2 ** 64 - Q96 string = "79228162514264337593543950336" // 2 ** 96 - Q128 string = "340282366920938463463374607431768211456" // 2 ** 128 - - Q96_RESOLUTION uint = 96 - Q128_RESOLUTION uint = 128 - Q160_RESOLUTION uint = 160 -) - -// TIME -const ( - SECONDS_PER_DAY = 86400 -) - -// BLOCK TIME -const ( - // Default block generation interval, in milliseconds, used to estimate - // how many blocks will be produced over a given timeframe. - // GnoSwap’s emission logic relies on this as an initial value, - // but actual block times may vary (e.g. due to network conditions). - // Governance or an admin can adjust it dynamically by calling - // [SetAvgBlockTimeInMs](https://github.com/gnoswap-labs/gnoswap/blob/a29e0f994466430618548ae992cca11a52f5102a/contract/r/gnoswap/gns/halving.gno#L359) to keep emission schedules accurate. - BLOCK_GENERATION_INTERVAL int64 = 2000 - MILLISECONDS_PER_SECOND int64 = 1000 -) - -// ETCs -const ( - // REF: https://github.com/gnolang/gno/pull/2401#discussion_r1648064219 - ZERO_ADDRESS std.Address = "g100000000000000000000000000000000dnmcnx" -) diff --git a/contract/p/volos/math/shares_math.gno b/contract/p/volos/math/shares_math.gno index c2820a3..b5002da 100644 --- a/contract/p/volos/math/shares_math.gno +++ b/contract/p/volos/math/shares_math.gno @@ -13,8 +13,7 @@ var ( VIRTUAL_SHARES = u256.NewUint(1000000000) // 1 billion shares // VIRTUAL_ASSETS represents the minimum number of assets that exist in a pool - // This matches VIRTUAL_SHARES to maintain 1:1 initial share ratio - VIRTUAL_ASSETS = u256.NewUint(1000000000) // 1 billion base units + VIRTUAL_ASSETS = u256.NewUint(1) // 1 base units ) // ToSharesDown converts assets to shares, rounding down (used for supply) diff --git a/contract/r/gnoswap/rbac/consts.gno b/contract/r/gnoswap/rbac/consts.gno new file mode 100644 index 0000000..2f4f54e --- /dev/null +++ b/contract/r/gnoswap/rbac/consts.gno @@ -0,0 +1,40 @@ +package rbac + +import "std" + +// Initial addresses for protocol roles. +const ( + // ADMIN is the initial admin address for RBAC management. + ADMIN std.Address = "g1e9mkmle8rgx4jy2398dal9320uul7g00tkyh42" + // DEV_OPS is the initial DevOps address for operational tasks. + DEV_OPS std.Address = "g1e9mkmle8rgx4jy2398dal9320uul7g00tkyh42" +) + +// Derived addresses for GnoSwap protocol packages. +var ( + // GNS_ADDR is the derived address for the GNS token package. + GNS_ADDR std.Address = std.DerivePkgAddr("gno.land/r/gnoswap/gns") + // EMISSION_ADDR is the derived address for the emission package. + EMISSION_ADDR std.Address = std.DerivePkgAddr("gno.land/r/gnoswap/emission") + + // POOL_ADDR is the derived address for the pool package. + POOL_ADDR std.Address = std.DerivePkgAddr("gno.land/r/gnoswap/v1/pool") + // POSITION_ADDR is the derived address for the position package. + POSITION_ADDR std.Address = std.DerivePkgAddr("gno.land/r/gnoswap/v1/position") + // ROUTER_ADDR is the derived address for the router package. + ROUTER_ADDR std.Address = std.DerivePkgAddr("gno.land/r/gnoswap/v1/router") + // STAKER_ADDR is the derived address for the staker package. + STAKER_ADDR std.Address = std.DerivePkgAddr("gno.land/r/gnoswap/v1/staker") + // PROTOCOL_FEE_ADDR is the derived address for the protocol fee package. + PROTOCOL_FEE_ADDR std.Address = std.DerivePkgAddr("gno.land/r/gnoswap/v1/protocol_fee") + // COMMUNITY_POOL_ADDR is the derived address for the community pool package. + COMMUNITY_POOL_ADDR std.Address = std.DerivePkgAddr("gno.land/r/gnoswap/v1/community_pool") + // GOV_GOVERNANCE_ADDR is the derived address for the governance package. + GOV_GOVERNANCE_ADDR std.Address = std.DerivePkgAddr("gno.land/r/gnoswap/v1/gov/governance") + // GOV_STAKER_ADDR is the derived address for the governance staker package. + GOV_STAKER_ADDR std.Address = std.DerivePkgAddr("gno.land/r/gnoswap/v1/gov/staker") + // GOV_XGNS_ADDR is the derived address for the xGNS governance package. + GOV_XGNS_ADDR std.Address = std.DerivePkgAddr("gno.land/r/gnoswap/v1/gov/xgns") + // LAUNCHPAD_ADDR is the derived address for the launchpad package. + LAUNCHPAD_ADDR std.Address = std.DerivePkgAddr("gno.land/r/gnoswap/v1/launchpad") +) diff --git a/contract/r/gnoswap/v1/test_token/bar/bar.gno b/contract/r/gnoswap/test_token/bar/bar.gno similarity index 93% rename from contract/r/gnoswap/v1/test_token/bar/bar.gno rename to contract/r/gnoswap/test_token/bar/bar.gno index e187e7a..e81cbd2 100644 --- a/contract/r/gnoswap/v1/test_token/bar/bar.gno +++ b/contract/r/gnoswap/test_token/bar/bar.gno @@ -4,11 +4,11 @@ import ( "std" "strings" - "gno.land/p/demo/grc/grc20" - "gno.land/p/demo/ownable" - "gno.land/p/demo/ufmt" + "gno.land/p/demo/tokens/grc20" + "gno.land/p/nt/ownable" + "gno.land/p/nt/ufmt" - "gno.land/r/demo/grc20reg" + "gno.land/r/demo/defi/grc20reg" ) var ( diff --git a/contract/r/gnoswap/test_token/bar/gnomod.toml b/contract/r/gnoswap/test_token/bar/gnomod.toml new file mode 100644 index 0000000..b7362c0 --- /dev/null +++ b/contract/r/gnoswap/test_token/bar/gnomod.toml @@ -0,0 +1,2 @@ +module = "gno.land/r/onbloc/bar" +gno = "0.9" diff --git a/contract/r/gnoswap/test_token/baz/baz.gno b/contract/r/gnoswap/test_token/baz/baz.gno new file mode 100644 index 0000000..d2f332d --- /dev/null +++ b/contract/r/gnoswap/test_token/baz/baz.gno @@ -0,0 +1,80 @@ +package baz + +import ( + "std" + "strings" + + "gno.land/p/demo/tokens/grc20" + "gno.land/p/nt/ownable" + "gno.land/p/nt/ufmt" + + "gno.land/r/demo/defi/grc20reg" +) + +var ( + token, privateLedger = grc20.NewToken("Baz", "BAZ", 6) + owner = ownable.NewWithAddress("g1e9mkmle8rgx4jy2398dal9320uul7g00tkyh42") // ADMIN +) + +func init() { + privateLedger.Mint(owner.Owner(), 100_000_000_000_000) + grc20reg.Register(cross, token, "") +} + +func TotalSupply() int64 { + userTeller := token.CallerTeller() + return userTeller.TotalSupply() +} + +func BalanceOf(owner std.Address) int64 { + userTeller := token.CallerTeller() + return userTeller.BalanceOf(owner) +} + +func Allowance(owner, spender std.Address) int64 { + userTeller := token.CallerTeller() + return userTeller.Allowance(owner, spender) +} + +func Transfer(cur realm, to std.Address, amount int64) { + userTeller := token.CallerTeller() + checkErr(userTeller.Transfer(to, amount)) +} + +func Approve(cur realm, spender std.Address, amount int64) { + userTeller := token.CallerTeller() + checkErr(userTeller.Approve(spender, amount)) +} + +func TransferFrom(cur realm, from, to std.Address, amount int64) { + userTeller := token.CallerTeller() + checkErr(userTeller.TransferFrom(from, to, amount)) +} + +func Burn(cur realm, from std.Address, amount int64) { + owner.AssertOwnedByPrevious() + checkErr(privateLedger.Burn(from, amount)) +} + +func Render(path string) string { + parts := strings.Split(path, "/") + c := len(parts) + + switch { + case path == "": + return token.RenderHome() + case c == 2 && parts[0] == "balance": + owner := std.Address(parts[1]) + userTeller := token.CallerTeller() + balance := userTeller.BalanceOf(owner) + return ufmt.Sprintf("%d\n", balance) + default: + return "404\n" + } +} + +func checkErr(err error) { + if err != nil { + panic(err) + } +} diff --git a/contract/r/gnoswap/test_token/baz/gnomod.toml b/contract/r/gnoswap/test_token/baz/gnomod.toml new file mode 100644 index 0000000..1eda940 --- /dev/null +++ b/contract/r/gnoswap/test_token/baz/gnomod.toml @@ -0,0 +1,2 @@ +module = "gno.land/r/onbloc/baz" +gno = "0.9" diff --git a/contract/r/gnoswap/test_token/foo/foo.gno b/contract/r/gnoswap/test_token/foo/foo.gno new file mode 100644 index 0000000..07b9758 --- /dev/null +++ b/contract/r/gnoswap/test_token/foo/foo.gno @@ -0,0 +1,80 @@ +package foo + +import ( + "std" + "strings" + + "gno.land/p/demo/tokens/grc20" + "gno.land/p/nt/ownable" + "gno.land/p/nt/ufmt" + + "gno.land/r/demo/defi/grc20reg" +) + +var ( + token, privateLedger = grc20.NewToken("Foo", "FOO", 6) + owner = ownable.NewWithAddress("g1e9mkmle8rgx4jy2398dal9320uul7g00tkyh42") // ADMIN +) + +func init() { + privateLedger.Mint(owner.Owner(), 100_000_000_000_000) + grc20reg.Register(cross, token, "") +} + +func TotalSupply() int64 { + userTeller := token.CallerTeller() + return userTeller.TotalSupply() +} + +func BalanceOf(owner std.Address) int64 { + userTeller := token.CallerTeller() + return userTeller.BalanceOf(owner) +} + +func Allowance(owner, spender std.Address) int64 { + userTeller := token.CallerTeller() + return userTeller.Allowance(owner, spender) +} + +func Transfer(cur realm, to std.Address, amount int64) { + userTeller := token.CallerTeller() + checkErr(userTeller.Transfer(to, amount)) +} + +func Approve(cur realm, spender std.Address, amount int64) { + userTeller := token.CallerTeller() + checkErr(userTeller.Approve(spender, amount)) +} + +func TransferFrom(cur realm, from, to std.Address, amount int64) { + userTeller := token.CallerTeller() + checkErr(userTeller.TransferFrom(from, to, amount)) +} + +func Burn(cur realm, from std.Address, amount int64) { + owner.AssertOwnedByPrevious() + checkErr(privateLedger.Burn(from, amount)) +} + +func Render(path string) string { + parts := strings.Split(path, "/") + c := len(parts) + + switch { + case path == "": + return token.RenderHome() + case c == 2 && parts[0] == "balance": + owner := std.Address(parts[1]) + userTeller := token.CallerTeller() + balance := userTeller.BalanceOf(owner) + return ufmt.Sprintf("%d\n", balance) + default: + return "404\n" + } +} + +func checkErr(err error) { + if err != nil { + panic(err) + } +} diff --git a/contract/r/gnoswap/test_token/foo/gnomod.toml b/contract/r/gnoswap/test_token/foo/gnomod.toml new file mode 100644 index 0000000..2bf457d --- /dev/null +++ b/contract/r/gnoswap/test_token/foo/gnomod.toml @@ -0,0 +1,2 @@ +module = "gno.land/r/onbloc/foo" +gno = "0.9" diff --git a/contract/r/gnoswap/test_token/obl/gnomod.toml b/contract/r/gnoswap/test_token/obl/gnomod.toml new file mode 100644 index 0000000..7eeb174 --- /dev/null +++ b/contract/r/gnoswap/test_token/obl/gnomod.toml @@ -0,0 +1,2 @@ +module = "gno.land/r/onbloc/obl" +gno = "0.9" diff --git a/contract/r/gnoswap/test_token/obl/obl.gno b/contract/r/gnoswap/test_token/obl/obl.gno new file mode 100644 index 0000000..0935598 --- /dev/null +++ b/contract/r/gnoswap/test_token/obl/obl.gno @@ -0,0 +1,80 @@ +package obl + +import ( + "std" + "strings" + + "gno.land/p/demo/tokens/grc20" + "gno.land/p/nt/ownable" + "gno.land/p/nt/ufmt" + + "gno.land/r/demo/defi/grc20reg" +) + +var ( + token, privateLedger = grc20.NewToken("Obl", "OBL", 6) + owner = ownable.NewWithAddress("g1e9mkmle8rgx4jy2398dal9320uul7g00tkyh42") // ADMIN +) + +func init() { + privateLedger.Mint(owner.Owner(), 100_000_000_000_000) + grc20reg.Register(cross, token, "") +} + +func TotalSupply() int64 { + userTeller := token.CallerTeller() + return userTeller.TotalSupply() +} + +func BalanceOf(owner std.Address) int64 { + userTeller := token.CallerTeller() + return userTeller.BalanceOf(owner) +} + +func Allowance(owner, spender std.Address) int64 { + userTeller := token.CallerTeller() + return userTeller.Allowance(owner, spender) +} + +func Transfer(cur realm, to std.Address, amount int64) { + userTeller := token.CallerTeller() + checkErr(userTeller.Transfer(to, amount)) +} + +func Approve(cur realm, spender std.Address, amount int64) { + userTeller := token.CallerTeller() + checkErr(userTeller.Approve(spender, amount)) +} + +func TransferFrom(cur realm, from, to std.Address, amount int64) { + userTeller := token.CallerTeller() + checkErr(userTeller.TransferFrom(from, to, amount)) +} + +func Burn(cur realm, from std.Address, amount int64) { + owner.AssertOwnedByPrevious() + checkErr(privateLedger.Burn(from, amount)) +} + +func Render(path string) string { + parts := strings.Split(path, "/") + c := len(parts) + + switch { + case path == "": + return token.RenderHome() + case c == 2 && parts[0] == "balance": + owner := std.Address(parts[1]) + userTeller := token.CallerTeller() + balance := userTeller.BalanceOf(owner) + return ufmt.Sprintf("%d\n", balance) + default: + return "404\n" + } +} + +func checkErr(err error) { + if err != nil { + panic(err) + } +} diff --git a/contract/r/gnoswap/test_token/qux/gnomod.toml b/contract/r/gnoswap/test_token/qux/gnomod.toml new file mode 100644 index 0000000..ffae17f --- /dev/null +++ b/contract/r/gnoswap/test_token/qux/gnomod.toml @@ -0,0 +1,2 @@ +module = "gno.land/r/onbloc/qux" +gno = "0.9" diff --git a/contract/r/gnoswap/test_token/qux/qux.gno b/contract/r/gnoswap/test_token/qux/qux.gno new file mode 100644 index 0000000..d1c908c --- /dev/null +++ b/contract/r/gnoswap/test_token/qux/qux.gno @@ -0,0 +1,80 @@ +package qux + +import ( + "std" + "strings" + + "gno.land/p/demo/tokens/grc20" + "gno.land/p/nt/ownable" + "gno.land/p/nt/ufmt" + + "gno.land/r/demo/defi/grc20reg" +) + +var ( + token, privateLedger = grc20.NewToken("Qux", "QUX", 6) + owner = ownable.NewWithAddress("g1e9mkmle8rgx4jy2398dal9320uul7g00tkyh42") // ADMIN +) + +func init() { + privateLedger.Mint(owner.Owner(), 100_000_000_000_000) + grc20reg.Register(cross, token, "") +} + +func TotalSupply() int64 { + userTeller := token.CallerTeller() + return userTeller.TotalSupply() +} + +func BalanceOf(owner std.Address) int64 { + userTeller := token.CallerTeller() + return userTeller.BalanceOf(owner) +} + +func Allowance(owner, spender std.Address) int64 { + userTeller := token.CallerTeller() + return userTeller.Allowance(owner, spender) +} + +func Transfer(cur realm, to std.Address, amount int64) { + userTeller := token.CallerTeller() + checkErr(userTeller.Transfer(to, amount)) +} + +func Approve(cur realm, spender std.Address, amount int64) { + userTeller := token.CallerTeller() + checkErr(userTeller.Approve(spender, amount)) +} + +func TransferFrom(cur realm, from, to std.Address, amount int64) { + userTeller := token.CallerTeller() + checkErr(userTeller.TransferFrom(from, to, amount)) +} + +func Burn(cur realm, from std.Address, amount int64) { + owner.AssertOwnedByPrevious() + checkErr(privateLedger.Burn(from, amount)) +} + +func Render(path string) string { + parts := strings.Split(path, "/") + c := len(parts) + + switch { + case path == "": + return token.RenderHome() + case c == 2 && parts[0] == "balance": + owner := std.Address(parts[1]) + userTeller := token.CallerTeller() + balance := userTeller.BalanceOf(owner) + return ufmt.Sprintf("%d\n", balance) + default: + return "404\n" + } +} + +func checkErr(err error) { + if err != nil { + panic(err) + } +} diff --git a/contract/r/gnoswap/test_token/usdc/gnomod.toml b/contract/r/gnoswap/test_token/usdc/gnomod.toml new file mode 100644 index 0000000..10e2525 --- /dev/null +++ b/contract/r/gnoswap/test_token/usdc/gnomod.toml @@ -0,0 +1,2 @@ +module = "gno.land/r/onbloc/usdc" +gno = "0.9" diff --git a/contract/r/gnoswap/test_token/usdc/usdc.gno b/contract/r/gnoswap/test_token/usdc/usdc.gno new file mode 100644 index 0000000..2964f2c --- /dev/null +++ b/contract/r/gnoswap/test_token/usdc/usdc.gno @@ -0,0 +1,80 @@ +package usdc + +import ( + "std" + "strings" + + "gno.land/p/demo/tokens/grc20" + "gno.land/p/nt/ownable" + "gno.land/p/nt/ufmt" + + "gno.land/r/demo/defi/grc20reg" +) + +var ( + token, privateLedger = grc20.NewToken("Usd Coin", "USDC", 6) + owner = ownable.NewWithAddress("g1e9mkmle8rgx4jy2398dal9320uul7g00tkyh42") // ADMIN +) + +func init() { + privateLedger.Mint(owner.Owner(), 100_000_000_000_000) + grc20reg.Register(cross, token, "") +} + +func TotalSupply() int64 { + userTeller := token.CallerTeller() + return userTeller.TotalSupply() +} + +func BalanceOf(owner std.Address) int64 { + userTeller := token.CallerTeller() + return userTeller.BalanceOf(owner) +} + +func Allowance(owner, spender std.Address) int64 { + userTeller := token.CallerTeller() + return userTeller.Allowance(owner, spender) +} + +func Transfer(cur realm, to std.Address, amount int64) { + userTeller := token.CallerTeller() + checkErr(userTeller.Transfer(to, amount)) +} + +func Approve(cur realm, spender std.Address, amount int64) { + userTeller := token.CallerTeller() + checkErr(userTeller.Approve(spender, amount)) +} + +func TransferFrom(cur realm, from, to std.Address, amount int64) { + userTeller := token.CallerTeller() + checkErr(userTeller.TransferFrom(from, to, amount)) +} + +func Burn(cur realm, from std.Address, amount int64) { + owner.AssertOwnedByPrevious() + checkErr(privateLedger.Burn(from, amount)) +} + +func Render(path string) string { + parts := strings.Split(path, "/") + c := len(parts) + + switch { + case path == "": + return token.RenderHome() + case c == 2 && parts[0] == "balance": + owner := std.Address(parts[1]) + userTeller := token.CallerTeller() + balance := userTeller.BalanceOf(owner) + return ufmt.Sprintf("%d\n", balance) + default: + return "404\n" + } +} + +func checkErr(err error) { + if err != nil { + panic(err) + } +} diff --git a/contract/r/volos/README.md b/contract/r/volos/README.md new file mode 100644 index 0000000..47d2af1 --- /dev/null +++ b/contract/r/volos/README.md @@ -0,0 +1,37 @@ +# Volos (ex GnoLend) + +Volos is the first lending protocol built using Gnolang, implementing financial primitives for decentralized lending and borrowing. The protocol features lending markets with configurable parameters, variable interest rate models, collateralized borrowing with health monitoring, and liquidation mechanisms for undercollateralized positions. It employs a shares-based accounting system to track user positions, calculates interest based on utilization metrics, and maintains system solvency through real-time risk assessment. + +For price determination, Volos integrates with [Gnoswap](https://github.com/gnoswap-labs/gnoswap)'s liquidity pools, using them as price oracles in the absence of dedicated oracle infrastructure. This approach enables the protocol to obtain reliable price data directly from on-chain sources without requiring external oracle networks, demonstrating how essential financial primitives can be implemented within the current gno.land ecosystem. + +The system calculates borrowing capacity based on collateral values derived from Gnoswap pool prices. This integration creates a self-contained lending solution that maintains the security guarantees of the underlying blockchain while providing the necessary infrastructure for expanding DeFi capabilities on gno.land. + +> **Warning:** This project is work in progress. The protocol is under active development and contains incomplete features and known issues. + +## Prerequisites + +- GNU Make 3.81 or higher +- Latest version of [gno.land](https://github.com/gnolang/gno) +- Go 1.21 or higher + +## Setup + +1. First, follow the setup instructions from [Gnoswap](https://github.com/gnoswap-labs/gnoswap) to set up your development environment. + +2. Add Volos realms to your gno repository: + + ```bash + cp -r volos/* $WORKDIR/gno.land/examples/r/volos/ + ``` + +3. Configure admin addresses: + + For proper testing and development, you'll need to update the admin addresses in several locations: + + - In Volos test files: Update the admin addresses to match your test accounts + - In Gnoswap test files: Ensure the admin addresses align with your test environment + - To avoid manual token minting, you can aloso modify the admin address in `p/gnoswap/consts.gno` to match your preferred test account + +4. Run Make file tests: + + Before running Volos tests, you'll need to first initialize a WUGNOT-GNS pool in Gnoswap and mint at least one liquidity position. This provides the price oracle that Volos depends on. After that's done, you can proceed with testing the Volos functions. diff --git a/contract/r/volos/core/api.gno b/contract/r/volos/core/api.gno index 4262f10..5eba2c6 100644 --- a/contract/r/volos/core/api.gno +++ b/contract/r/volos/core/api.gno @@ -1,7 +1,7 @@ package core import ( - "gno.land/p/demo/json" + "gno.land/p/onbloc/json" u256 "gno.land/p/gnoswap/uint256" ) diff --git a/contract/r/volos/core/events.gno b/contract/r/volos/core/events.gno index 0db1f51..f468a35 100644 --- a/contract/r/volos/core/events.gno +++ b/contract/r/volos/core/events.gno @@ -57,8 +57,11 @@ const ( EventCollateralAmtKey = "collateral_amount" // Interest keys - EventBorrowRateKey = "borrow_rate" - EventInterestKey = "interest" + EventBorrowRateKey = "borrow_rate" + EventInterestKey = "interest" + EventTotalSupplyAssetsKey = "total_supply_assets" + EventTotalBorrowAssetsKey = "total_borrow_assets" + EventUtilizationKey = "utilization" // Event keys EventMarketIdKey = "market_id" @@ -74,23 +77,64 @@ const ( EventTimestampKey = "currentTimestamp" EventSupplyAPRKey = "supplyAPR" EventBorrowAPRKey = "borrowAPR" + EventBadDebtAssetsKey = "badDebtAssets" + EventBadDebtSharesKey = "badDebtShares" + // MarketInfo keys + EventIsToken0LoanKey = "isToken0Loan" + EventLoanTokenNameKey = "loanTokenName" + EventLoanTokenSymbolKey = "loanTokenSymbol" + EventLoanTokenDecimalsKey = "loanTokenDecimals" + EventCollateralTokenNameKey = "collateralTokenName" + EventCollateralTokenSymbolKey = "collateralTokenSymbol" + EventCollateralTokenDecimalsKey = "collateralTokenDecimals" + EventLLTVKey = "lltv" + EventPoolPathKey = "poolPath" ) // Event emission helper functions func emitCreateMarket(marketId string, loanToken string, collateralToken string) { + _, params := GetMarket(marketId) + var loanTokenName, loanTokenSymbol string + var loanTokenDecimals uint + var collateralTokenName, collateralTokenSymbol string + var collateralTokenDecimals uint + + loanTokenInfo := GetToken(loanToken) + if loanTokenInfo != nil { + loanTokenName = loanTokenInfo.GetName() + loanTokenSymbol = loanTokenInfo.GetSymbol() + loanTokenDecimals = uint(loanTokenInfo.GetDecimals()) + } + + collateralTokenInfo := GetToken(collateralToken) + if collateralTokenInfo != nil { + collateralTokenName = collateralTokenInfo.GetName() + collateralTokenSymbol = collateralTokenInfo.GetSymbol() + collateralTokenDecimals = uint(collateralTokenInfo.GetDecimals()) + } + std.Emit( CreateMarketEvent, EventMarketIDKey, marketId, EventLoanTokenKey, loanToken, EventCollateralTokenKey, collateralToken, + EventLoanTokenNameKey, loanTokenName, + EventLoanTokenSymbolKey, loanTokenSymbol, + EventLoanTokenDecimalsKey, strconv.FormatUint(uint64(loanTokenDecimals), 10), + EventCollateralTokenNameKey, collateralTokenName, + EventCollateralTokenSymbolKey, collateralTokenSymbol, + EventCollateralTokenDecimalsKey, strconv.FormatUint(uint64(collateralTokenDecimals), 10), + EventLLTVKey, params.LLTV.ToString(), EventTimestampKey, strconv.FormatInt(time.Now().Unix(), 10), + EventPoolPathKey, params.PoolPath, ) } func emitSupply(marketId string, caller std.Address, onBehalf std.Address, assets, shares *u256.Uint) { - // Calculate APRs after supply operation + // Calculate APRs and utilization after supply operation supplyAPR := CalculateSupplyAPR(marketId) borrowAPR := CalculateBorrowAPR(marketId) + utilization := calculateUtilization(marketId) std.Emit( SupplyEvent, @@ -102,13 +146,15 @@ func emitSupply(marketId string, caller std.Address, onBehalf std.Address, asset EventTimestampKey, strconv.FormatInt(time.Now().Unix(), 10), EventSupplyAPRKey, supplyAPR.ToString(), EventBorrowAPRKey, borrowAPR.ToString(), + EventUtilizationKey, utilization.ToString(), ) } func emitWithdraw(marketId string, caller std.Address, onBehalf std.Address, receiver std.Address, assets, shares *u256.Uint) { - // Calculate APRs after withdraw operation + // Calculate APRs and utilization after withdraw operation supplyAPR := CalculateSupplyAPR(marketId) borrowAPR := CalculateBorrowAPR(marketId) + utilization := calculateUtilization(marketId) std.Emit( WithdrawEvent, @@ -121,13 +167,15 @@ func emitWithdraw(marketId string, caller std.Address, onBehalf std.Address, rec EventTimestampKey, strconv.FormatInt(time.Now().Unix(), 10), EventSupplyAPRKey, supplyAPR.ToString(), EventBorrowAPRKey, borrowAPR.ToString(), + EventUtilizationKey, utilization.ToString(), ) } func emitBorrow(marketId string, caller std.Address, onBehalf std.Address, receiver std.Address, assets, shares *u256.Uint) { - // Calculate APRs after borrow operation + // Calculate APRs and utilization after borrow operation supplyAPR := CalculateSupplyAPR(marketId) borrowAPR := CalculateBorrowAPR(marketId) + utilization := calculateUtilization(marketId) std.Emit( BorrowEvent, @@ -140,6 +188,7 @@ func emitBorrow(marketId string, caller std.Address, onBehalf std.Address, recei EventTimestampKey, strconv.FormatInt(time.Now().Unix(), 10), EventSupplyAPRKey, supplyAPR.ToString(), EventBorrowAPRKey, borrowAPR.ToString(), + EventUtilizationKey, utilization.ToString(), ) } @@ -147,6 +196,8 @@ func emitRepay(marketId string, caller std.Address, onBehalf std.Address, assets // Calculate APRs after repay operation supplyAPR := CalculateSupplyAPR(marketId) borrowAPR := CalculateBorrowAPR(marketId) + utilization := calculateUtilization(marketId) + std.Emit( RepayEvent, @@ -158,13 +209,15 @@ func emitRepay(marketId string, caller std.Address, onBehalf std.Address, assets EventTimestampKey, strconv.FormatInt(time.Now().Unix(), 10), EventSupplyAPRKey, supplyAPR.ToString(), EventBorrowAPRKey, borrowAPR.ToString(), + EventUtilizationKey, utilization.ToString(), ) } -func emitLiquidate(marketId string, caller std.Address, borrower std.Address, repaidAssets, repaidShares, seizedAssets *u256.Uint) { - // Calculate APRs after liquidation operation +func emitLiquidate(marketId string, caller std.Address, borrower std.Address, repaidAssets, repaidShares, seizedAssets, badDebtAssets, badDebtShares *u256.Uint) { + // Calculate APRs and utilization after liquidation operation supplyAPR := CalculateSupplyAPR(marketId) borrowAPR := CalculateBorrowAPR(marketId) + utilization := calculateUtilization(marketId) std.Emit( EventLiquidate, @@ -174,18 +227,23 @@ func emitLiquidate(marketId string, caller std.Address, borrower std.Address, re EventAmountKey, repaidAssets.ToString(), EventSharesKey, repaidShares.ToString(), EventSeizedKey, seizedAssets.ToString(), + EventBadDebtAssetsKey, badDebtAssets.ToString(), + EventBadDebtSharesKey, badDebtShares.ToString(), EventTimestampKey, strconv.FormatInt(time.Now().Unix(), 10), EventSupplyAPRKey, supplyAPR.ToString(), EventBorrowAPRKey, borrowAPR.ToString(), + EventUtilizationKey, utilization.ToString(), ) } -func emitAccrueInterest(marketId string, borrowRate, interest *u256.Uint) { +func emitAccrueInterest(marketId string, borrowRate, interest, totalSupplyAssets, totalBorrowAssets *u256.Uint) { std.Emit( AccrueInterestEvent, EventMarketIDKey, marketId, EventBorrowRateKey, borrowRate.ToString(), EventInterestKey, interest.ToString(), + EventTotalSupplyAssetsKey, totalSupplyAssets.ToString(), + EventTotalBorrowAssetsKey, totalBorrowAssets.ToString(), EventTimestampKey, strconv.FormatInt(time.Now().Unix(), 10), ) } diff --git a/contract/r/volos/core/getter.gno b/contract/r/volos/core/getter.gno index ee9cd5b..8d140b9 100644 --- a/contract/r/volos/core/getter.gno +++ b/contract/r/volos/core/getter.gno @@ -3,7 +3,7 @@ package core import ( "std" - "gno.land/p/demo/avl" + "gno.land/p/nt/avl" u256 "gno.land/p/gnoswap/uint256" ) @@ -237,21 +237,6 @@ func GetMarketPrice(marketId string) string { // Other getters -func GetSupplyShares(marketId string, user std.Address) string { - position := GetPosition(marketId, user.String()) - return position.SupplyShares.ToString() -} - -func GetBorrowShares(marketId string, user std.Address) string { - position := GetPosition(marketId, user.String()) - return position.BorrowShares.ToString() -} - -func GetCollateral(marketId string, user std.Address) string { - position := GetPosition(marketId, user.String()) - return position.Collateral.ToString() -} - func GetTotalSupplyAssets(marketId string) string { market, _ := GetMarket(marketId) return market.TotalSupplyAssets.ToString() @@ -319,12 +304,6 @@ func GetExpectedBorrowAssets(marketId string, user string) string { return ExpectedBorrowAssets(marketId, user).ToString() } -// GetBorrowRate returns the current borrow rate per second as a string (WAD-scaled) -func GetBorrowRate(marketId string) string { - borrowRate := CalculateBorrowRate(marketId) - return borrowRate.ToString() -} - // GetSupplyRate returns the current supply rate per second as a string (WAD-scaled) func GetSupplyRate(marketId string) string { supplyRate := CalculateSupplyRate(marketId) @@ -387,3 +366,23 @@ func GetAddress() string { func GetIsAuthorized(authorizer string, authorized string) bool { return IsAuthorized(std.Address(authorizer), std.Address(authorized)) } + +// getBorrowRate returns the current borrow rate per second +// The returned value is WAD-scaled (1e18) +func GetBorrowRate(marketId string) *u256.Uint { + // Check if market exists + if _, exists := markets.Get(marketId); !exists { + panic(ErrMarketNotCreated) + } + + market, params := GetMarket(marketId) + + // If no borrows or no IRM, rate is zero + if market.TotalBorrowAssets.IsZero() || params.IRM == "" { + return u256.Zero() + } + + // Get IRM and calculate current borrow rate + irm := GetIRM(params.IRM) + return irm.BorrowRate(market.TotalSupplyAssets, market.TotalBorrowAssets) +} diff --git a/contract/r/volos/core/json.gno b/contract/r/volos/core/json.gno index 5757c8f..aaadec3 100644 --- a/contract/r/volos/core/json.gno +++ b/contract/r/volos/core/json.gno @@ -1,7 +1,7 @@ package core import ( - "gno.land/p/demo/json" + "gno.land/p/onbloc/json" u256 "gno.land/p/gnoswap/uint256" "gno.land/p/volos/math" ) diff --git a/contract/r/volos/core/oracle.gno b/contract/r/volos/core/oracle.gno index aa9fe03..933e1c5 100644 --- a/contract/r/volos/core/oracle.gno +++ b/contract/r/volos/core/oracle.gno @@ -1,6 +1,8 @@ package core import ( + "strings" + u256 "gno.land/p/gnoswap/uint256" "gno.land/p/volos/consts" "gno.land/p/volos/math" @@ -14,25 +16,25 @@ func GetPrice(marketId string) *u256.Uint { _, params := GetMarket(marketId) // Get the sqrt price from the pool - sqrtPriceX96Str := pool.PoolGetSlot0SqrtPriceX96(params.PoolPath) - if sqrtPriceX96Str == "" { + sqrtPriceX96 := pool.GetSlot0SqrtPriceX96(params.PoolPath) + if sqrtPriceX96.IsZero() { panic(ErrPriceNotAvailable) } - // Convert string to uint256 - sqrtPriceX96 := u256.MustFromDecimal(sqrtPriceX96Str) - // Square the price to get the actual price in Q192 priceQ192 := new(u256.Uint).Mul(sqrtPriceX96, sqrtPriceX96) - // Finally divide by Q192 to get the actual price ratio with ORACLE_PRICE_SCALE precision - price := math.MulDivDown(priceQ192, consts.ORACLE_PRICE_SCALE, consts.Q192) + // Calculate decimal-adjusted scale factor: 10^(36 + loanDecimals - collateralDecimals) + scaleFactor := u256.MustFromDecimal("1" + strings.Repeat("0", 36 + int(GetToken(params.GetLoanToken()).GetDecimals()) - int(GetToken(params.GetCollateralToken()).GetDecimals()))) + + // Finally divide by Q192 to get the actual price ratio with adjusted precision + price := math.MulDivDown(priceQ192, scaleFactor, consts.Q192) // If token0 is the loan token, we need to invert the price // because Gnoswap's price is always token1/token0 if params.IsToken0Loan { - // Invert price: ORACLE_PRICE_SCALE² / price - price = math.MulDivDown(consts.ORACLE_PRICE_SCALE, consts.ORACLE_PRICE_SCALE, price) + // Invert price: scaleFactor² / price + price = math.MulDivDown(scaleFactor, scaleFactor, price) } return price diff --git a/contract/r/volos/core/periphery.gno b/contract/r/volos/core/periphery.gno index 527f9c9..1845c30 100644 --- a/contract/r/volos/core/periphery.gno +++ b/contract/r/volos/core/periphery.gno @@ -1,7 +1,7 @@ package core import ( - "gno.land/p/demo/avl" + "gno.land/p/nt/avl" u256 "gno.land/p/gnoswap/uint256" "gno.land/p/volos/consts" "gno.land/p/volos/math" @@ -70,26 +70,6 @@ func ExpectedBorrowAssets(marketId string, user string) *u256.Uint { return math.ToAssetsUp(position.BorrowShares, market.TotalBorrowAssets, market.TotalBorrowShares) } -// CalculateBorrowRate returns the current borrow rate per second -// The returned value is WAD-scaled (1e18) -func CalculateBorrowRate(marketId string) *u256.Uint { - // Check if market exists - if _, exists := markets.Get(marketId); !exists { - panic(ErrMarketNotCreated) - } - - market, params := GetMarket(marketId) - - // If no borrows or no IRM, rate is zero - if market.TotalBorrowAssets.IsZero() || params.IRM == "" { - return u256.Zero() - } - - // Get IRM and calculate current borrow rate - irm := GetIRM(params.IRM) - return irm.BorrowRate(market.TotalSupplyAssets, market.TotalBorrowAssets) -} - // CalculateSupplyRate returns the current supply rate per second // The returned value is WAD-scaled (1e18) func CalculateSupplyRate(marketId string) *u256.Uint { @@ -109,24 +89,19 @@ func CalculateSupplyRate(marketId string) *u256.Uint { irm := GetIRM(params.IRM) borrowRate := irm.BorrowRate(market.TotalSupplyAssets, market.TotalBorrowAssets) - // Calculate utilization rate: totalBorrow / totalSupply - utilizationRate := math.WDivDown(market.TotalBorrowAssets, market.TotalSupplyAssets) - // Calculate fee-adjusted borrow rate feeFactor := new(u256.Uint).Sub(consts.WAD, market.Fee) // (1 - fee) - // Supply rate = borrow rate * utilization rate * (1 - fee) - // This formula accounts for: - // 1. Interest is only earned on the portion of funds being borrowed (utilization) - // 2. A portion of interest (the fee) goes to the fee recipient - return math.WMulDown(math.WMulDown(borrowRate, utilizationRate), feeFactor) + // Supply rate = borrow rate * (1 - fee) + // This is the base supply rate before utilization adjustment + return math.WMulDown(borrowRate, feeFactor) } // CalculateBorrowAPR returns the current borrow APR (scaled by WAD) // This converts the per-second rate to an annual rate func CalculateBorrowAPR(marketId string) *u256.Uint { // Get the per-second borrow rate - borrowRatePerSecond := CalculateBorrowRate(marketId) + borrowRatePerSecond := GetBorrowRate(marketId) if borrowRatePerSecond.IsZero() { return u256.Zero() } diff --git a/contract/r/volos/core/types.gno b/contract/r/volos/core/types.gno index f5989e5..9d82f44 100644 --- a/contract/r/volos/core/types.gno +++ b/contract/r/volos/core/types.gno @@ -42,17 +42,17 @@ func (mp *MarketParams) ID() string { // GetLoanToken returns the loan token path from the pool path func (mp *MarketParams) GetLoanToken() string { if mp.IsToken0Loan { - return pl.PoolGetToken0Path(mp.PoolPath) + return pl.GetToken0Path(mp.PoolPath) } - return pl.PoolGetToken1Path(mp.PoolPath) + return pl.GetToken1Path(mp.PoolPath) } // GetCollateralToken returns the collateral token path from the pool path func (mp *MarketParams) GetCollateralToken() string { if mp.IsToken0Loan { - return pl.PoolGetToken1Path(mp.PoolPath) + return pl.GetToken1Path(mp.PoolPath) } - return pl.PoolGetToken0Path(mp.PoolPath) + return pl.GetToken0Path(mp.PoolPath) } // IRM is the interface that all interest rate models must implement diff --git a/contract/r/volos/core/utils.gno b/contract/r/volos/core/utils.gno index 1f5e3dc..5683059 100644 --- a/contract/r/volos/core/utils.gno +++ b/contract/r/volos/core/utils.gno @@ -3,11 +3,11 @@ package core import ( "std" - "gno.land/p/demo/grc/grc20" + "gno.land/p/demo/tokens/grc20" u256 "gno.land/p/gnoswap/uint256" + "gno.land/p/volos/math" - "gno.land/r/demo/grc20reg" - "gno.land/r/gnoswap/v1/pool" + "gno.land/r/demo/defi/grc20reg" ) // GetToken returns a GRC20 token instance @@ -108,22 +108,6 @@ func safeTransferTo(tokenPath string, to std.Address, amount int64) { } } -// Helper function to check if two tokens exist together in a Gnoswap pool -func areTokensPairedInGnoswap(token0, token1 string) bool { - poolPaths := pool.PoolGetPoolList() - for _, poolPath := range poolPaths { - poolToken0 := pool.PoolGetToken0Path(poolPath) - poolToken1 := pool.PoolGetToken1Path(poolPath) - - // Check if both tokens are in this pool (in either order) - if (poolToken0 == token0 && poolToken1 == token1) || - (poolToken0 == token1 && poolToken1 == token0) { - return true - } - } - return false -} - // Min returns the minimum of two uint256 numbers func Min(a, b *u256.Uint) *u256.Uint { if a.Lt(b) { @@ -149,3 +133,15 @@ func IsIRMEnabled(irm string) { panic(ErrIRMNotEnabled) } } + +// calculateUtilization calculates the utilization rate for a market +// Returns utilization as a WAD-scaled value (totalBorrow / totalSupply) +func calculateUtilization(marketId string) *u256.Uint { + market, _ := GetMarket(marketId) + + if market.TotalSupplyAssets.IsZero() { + return u256.Zero() + } + + return math.WDivDown(market.TotalBorrowAssets, market.TotalSupplyAssets) +} diff --git a/contract/r/volos/core/volos.gno b/contract/r/volos/core/volos.gno index 9f5f58d..e358e57 100644 --- a/contract/r/volos/core/volos.gno +++ b/contract/r/volos/core/volos.gno @@ -4,8 +4,8 @@ import ( "std" "time" - "gno.land/p/demo/avl" - "gno.land/p/demo/ownable" + "gno.land/p/nt/avl" + "gno.land/p/nt/ownable" u256 "gno.land/p/gnoswap/uint256" "gno.land/p/volos/consts" @@ -49,7 +49,7 @@ func init() { authorizers = avl.NewTree() // Set initial owner - Ownable = ownable.NewWithAddress(std.Address("g1e9mkmle8rgx4jy2398dal9320uul7g00tkyh42")) + Ownable = ownable.NewWithOrigin() } // RegisterIRM registers a new interest rate model @@ -119,7 +119,7 @@ func SetFeeRecipient(cur realm, newFeeRecipient std.Address) { } // setFee sets the fee for a specific market -func setFee(cur realm, marketId string, newFee *u256.Uint) { +func SetFee(cur realm, marketId string, newFee *u256.Uint) { Ownable.AssertOwnedByPrevious() // Get market (will panic if not found) @@ -154,7 +154,7 @@ func CreateMarket(cur realm, poolPath string, isToken0Loan bool, irm string, llt } // Verify pool exists in Gnoswap - if !pl.DoesPoolPathExist(poolPath) { + if !pl.ExistsPoolPath(poolPath) { panic(ErrTokenPairNotInGnoswap) } @@ -710,9 +710,10 @@ func Liquidate(cur realm, marketId string, borrower std.Address, seizedAssets, r markets.Set(marketId, market) // Handle bad debt if all collateral is seized + var badDebtShares, badDebtAssets *u256.Uint if borrowerPos.Collateral.IsZero() { - badDebtShares := borrowerPos.BorrowShares - badDebtAssets := math.ToAssetsUp( + badDebtShares = borrowerPos.BorrowShares + badDebtAssets = math.ToAssetsUp( badDebtShares, market.TotalBorrowAssets, market.TotalBorrowShares, @@ -725,6 +726,9 @@ func Liquidate(cur realm, marketId string, borrower std.Address, seizedAssets, r market.TotalSupplyAssets = new(u256.Uint).Sub(market.TotalSupplyAssets, badDebtAssets) market.TotalBorrowShares = new(u256.Uint).Sub(market.TotalBorrowShares, badDebtShares) borrowerPos.BorrowShares = u256.Zero() + } else { + badDebtShares = u256.Zero() + badDebtAssets = u256.Zero() } // Transfer seized collateral to liquidator @@ -734,8 +738,8 @@ func Liquidate(cur realm, marketId string, borrower std.Address, seizedAssets, r // Transfer repaid assets from liquidator to contract safeTransferFrom(params.GetLoanToken(), caller, repaidAssets.Int64()) - // Emit liquidate event - emitLiquidate(marketId, caller, borrower, repaidAssets, repaidSharesU256, seizedAssetsU256) + // Emit liquidate event with bad debt information + emitLiquidate(marketId, caller, borrower, repaidAssets, repaidSharesU256, seizedAssetsU256, badDebtAssets, badDebtShares) return seizedAssetsU256.Uint64(), repaidAssets.Uint64() } @@ -857,7 +861,7 @@ func accrueInterest(marketId string) { market.LastUpdate = now markets.Set(marketId, market) - emitAccrueInterest(marketId, borrowRate, interest) + emitAccrueInterest(marketId, borrowRate, interest, market.TotalSupplyAssets, market.TotalBorrowAssets) } /* HEALTH CALCULATIONS */ diff --git a/contract/r/volos/gov/doc.gno b/contract/r/volos/gov/doc.gno new file mode 100644 index 0000000..6344844 --- /dev/null +++ b/contract/r/volos/gov/doc.gno @@ -0,0 +1,20 @@ +// Package gov provides the entry point and coordination for the Volos protocol's +// on-chain governance system. +// +// The Volos governance system is composed of several tightly integrated +// contracts. vls.gno implements the VLS governance token, which is +// freely transferable and used for staking. The staker.gno contract manages +// staking and delegation: users stake VLS to mint xVLS to themselves or a +// delegatee, and unstaking triggers a cooldown before VLS can be withdrawn. +// Only the staker contract can mint or burn xVLS. +// +// xvls.gno defines the xVLS token, a non-transferable representation of staked +// VLS. xVLS determines voting power in governance. The governance contract +// contains the DAO logic, built on commondao.gno, where only xVLS holders are +// members and can propose or vote. Membership is updated automatically by +// staking actions. +// +// Together, these contracts enable secure, weighted, and flexible on-chain +// governance for the Volos protocol, with clear separation of concerns between +// token logic, staking and delegation, and proposal and voting mechanisms. +package gov diff --git a/contract/r/volos/gov/gnomod.toml b/contract/r/volos/gov/gnomod.toml new file mode 100644 index 0000000..e5b56ea --- /dev/null +++ b/contract/r/volos/gov/gnomod.toml @@ -0,0 +1,2 @@ +module = "gno.land/r/volos/gov" +gno = "0.9" diff --git a/contract/r/volos/gov/governance/api.gno b/contract/r/volos/gov/governance/api.gno index 1c7961a..1348d0f 100644 --- a/contract/r/volos/gov/governance/api.gno +++ b/contract/r/volos/gov/governance/api.gno @@ -4,7 +4,7 @@ import ( "std" "strconv" - "gno.land/p/demo/json" + "gno.land/p/onbloc/json" ) // ApiGetProposal returns a proposal as JSON object diff --git a/contract/r/volos/gov/governance/errors.gno b/contract/r/volos/gov/governance/errors.gno index e75a6c8..73d1349 100644 --- a/contract/r/volos/gov/governance/errors.gno +++ b/contract/r/volos/gov/governance/errors.gno @@ -8,4 +8,5 @@ var ( ErrNoXVLS = errors.New("cannot add member: address does not hold any xVLS") ErrVotingDeadlineNotMet = errors.New("voting deadline not met") ErrNotStaker = errors.New("only staker can call this function") + ErrVotingPeriodExceedsMaximum = errors.New("voting period exceeds maximum allowed duration") ) diff --git a/contract/r/volos/gov/governance/events.gno b/contract/r/volos/gov/governance/events.gno index f1f5546..6e890c5 100644 --- a/contract/r/volos/gov/governance/events.gno +++ b/contract/r/volos/gov/governance/events.gno @@ -44,6 +44,7 @@ const ( EventNewThresholdKey = "new_threshold" EventQuorumKey = "quorum" EventXvlsAmountKey = "xvls_amount" + EventStatusKey = "status" ) func emitProposalCreated(caller std.Address, proposalID uint64, title, body string, deadline, quorum int64) { @@ -59,11 +60,12 @@ func emitProposalCreated(caller std.Address, proposalID uint64, title, body stri ) } -func emitProposalExecuted(caller std.Address, proposalID uint64) { +func emitProposalExecuted(caller std.Address, proposalID uint64, status string) { std.Emit( EventProposalExecuted, EventCallerKey, caller.String(), EventProposalIDKey, strconv.FormatUint(proposalID, 10), + EventStatusKey, status, EventTimestampKey, strconv.FormatInt(time.Now().Unix(), 10), ) } diff --git a/contract/r/volos/gov/governance/governance.gno b/contract/r/volos/gov/governance/governance.gno index d7b27fc..13185af 100644 --- a/contract/r/volos/gov/governance/governance.gno +++ b/contract/r/volos/gov/governance/governance.gno @@ -10,6 +10,7 @@ package governance import ( "std" + "time" "gno.land/p/moul/authz" "gno.land/p/nt/commondao" @@ -19,6 +20,7 @@ var ( volosGovernance *commondao.CommonDAO proposalThreshold int64 = 1000 //min xVLS required to create a proposal votingPowerQuorum int64 = 1000 //minimum xVLS voting power required for a proposal to pass (0 = disabled) + maximumProposalDuration time.Duration = 14 * 24 * time.Hour //maximum duration of a proposal authorizer = authz.NewWithAuthority(authz.NewMemberAuthority( std.DerivePkgAddr("gno.land/r/volos/gov/staker"), @@ -55,6 +57,14 @@ func SetVotingPowerQuorum(newQuorum int64) { }) } +// SetMaximumProposalDuration allows governance to change the maximum proposal duration. +func SetMaximumProposalDuration(newMax time.Duration) { + authorizer.DoByCurrent("set_maximum_proposal_duration", func() error { + maximumProposalDuration = newMax + return nil + }) +} + // MemberSet returns a read-only view of the current member set for analytics and governance logic. func MemberSet() commondao.MemberSet { return commondao.NewMemberSet(volosGovernance.Members()) @@ -75,6 +85,11 @@ func VotingPowerQuorumEnabled() bool { return votingPowerQuorum > 0 } +// MaximumProposalDuration returns the current maximum allowed proposal duration. +func MaximumProposalDuration() time.Duration { + return maximumProposalDuration +} + // Render function for explorer integration. func Render(path string) string { return "Volos Governance - On-chain governance for the Volos protocol" diff --git a/contract/r/volos/gov/governance/governance_test.gno b/contract/r/volos/gov/governance/governance_test.gno index 911c13d..f583a23 100644 --- a/contract/r/volos/gov/governance/governance_test.gno +++ b/contract/r/volos/gov/governance/governance_test.gno @@ -5,8 +5,8 @@ import ( "testing" "time" - "gno.land/p/demo/uassert" - "gno.land/p/demo/urequire" + "gno.land/p/nt/uassert" + "gno.land/p/nt/urequire" "gno.land/p/nt/commondao" "gno.land/r/volos/gov/xvls" ) @@ -446,3 +446,34 @@ func TestProposal_QuorumChangesDontAffectActiveProposals(cur realm, t *testing.T SetVotingPowerQuorum(1000) }) } + +func TestProposal_MaximumDurationEnforced(cur realm, t *testing.T) { + staker := "gno.land/r/volos/gov/staker" + gov := "gno.land/r/volos/gov/governance" + alice := std.DerivePkgAddr("gno.land/r/volos/gov/alice") + + crossThrough(std.NewCodeRealm(staker), func() { + xvls.Mint(cross, alice, 10_000) + AddMember(cross, alice) + }) + + max := MaximumProposalDuration() + urequire.True(t, max > 0) + + crossThrough(std.NewUserRealm(alice), func() { + uassert.AbortsWithMessage(t, "voting period exceeds maximum allowed duration", func() { + CreateProposal(cross, "Too long", "Body", max+time.Second, func() {}) + }) + }) + + crossThrough(std.NewCodeRealm(gov), func() { + SetMaximumProposalDuration(max + time.Hour) + }) + + urequire.Equal(t, int64(max+time.Hour), int64(MaximumProposalDuration())) + + crossThrough(std.NewUserRealm(alice), func() { + p := CreateProposal(cross, "Within new max", "Body", max+time.Second, func() {}) + urequire.NotEqual(t, nil, p) + }) +} diff --git a/contract/r/volos/gov/governance/json.gno b/contract/r/volos/gov/governance/json.gno index 3e767e5..4a13f34 100644 --- a/contract/r/volos/gov/governance/json.gno +++ b/contract/r/volos/gov/governance/json.gno @@ -3,7 +3,7 @@ package governance import ( "std" - "gno.land/p/demo/json" + "gno.land/p/onbloc/json" "gno.land/p/nt/commondao" "gno.land/r/volos/gov/vls" "gno.land/r/volos/gov/xvls" diff --git a/contract/r/volos/gov/governance/members_test.gno b/contract/r/volos/gov/governance/members_test.gno index c453283..d68bdf5 100644 --- a/contract/r/volos/gov/governance/members_test.gno +++ b/contract/r/volos/gov/governance/members_test.gno @@ -4,8 +4,8 @@ import ( "std" "testing" - "gno.land/p/demo/uassert" - "gno.land/p/demo/urequire" + "gno.land/p/nt/uassert" + "gno.land/p/nt/urequire" "gno.land/r/volos/gov/xvls" ) diff --git a/contract/r/volos/gov/governance/proposal.gno b/contract/r/volos/gov/governance/proposal.gno index 82d5b28..b7c6915 100644 --- a/contract/r/volos/gov/governance/proposal.gno +++ b/contract/r/volos/gov/governance/proposal.gno @@ -8,7 +8,7 @@ import ( "std" "time" - "gno.land/p/demo/avl" + "gno.land/p/nt/avl" "gno.land/p/nt/commondao" "gno.land/r/volos/gov/xvls" ) @@ -90,6 +90,10 @@ func CreateProposal(cur realm, title, body string, votingPeriod time.Duration, a panic(ErrInsufficientXVLS) } + if votingPeriod > maximumProposalDuration { + panic(ErrVotingPeriodExceedsMaximum) + } + def := VolosProposalDefinition{ TitleField: title, BodyField: body, @@ -118,7 +122,7 @@ func Execute(cur realm, proposalID uint64) { panic(err) } - emitProposalExecuted(caller, proposalID) + emitProposalExecuted(caller, proposalID, string(volosGovernance.GetProposal(proposalID).Status())) } // GetUserActiveProposals returns all active proposals that the given user has voted on. diff --git a/contract/r/volos/gov/governance/proposal_test.gno b/contract/r/volos/gov/governance/proposal_test.gno index c2ba358..d388da7 100644 --- a/contract/r/volos/gov/governance/proposal_test.gno +++ b/contract/r/volos/gov/governance/proposal_test.gno @@ -5,8 +5,8 @@ import ( "testing" "time" - "gno.land/p/demo/uassert" - "gno.land/p/demo/urequire" + "gno.land/p/nt/uassert" + "gno.land/p/nt/urequire" "gno.land/p/nt/commondao" "gno.land/r/volos/gov/xvls" ) diff --git a/contract/r/volos/gov/governance/vote_test.gno b/contract/r/volos/gov/governance/vote_test.gno index c8feccd..7359cb0 100644 --- a/contract/r/volos/gov/governance/vote_test.gno +++ b/contract/r/volos/gov/governance/vote_test.gno @@ -5,8 +5,8 @@ import ( "testing" "time" - "gno.land/p/demo/uassert" - "gno.land/p/demo/urequire" + "gno.land/p/nt/uassert" + "gno.land/p/nt/urequire" "gno.land/p/nt/commondao" "gno.land/r/volos/gov/xvls" ) diff --git a/contract/r/volos/gov/staker/events.gno b/contract/r/volos/gov/staker/events.gno index f17fffa..6b91bde 100644 --- a/contract/r/volos/gov/staker/events.gno +++ b/contract/r/volos/gov/staker/events.gno @@ -6,7 +6,7 @@ import ( "strings" "time" - "gno.land/p/demo/seqid" + "gno.land/p/nt/seqid" ) // Events diff --git a/contract/r/volos/gov/staker/staker.gno b/contract/r/volos/gov/staker/staker.gno index acf3db3..ee2c68f 100644 --- a/contract/r/volos/gov/staker/staker.gno +++ b/contract/r/volos/gov/staker/staker.gno @@ -14,9 +14,9 @@ import ( "std" "time" - "gno.land/p/demo/avl" - "gno.land/p/demo/avl/rotree" - "gno.land/p/demo/seqid" + "gno.land/p/nt/avl" + "gno.land/p/nt/avl/rotree" + "gno.land/p/nt/seqid" "gno.land/p/moul/authz" "gno.land/r/volos/gov/governance" "gno.land/r/volos/gov/vls" @@ -159,7 +159,7 @@ func WithdrawUnstaked(cur realm) { } if totalToWithdraw == 0 { - panic(ErrCooldownNotFinished) + panic(ErrNoReadyUnstake) } vls.Transfer(cross, caller, totalToWithdraw) diff --git a/contract/r/volos/gov/staker/staker_test.gno b/contract/r/volos/gov/staker/staker_test.gno index 7f80f2f..990c351 100644 --- a/contract/r/volos/gov/staker/staker_test.gno +++ b/contract/r/volos/gov/staker/staker_test.gno @@ -4,8 +4,8 @@ import ( "std" "testing" - "gno.land/p/demo/uassert" - "gno.land/p/demo/urequire" + "gno.land/p/nt/uassert" + "gno.land/p/nt/urequire" "gno.land/r/volos/gov/governance" "gno.land/r/volos/gov/vls" "gno.land/r/volos/gov/xvls" diff --git a/contract/r/volos/gov/staker/utils.gno b/contract/r/volos/gov/staker/utils.gno index 5e0ae5c..5d259ea 100644 --- a/contract/r/volos/gov/staker/utils.gno +++ b/contract/r/volos/gov/staker/utils.gno @@ -3,7 +3,7 @@ package staker import ( "std" - "gno.land/p/demo/avl" + "gno.land/p/nt/avl" "gno.land/r/volos/gov/governance" ) diff --git a/contract/r/volos/gov/vls/api.gno b/contract/r/volos/gov/vls/api.gno index 3cc69f7..817d296 100644 --- a/contract/r/volos/gov/vls/api.gno +++ b/contract/r/volos/gov/vls/api.gno @@ -3,7 +3,7 @@ package vls import ( "std" - "gno.land/p/demo/json" + "gno.land/p/onbloc/json" ) // ApiGetTokenInfo returns VLS token information as JSON object diff --git a/contract/r/volos/gov/vls/json.gno b/contract/r/volos/gov/vls/json.gno index 7ea501e..031b635 100644 --- a/contract/r/volos/gov/vls/json.gno +++ b/contract/r/volos/gov/vls/json.gno @@ -3,7 +3,7 @@ package vls import ( "std" - "gno.land/p/demo/json" + "gno.land/p/onbloc/json" ) type RpcTokenInfo struct { diff --git a/contract/r/volos/gov/vls/vls.gno b/contract/r/volos/gov/vls/vls.gno index 8ff9add..b6808d0 100644 --- a/contract/r/volos/gov/vls/vls.gno +++ b/contract/r/volos/gov/vls/vls.gno @@ -15,9 +15,9 @@ package vls import ( "std" - "gno.land/p/demo/grc/grc20" + "gno.land/p/demo/tokens/grc20" "gno.land/p/moul/authz" - "gno.land/r/demo/grc20reg" + "gno.land/r/demo/defi/grc20reg" ) var ( diff --git a/contract/r/volos/gov/vls/vls_test.gno b/contract/r/volos/gov/vls/vls_test.gno index f829514..7674a0b 100644 --- a/contract/r/volos/gov/vls/vls_test.gno +++ b/contract/r/volos/gov/vls/vls_test.gno @@ -4,7 +4,7 @@ import ( "std" "testing" - "gno.land/p/demo/urequire" + "gno.land/p/nt/urequire" ) func crossThrough(rlm std.Realm, cr func()) { diff --git a/contract/r/volos/gov/xvls/api.gno b/contract/r/volos/gov/xvls/api.gno index 7a23bcd..fc270c4 100644 --- a/contract/r/volos/gov/xvls/api.gno +++ b/contract/r/volos/gov/xvls/api.gno @@ -3,7 +3,7 @@ package xvls import ( "std" - "gno.land/p/demo/json" + "gno.land/p/onbloc/json" ) // ApiGetTokenInfo returns xVLS token information as JSON object diff --git a/contract/r/volos/gov/xvls/json.gno b/contract/r/volos/gov/xvls/json.gno index 57ce18e..9197a1f 100644 --- a/contract/r/volos/gov/xvls/json.gno +++ b/contract/r/volos/gov/xvls/json.gno @@ -3,7 +3,7 @@ package xvls import ( "std" - "gno.land/p/demo/json" + "gno.land/p/onbloc/json" ) type RpcTokenInfo struct { diff --git a/contract/r/volos/gov/xvls/xvls.gno b/contract/r/volos/gov/xvls/xvls.gno index a0160a1..980be89 100644 --- a/contract/r/volos/gov/xvls/xvls.gno +++ b/contract/r/volos/gov/xvls/xvls.gno @@ -12,9 +12,9 @@ package xvls import ( "std" - "gno.land/p/demo/grc/grc20" + "gno.land/p/demo/tokens/grc20" "gno.land/p/moul/authz" - "gno.land/r/demo/grc20reg" + "gno.land/r/demo/defi/grc20reg" ) var ( diff --git a/contract/r/volos/gov/xvls/xvls_test.gno b/contract/r/volos/gov/xvls/xvls_test.gno index ba77123..a64eca2 100644 --- a/contract/r/volos/gov/xvls/xvls_test.gno +++ b/contract/r/volos/gov/xvls/xvls_test.gno @@ -4,8 +4,8 @@ import ( "std" "testing" - "gno.land/p/demo/uassert" - "gno.land/p/demo/urequire" + "gno.land/p/nt/uassert" + "gno.land/p/nt/urequire" ) func crossThrough(rlm std.Realm, cr func()) { diff --git a/tests/volos/create_proposals.gno b/contract/r/volos/mocks/create_proposals.gno similarity index 60% rename from tests/volos/create_proposals.gno rename to contract/r/volos/mocks/create_proposals.gno index c05af70..a6f22ff 100644 --- a/tests/volos/create_proposals.gno +++ b/contract/r/volos/mocks/create_proposals.gno @@ -1,8 +1,11 @@ -package main +package mocks import ( "time" + "std" "gno.land/r/volos/gov/governance" + "gno.land/r/volos/gov/vls" + "gno.land/r/volos/gov/staker" ) // callback function that will be executed if the proposal passes @@ -11,26 +14,30 @@ func callback() { // In a real scenario, this could update governance parameters, mint tokens, etc. } -func main() { +func CreateProposals(cur realm) { + vls.Faucet(cross, 100000000) + vls.Approve(cross, std.DerivePkgAddr("gno.land/r/volos/gov/staker"), 100000000) + staker.Stake(cross, 100000, std.DerivePkgAddr("gno.land/r/volos/mocks")) + governance.CreateProposal( cross, - "Test Proposal", + "Test Proposal 1", "This is a test proposal to verify governance functionality", - time.Duration(5*time.Hour), + time.Duration(1*time.Minute), callback, ) governance.CreateProposal( cross, - "Test Proposal", + "Test Proposal 2", "This is a test proposal to verify governance functionality", - time.Duration(5*time.Hour), + time.Duration(1*time.Minute), callback, ) governance.CreateProposal( cross, - "Test Proposal", + "Test Proposal 3", "This is a test proposal to verify governance functionality", time.Duration(5*time.Hour), callback, diff --git a/contract/r/volos/mocks/flash_borrower.gno b/contract/r/volos/mocks/flash_borrower.gno index 1a4970b..46c0197 100644 --- a/contract/r/volos/mocks/flash_borrower.gno +++ b/contract/r/volos/mocks/flash_borrower.gno @@ -3,7 +3,7 @@ package mocks import ( "std" - "gno.land/r/demo/grc20reg" + "gno.land/r/demo/defi/grc20reg" volos "gno.land/r/volos/core" ) diff --git a/contract/r/volos/render/home.gno b/contract/r/volos/render/home.gno index 2159e1a..1328847 100644 --- a/contract/r/volos/render/home.gno +++ b/contract/r/volos/render/home.gno @@ -1,12 +1,12 @@ package render import ( - "gno.land/p/demo/avl" - "gno.land/p/demo/avl/pager" - "gno.land/p/demo/avl/rotree" + "gno.land/p/nt/avl" + "gno.land/p/nt/avl/pager" + "gno.land/p/nt/avl/rotree" "gno.land/p/moul/md" "gno.land/p/moul/mdtable" - "gno.land/r/demo/grc20reg" + "gno.land/r/demo/defi/grc20reg" volos "gno.land/r/volos/core" ) diff --git a/contract/r/volos/render/market.gno b/contract/r/volos/render/market.gno index a84fe52..42992f5 100644 --- a/contract/r/volos/render/market.gno +++ b/contract/r/volos/render/market.gno @@ -6,12 +6,12 @@ import ( "strconv" "strings" - "gno.land/p/demo/avl" - "gno.land/p/demo/avl/pager" - "gno.land/p/demo/avl/rotree" + "gno.land/p/nt/avl" + "gno.land/p/nt/avl/pager" + "gno.land/p/nt/avl/rotree" "gno.land/p/moul/md" "gno.land/p/moul/mdtable" - "gno.land/r/demo/grc20reg" + "gno.land/r/demo/defi/grc20reg" "gno.land/r/sys/users" volos "gno.land/r/volos/core" ) diff --git a/contract/r/volos/render/user.gno b/contract/r/volos/render/user.gno index b0684de..ee7977a 100644 --- a/contract/r/volos/render/user.gno +++ b/contract/r/volos/render/user.gno @@ -8,7 +8,7 @@ import ( "gno.land/p/matijamarjanovic/charts" "gno.land/p/moul/md" "gno.land/p/moul/mdtable" - "gno.land/r/demo/grc20reg" + "gno.land/r/demo/defi/grc20reg" "gno.land/r/sys/users" volos "gno.land/r/volos/core" ) diff --git a/contract/r/volos/render/utils.gno b/contract/r/volos/render/utils.gno index 99134cb..4b52d4e 100644 --- a/contract/r/volos/render/utils.gno +++ b/contract/r/volos/render/utils.gno @@ -5,7 +5,7 @@ import ( "strings" "time" - "gno.land/p/demo/ufmt" + "gno.land/p/nt/ufmt" volos "gno.land/r/volos/core" ) diff --git a/tests/gnoswap/_info.mk b/tests/gnoswap/_info.mk index a6c4dcb..4739083 100644 --- a/tests/gnoswap/_info.mk +++ b/tests/gnoswap/_info.mk @@ -1,5 +1,5 @@ -# r/demo/wugnot from gno -ADDR_WUGNOT := g1pf6dv9fjk3rn0m4jjcne306ga4he3mzmupfjl6 +# r/gnoland/wugnot from gno +ADDR_WUGNOT := g15vj5q08amlvyd0nx6zjgcvwq2d0gt9fcchrvum # based on v1 ADDR_POOL := g148tjamj80yyrm309z7rk690an22thd2l3z8ank @@ -10,7 +10,7 @@ ADDR_PROTOCOL_FEE := g1f7wpek7q67tkns27sw495u5yuu3a5wwjxw5l6l ADDR_GOV_STAKER := g17e3ykyqk9jmqe2y9wxe9zhep3p7cw56davjqwa ADR_GOV_GOV := g17s8w2ve7k85fwfnrk59lmlhthkjdted8whvqxd ADDR_LAUNCHPAD := g122mau2lp2rc0scs8d27pkkuys4w54mdy2tuer3 -ADDR_GNS := g1jgqwaa2le3yr63d533fj785qkjspumzv22ys5m +ADDR_GNS := g13ffa5r3mqfxu3s7ejl02scq9536wt6c2t789dm ADDR_GNFT := g1wxv2rdfn53qc84nt3nn646f9yh3nly8lm7j89t # username address diff --git a/tests/gnoswap/test.mk b/tests/gnoswap/test.mk index 9e6b985..2260f18 100644 --- a/tests/gnoswap/test.mk +++ b/tests/gnoswap/test.mk @@ -1,12 +1,12 @@ include _info.mk -GNS_PATH := gno.land/r/gnoswap/v1/gns -USDC_PATH := gno.land/r/gnoswap/v1/test_token/usdc -BAZ_PATH := gno.land/r/gnoswap/v1/test_token/baz -BAR_PATH := gno.land/r/gnoswap/v1/test_token/bar -OBL_PATH := gno.land/r/gnoswap/v1/test_token/obl -QUX_PATH := gno.land/r/gnoswap/v1/test_token/qux -FOO_PATH := gno.land/r/gnoswap/v1/test_token/foo +GNS_PATH := gno.land/r/gnoswap/gns +USDC_PATH := gno.land/r/gnoswap/test_token/usdc +BAZ_PATH := gno.land/r/gnoswap/test_token/baz +BAR_PATH := gno.land/r/gnoswap/test_token/bar +OBL_PATH := gno.land/r/gnoswap/test_token/obl +QUX_PATH := gno.land/r/gnoswap/test_token/qux +FOO_PATH := gno.land/r/gnoswap/test_token/foo ADDR_TEST_ADMIN := g1e9mkmle8rgx4jy2398dal9320uul7g00tkyh42 ADDR_USER_1 := g149gwxltsfg6dghhq0txu8kam7chfpt9amnx4yx @@ -29,65 +29,65 @@ transfer-ugnot: transfer-gns: $(info ************ transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP) ************) - @echo "" | gnokey maketx call -pkgpath $(GNS_PATH) -func Transfer -args $(ADDR_TEST_ADMIN) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(GNS_PATH) -func Transfer -args $(ADDR_USER_1) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(GNS_PATH) -func Transfer -args $(ADDR_USER_2) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(GNS_PATH) -func Transfer -args $(ADDR_USER_3) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(GNS_PATH) -func Transfer -args $(ADDR_USER_4) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 + @echo "" | gnokey maketx call -pkgpath $(GNS_PATH) -func Transfer -args $(ADDR_TEST_ADMIN) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(GNS_PATH) -func Transfer -args $(ADDR_USER_1) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(GNS_PATH) -func Transfer -args $(ADDR_USER_2) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(GNS_PATH) -func Transfer -args $(ADDR_USER_3) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(GNS_PATH) -func Transfer -args $(ADDR_USER_4) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin @echo transfer-usdc: $(info ************ transfer 1_000_000_000 USDC to $(ADDR_GNOSWAP) ************) - @echo "" | gnokey maketx call -pkgpath $(USDC_PATH) -func Transfer -args $(ADDR_TEST_ADMIN) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(USDC_PATH) -func Transfer -args $(ADDR_USER_1) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(USDC_PATH) -func Transfer -args $(ADDR_USER_2) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(USDC_PATH) -func Transfer -args $(ADDR_USER_3) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(USDC_PATH) -func Transfer -args $(ADDR_USER_4) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 + @echo "" | gnokey maketx call -pkgpath $(USDC_PATH) -func Transfer -args $(ADDR_TEST_ADMIN) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(USDC_PATH) -func Transfer -args $(ADDR_USER_1) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(USDC_PATH) -func Transfer -args $(ADDR_USER_2) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(USDC_PATH) -func Transfer -args $(ADDR_USER_3) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(USDC_PATH) -func Transfer -args $(ADDR_USER_4) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin @echo transfer-baz: $(info ************ transfer 1_000_000_000 BAZ to $(ADDR_GNOSWAP) ************) - @echo "" | gnokey maketx call -pkgpath $(BAZ_PATH) -func Transfer -args $(ADDR_TEST_ADMIN) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(BAZ_PATH) -func Transfer -args $(ADDR_USER_1) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(BAZ_PATH) -func Transfer -args $(ADDR_USER_2) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(BAZ_PATH) -func Transfer -args $(ADDR_USER_3) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(BAZ_PATH) -func Transfer -args $(ADDR_USER_4) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 + @echo "" | gnokey maketx call -pkgpath $(BAZ_PATH) -func Transfer -args $(ADDR_TEST_ADMIN) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(BAZ_PATH) -func Transfer -args $(ADDR_USER_1) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(BAZ_PATH) -func Transfer -args $(ADDR_USER_2) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(BAZ_PATH) -func Transfer -args $(ADDR_USER_3) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(BAZ_PATH) -func Transfer -args $(ADDR_USER_4) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin @echo transfer-bar: $(info ************ transfer 1_000_000_000 BAR to $(ADDR_GNOSWAP) ************) - @echo "" | gnokey maketx call -pkgpath $(BAR_PATH) -func Transfer -args $(ADDR_TEST_ADMIN) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(BAR_PATH) -func Transfer -args $(ADDR_USER_1) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(BAR_PATH) -func Transfer -args $(ADDR_USER_2) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(BAR_PATH) -func Transfer -args $(ADDR_USER_3) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(BAR_PATH) -func Transfer -args $(ADDR_USER_4) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 + @echo "" | gnokey maketx call -pkgpath $(BAR_PATH) -func Transfer -args $(ADDR_TEST_ADMIN) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(BAR_PATH) -func Transfer -args $(ADDR_USER_1) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(BAR_PATH) -func Transfer -args $(ADDR_USER_2) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(BAR_PATH) -func Transfer -args $(ADDR_USER_3) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(BAR_PATH) -func Transfer -args $(ADDR_USER_4) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin @echo transfer-obl: $(info ************ transfer 1_000_000_000 OBL to $(ADDR_GNOSWAP) ************) - @echo "" | gnokey maketx call -pkgpath $(OBL_PATH) -func Transfer -args $(ADDR_TEST_ADMIN) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(OBL_PATH) -func Transfer -args $(ADDR_USER_1) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(OBL_PATH) -func Transfer -args $(ADDR_USER_2) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(OBL_PATH) -func Transfer -args $(ADDR_USER_3) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(OBL_PATH) -func Transfer -args $(ADDR_USER_4) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 + @echo "" | gnokey maketx call -pkgpath $(OBL_PATH) -func Transfer -args $(ADDR_TEST_ADMIN) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(OBL_PATH) -func Transfer -args $(ADDR_USER_1) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(OBL_PATH) -func Transfer -args $(ADDR_USER_2) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(OBL_PATH) -func Transfer -args $(ADDR_USER_3) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(OBL_PATH) -func Transfer -args $(ADDR_USER_4) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin @echo transfer-qux: $(info ************ transfer 1_000_000_000 QUX to $(ADDR_GNOSWAP) ************) - @echo "" | gnokey maketx call -pkgpath $(QUX_PATH) -func Transfer -args $(ADDR_TEST_ADMIN) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(QUX_PATH) -func Transfer -args $(ADDR_USER_1) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(QUX_PATH) -func Transfer -args $(ADDR_USER_2) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(QUX_PATH) -func Transfer -args $(ADDR_USER_3) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(QUX_PATH) -func Transfer -args $(ADDR_USER_4) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 + @echo "" | gnokey maketx call -pkgpath $(QUX_PATH) -func Transfer -args $(ADDR_TEST_ADMIN) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(QUX_PATH) -func Transfer -args $(ADDR_USER_1) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(QUX_PATH) -func Transfer -args $(ADDR_USER_2) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(QUX_PATH) -func Transfer -args $(ADDR_USER_3) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(QUX_PATH) -func Transfer -args $(ADDR_USER_4) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin @echo transfer-foo: $(info ************ transfer 1_000_000_000 FOO to $(ADDR_GNOSWAP) ************) - @echo "" | gnokey maketx call -pkgpath $(FOO_PATH) -func Transfer -args $(ADDR_TEST_ADMIN) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(FOO_PATH) -func Transfer -args $(ADDR_USER_1) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(FOO_PATH) -func Transfer -args $(ADDR_USER_2) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(FOO_PATH) -func Transfer -args $(ADDR_USER_3) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 - @echo "" | gnokey maketx call -pkgpath $(FOO_PATH) -func Transfer -args $(ADDR_USER_4) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" test1 + @echo "" | gnokey maketx call -pkgpath $(FOO_PATH) -func Transfer -args $(ADDR_TEST_ADMIN) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(FOO_PATH) -func Transfer -args $(ADDR_USER_1) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(FOO_PATH) -func Transfer -args $(ADDR_USER_2) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(FOO_PATH) -func Transfer -args $(ADDR_USER_3) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath $(FOO_PATH) -func Transfer -args $(ADDR_USER_4) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "transfer 1_000_000_000 GNS to $(ADDR_GNOSWAP)" gnoswap_admin @echo faucet-ugnot: @@ -98,68 +98,63 @@ faucet-ugnot: # pool create pool-create-gns-wugnot-default: $(info ************ create default pool (GNS:WUGNOT:0.03%) ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gns -func Approve -args $(ADDR_POOL) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/pool -func CreatePool -args "gno.land/r/demo/wugnot" -args "gno.land/r/gnoswap/v1/gns" -args 3000 -args 79228162514264337593543950337 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/gns -func Approve -args $(ADDR_POOL) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/pool -func CreatePool -args "gno.land/r/gnoland/wugnot" -args "gno.land/r/gnoswap/gns" -args 3000 -args 79228162514264337593543950337 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # pool create 2 pool-create-bar-wugnot-default: $(info ************ create default pool (BAR:WUGNOT:0.03%) ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/test_token/bar -func Approve -args $(ADDR_POOL) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/pool -func CreatePool -args "gno.land/r/demo/wugnot" -args "gno.land/r/gnoswap/v1/test_token/bar" -args 3000 -args 79228162514264337593543950337 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/test_token/bar -func Approve -args $(ADDR_POOL) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/pool -func CreatePool -args "gno.land/r/gnoland/wugnot" -args "gno.land/r/gnoswap/test_token/bar" -args 3000 -args 79228162514264337593543950337 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo + # mint new position mint-gns-gnot: $(info ************ mint position(1) to gns:wugnot ************) # APPROVE FISRT - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gns -func Approve -args $(ADDR_POOL) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/wugnot -func Approve -args $(ADDR_POOL) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/gns -func Approve -args $(ADDR_POOL) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoland/wugnot -func Approve -args $(ADDR_POOL) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @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_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoland/wugnot -func Approve -args $(ADDR_POSITION) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # THEN MINT - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/position -func Mint -send "20000000ugnot" -args "gno.land/r/gnoswap/v1/gns" -args "gnot" -args 3000 -args "-49980" -args "49980" -args 20000000 -args 20000000 -args 1 -args 1 -args $(TX_EXPIRE) -args $(ADDR_ADMIN) -args $(ADDR_ADMIN) -args "" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/position -func Mint -send "20000000ugnot" -args "gno.land/r/gnoswap/gns" -args "gnot" -args 3000 -args "-49980" -args "49980" -args 20000000 -args 20000000 -args 1 -args 1 -args $(TX_EXPIRE) -args $(ADDR_ADMIN) -args $(ADDR_ADMIN) -args "" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo - # SetTokenURI - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gnft -func SetTokenURIByImageURI -args "1" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 - @echo # mint new position mint-bar-wugnot: $(info ************ mint position(1) to bar:wugnot ************) # APPROVE FISRT - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/test_token/bar -func Approve -args $(ADDR_POOL) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/wugnot -func Approve -args $(ADDR_POOL) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/test_token/bar -func Approve -args $(ADDR_POOL) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoland/wugnot -func Approve -args $(ADDR_POOL) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @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_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoland/wugnot -func Approve -args $(ADDR_POSITION) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # THEN MINT - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/position -func Mint -send "20000000ugnot" -args "gno.land/r/gnoswap/v1/test_token/bar" -args "gnot" -args 3000 -args "-49980" -args "49980" -args 20000000 -args 20000000 -args 1 -args 1 -args $(TX_EXPIRE) -args $(ADDR_GNOSWAP) -args $(ADDR_GNOSWAP) -args "" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/position -func Mint -send "20000000ugnot" -args "gno.land/r/gnoswap/test_token/bar" -args "gnot" -args 3000 -args "-49980" -args "49980" -args 20000000 -args 20000000 -args 1 -args 1 -args $(TX_EXPIRE) -args $(ADDR_GNOSWAP) -args $(ADDR_GNOSWAP) -args "" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo - # SetTokenURI - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gnft -func SetTokenURIByImageURI -args "2" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 - @echo # increase liquidity increase-liquidity-position-01: $(info ************ increase position(1) liquidity gnot:gns:3000 ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/position -func IncreaseLiquidity -send "20000000ugnot" -args 1 -args 20000000 -args 20000000 -args 1 -args 1 -args $(TX_EXPIRE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/position -func IncreaseLiquidity -send "20000000ugnot" -args 1 -args 20000000 -args 20000000 -args 1 -args 1 -args $(TX_EXPIRE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # decrease liquidity decrease-liquidity-position-01: $(info ************ decrease position(1) liquidity gnot:gns:3000 ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/position -func DecreaseLiquidity -args 1 -args 12345678 -args 0 -args 0 -args $(TX_EXPIRE) -args "false" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/position -func DecreaseLiquidity -args 1 -args 12345678 -args 0 -args 0 -args $(TX_EXPIRE) -args "false" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo @@ -167,33 +162,33 @@ decrease-liquidity-position-01: create-external-incentive: $(info ************ create external incentive [gns] => gnot:gns:3000 ************) # APPROVE REWARD (+ DepositGNS) - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gns -func Approve -args $(ADDR_STAKER) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/gns -func Approve -args $(ADDR_STAKER) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # THEN CREATE EXTERNAL INCENTIVE - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/staker -func CreateExternalIncentive -args "gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/gns:3000" -args "gno.land/r/gnoswap/v1/gns" -args 1000000000 -args $(TOMORROW_MIDNIGHT) -args $(INCENTIVE_END) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/staker -func CreateExternalIncentive -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000" -args "gno.land/r/gnoswap/gns" -args 1000000000 -args $(TOMORROW_MIDNIGHT) -args $(INCENTIVE_END) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # stake token stake-token-1: $(info ************ stake token 1 ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gnft -func Approve -args $(ADDR_STAKER) -args 1 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/staker -func StakeToken -args 1 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gnft -func Approve -args $(ADDR_STAKER) -args 1 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/staker -func StakeToken -args 1 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # collect staking reward collect-staking-reward-1: $(info ************ collect reward 1 ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/staker -func CollectReward -args 1 -args false -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/staker -func CollectReward -args 1 -args false -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # unstake token unstake-token-1: $(info ************ unstake token 1 ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/staker -func UnStakeToken -args 1 -args true -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/staker -func UnStakeToken -args 1 -args true -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo @@ -201,12 +196,12 @@ unstake-token-1: swap-exact-in-gns-wugnot: $(info ************ swap gns -> wgnot, exact_in ************) # approve INPUT TOKEN to POOL - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gns -func Approve -args $(ADDR_POOL) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/gns -func Approve -args $(ADDR_POOL) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin # 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_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoland/wugnot -func Approve -args $(ADDR_ROUTER) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/router -func ExactInSwapRoute -args "gno.land/r/gnoswap/v1/gns" -args "gno.land/r/demo/wugnot" -args 50000 -args "gno.land/r/gnoswap/v1/gns:gno.land/r/demo/wugnot:3000" -args "100" -args "0" -args $(TX_EXPIRE) -args "" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/router -func ExactInSwapRoute -args "gno.land/r/gnoswap/gns" -args "gno.land/r/gnoland/wugnot" -args 50000 -args "gno.land/r/gnoswap/gns:gno.land/r/gnoland/wugnot:3000" -args "100" -args "0" -args $(TX_EXPIRE) -args "" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo @@ -214,19 +209,19 @@ swap-exact-in-gns-wugnot: swap-exact-out-gns-wugnot: $(info ************ swap gns -> wgnot, exact_out ************) # approve INPUT TOKEN to POOL - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gns -func Approve -args $(ADDR_POOL) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/gns -func Approve -args $(ADDR_POOL) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin # 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_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoland/wugnot -func Approve -args $(ADDR_ROUTER) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/router -func ExactOutSwapRoute -args "gno.land/r/gnoswap/v1/gns" -args "gno.land/r/demo/wugnot" -args 50000 -args "gno.land/r/gnoswap/v1/gns:gno.land/r/demo/wugnot:3000" -args "100" -args "60000" -args $(TX_EXPIRE) -args "" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/router -func ExactOutSwapRoute -args "gno.land/r/gnoswap/gns" -args "gno.land/r/gnoland/wugnot" -args 50000 -args "gno.land/r/gnoswap/gns:gno.land/r/gnoland/wugnot:3000" -args "100" -args "60000" -args $(TX_EXPIRE) -args "" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # collect swap fee collect-swap-fee: $(info ************ collect swap fee ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/position -func CollectFee -args 1 -args false -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/position -func CollectFee -args 1 -args false -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo @@ -234,92 +229,92 @@ collect-swap-fee: delegate: $(info ************ delegate 5_000_000_000 to self ************) # APPROVE FIRST - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gns -func Approve -args $(ADDR_GOV_STAKER) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/gns -func Approve -args $(ADDR_GOV_STAKER) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin # DELEGATE - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gov/staker -func Delegate -args $(ADDR_GNOSWAP) -args 5000000000 -args "" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gov/staker -func Delegate -args $(ADDR_GNOSWAP) -args 5000000000 -args "" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # redelegate gns redelegate: $(info ************ redelegate 1_000_000_000 from self to self ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gov/staker -func Redelegate -args $(ADDR_GNOSWAP) -args $(ADDR_GNOSWAP) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gov/staker -func Redelegate -args $(ADDR_GNOSWAP) -args $(ADDR_GNOSWAP) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # undelegate gns undelegate: $(info ************ undelegate 1_000_000_000 from self ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gov/staker -func Undelegate -args $(ADDR_GNOSWAP) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gov/staker -func Undelegate -args $(ADDR_GNOSWAP) -args 1000000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # collect undelegated gns collect-undelegated: $(info ************ collect undelegated gns ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gov/staker -func CollectUndelegatedGns -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gov/staker -func CollectUndelegatedGns -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # propose text proposal propose-text: $(info ************ propose text ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gov/governance -func ProposeText -args "title_for_text" -args "desc_for_text" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gov/governance -func ProposeText -args "title_for_text" -args "desc_for_text" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # cancel proposal cancel-text: $(info ************ cancel text ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gov/governance -func Cancel -args 1 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gov/governance -func Cancel -args 1 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # propose community_pool send proposal propose-community: $(info ************ propose community pool spend ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gov/governance -func ProposeCommunityPoolSpend -args "title_for_spend" -args "desc_for_spend" -args $(ADDR_GNOSWAP) -args "gno.land/r/gnoswap/v1/gns" -args 1 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gov/governance -func ProposeCommunityPoolSpend -args "title_for_spend" -args "desc_for_spend" -args $(ADDR_GNOSWAP) -args "gno.land/r/gnoswap/gns" -args 1 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # vote proposal vote-community: $(info ************ vote community pool spend ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gov/governance -func Vote -args 2 -args true -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gov/governance -func Vote -args 2 -args true -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # execute proposal execute-community: $(info ************ execute community pool spend ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gov/governance -func Execute -args 2 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gov/governance -func Execute -args 2 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # propose parameter change proposal propose-param: $(info ************ propose param change ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gov/governance -func ProposeParameterChange -args "title param change" -args "desc param change" -args "2" -args "gno.land/r/gnoswap/v1/gns*EXE*SetAvgBlockTimeInMs*EXE*123*GOV*gno.land/r/gnoswap/v1/community_pool*EXE*TransferToken*EXE*gno.land/r/gnoswap/v1/gns,g17290cwvmrapvp869xfnhhawa8sm9edpufzat7d,905" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gov/governance -func ProposeParameterChange -args "title param change" -args "desc param change" -args "1" -args "gno.land/r/gnoswap/v1/community_pool*EXE*TransferToken*EXE*gno.land/r/gnoswap/gns,g17290cwvmrapvp869xfnhhawa8sm9edpufzat7d,905" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # create launchpad project create-launchpad-project: $(info ************ create bar project ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/test_token/bar -func Approve -args $(ADDR_LAUNCHPAD) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/launchpad -func CreateProject -args "Test Launch" -args "gno.land/r/gnoswap/v1/test_token/bar" -args "g1lmvrrrr4er2us84h2732sru76c9zl2nvknha8c" -args 10000000000 -args "gno.land/r/gnoswap/v1/gns" -args "0" -args 20 -args 30 -args 50 -args 1740385500 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/test_token/bar -func Approve -args $(ADDR_LAUNCHPAD) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/launchpad -func CreateProject -args "Test Launch" -args "gno.land/r/gnoswap/test_token/bar" -args "g1lmvrrrr4er2us84h2732sru76c9zl2nvknha8c" -args 10000000000 -args "gno.land/r/gnoswap/gns" -args "0" -args 20 -args 30 -args 50 -args 1740385500 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # deposit to project deposit-to-project: $(info ************ deposit to project ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/launchpad -func DepositGns -args "gno.land/r/gnoswap/v1/test_token/obl:4215:30" -args 1000000 -args "" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/launchpad -func DepositGns -args "gno.land/r/gnoswap/test_token/obl:4215:30" -args 1000000 -args "" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # collect project token collect-project-token: $(info ************ collect project token ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/launchpad -func CollectRewardByProjectId -args "gno.land/r/gnoswap/v1/test_token/obl:4215" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 - @echo + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/launchpad -func CollectRewardByProjectId -args "gno.land/r/gnoswap/test_token/obl:4215" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo \ No newline at end of file diff --git a/tests/volos/_info.mk b/tests/volos/_info.mk index 546bc2d..a690faa 100644 --- a/tests/volos/_info.mk +++ b/tests/volos/_info.mk @@ -1,4 +1,3 @@ - # Network configuration GNOLAND_RPC_URL=http://localhost:26657 CHAINID=dev @@ -13,4 +12,4 @@ ADDR_XVLS := g1hdpp5djpfj899j9t0kmezs4ke60k0nxhxnydq9 # std.DerivePkgAddr("gno.l ADDR_STAKER := g1xgaa5n8qtgl6z97aug8nvrtvm0l9ahvtghru5l # std.DerivePkgAddr("gno.land/r/volos/gov/staker") ADDR_GOVERNANCE := g1kp52puf7vuqptdg2kdqjmy45v70sh2s6g984f8 # std.DerivePkgAddr("gno.land/r/volos/gov/governance") -MAX_APPROVE := 9223372036854775806 +MAX_APPROVE := 9223372036854775806 \ No newline at end of file diff --git a/tests/volos/flashloan.gno b/tests/volos/flashloan.gno index 0808107..f8fe707 100644 --- a/tests/volos/flashloan.gno +++ b/tests/volos/flashloan.gno @@ -6,5 +6,5 @@ import ( func main() { // Test flash loan with GNS token - volos.FlashLoan(cross, "gno.land/r/gnoswap/v1/gns", 10000, "gno.land/r/gnoswap/v1/gns") + volos.FlashLoan(cross, "gno.land/r/gnoswap/gns", 10000, "gno.land/r/gnoswap/gns") } \ No newline at end of file diff --git a/tests/volos/gov_test.mk b/tests/volos/gov_test.mk index c1d27e1..85d70ad 100644 --- a/tests/volos/gov_test.mk +++ b/tests/volos/gov_test.mk @@ -12,19 +12,19 @@ gov-test-flow-no-voting: faucet-vls approve-vls-for-staking stake-vls faucet-all # Faucet VLS tokens faucet-vls: $(info ************ Faucet VLS tokens ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/vls -func Faucet -args 1000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/vls -func Faucet -args 1000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # Approve VLS for staking approve-vls-for-staking: $(info ************ Approve VLS for staking ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/vls -func Approve -args $(ADDR_STAKER) -args 10000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/vls -func Approve -args $(ADDR_STAKER) -args 10000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # Stake VLS to mint xVLS stake-vls: $(info ************ Stake VLS to mint xVLS ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/staker -func Stake -args 5000 -args $(ADMIN) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/staker -func Stake -args 5000 -args $(ADMIN) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # Faucet VLS to all voters @@ -54,19 +54,21 @@ stake-all-voters: # Create a simple test proposal create-test-proposal: $(info ************ Create test proposal ************) - @echo "" | gnokey maketx run test1 create_proposals.gno -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/mocks -func CreateProposals -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo "waiting 3s for proposals to be processed..." + @sleep 3 @echo # Vote yes on the proposal vote-yes: $(info ************ Vote yes on proposal ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 1 -args "YES" -args "I support this proposal" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 1 -args "YES" -args "I support this proposal" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # All voters vote on proposal 1 vote-all-on-proposal1: $(info ************ All voters vote on proposal 1 ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 1 -args "YES" -args "Admin supports proposal 1" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 1 -args "YES" -args "Admin supports proposal 1" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 1 -args "YES" -args "ADDR_USER_1 supports proposal 1" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" $(ADDR_USER_1) @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 1 -args "YES" -args "ADDR_USER_2 supports proposal 1" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" $(ADDR_USER_2) @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 1 -args "YES" -args "ADDR_USER_3 supports proposal 1" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" $(ADDR_USER_3) @@ -75,13 +77,13 @@ vote-all-on-proposal1: # Vote no on the proposal vote-no: $(info ************ Vote no on proposal ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 2 -args "NO" -args "I do not support this proposal" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 2 -args "NO" -args "I do not support this proposal" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # Vote abstain on the proposal vote-abstain: $(info ************ Vote abstain on proposal ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 3 -args "ABSTAIN" -args "I abstain from this proposal" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 3 -args "ABSTAIN" -args "I abstain from this proposal" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # Multi-voter voting scenarios @@ -129,17 +131,17 @@ multi-voter-test: vote-voter1-yes vote-voter2-no vote-voter3-abstain vote-voter1 vote-all-on-all-proposals: $(info ************ All voters vote on all proposals ************) # Vote on proposal 1 - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 1 -args "YES" -args "Admin supports proposal 1" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 1 -args "YES" -args "Admin supports proposal 1" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 1 -args "YES" -args "ADDR_USER_1 supports proposal 1" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" $(ADDR_USER_1) @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 1 -args "YES" -args "ADDR_USER_2 supports proposal 1" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" $(ADDR_USER_2) @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 1 -args "YES" -args "ADDR_USER_3 supports proposal 1" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" $(ADDR_USER_3) # Vote on proposal 2 - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 2 -args "NO" -args "Admin opposes proposal 2" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 2 -args "NO" -args "Admin opposes proposal 2" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 2 -args "NO" -args "ADDR_USER_1 opposes proposal 2" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" $(ADDR_USER_1) @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 2 -args "NO" -args "ADDR_USER_2 opposes proposal 2" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" $(ADDR_USER_2) @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 2 -args "ABSTAIN" -args "ADDR_USER_3 abstains from proposal 2" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" $(ADDR_USER_3) # Vote on proposal 3 - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 3 -args "YES" -args "Admin supports proposal 3" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 3 -args "YES" -args "Admin supports proposal 3" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 3 -args "ABSTAIN" -args "ADDR_USER_1 abstains from proposal 3" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" $(ADDR_USER_1) @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 3 -args "YES" -args "ADDR_USER_2 supports proposal 3" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" $(ADDR_USER_2) @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Vote -args 3 -args "YES" -args "ADDR_USER_3 supports proposal 3" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" $(ADDR_USER_3) @@ -148,7 +150,7 @@ vote-all-on-all-proposals: # Execute the proposal execute-proposal: $(info ************ Execute proposal ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Execute -args 1 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/gov/governance -func Execute -args 1 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # Check VLS balance diff --git a/tests/volos/key_setup.mk b/tests/volos/key_setup.mk index 4f67faa..6dc55b1 100644 --- a/tests/volos/key_setup.mk +++ b/tests/volos/key_setup.mk @@ -13,4 +13,4 @@ reset-keys: $(info ************ Reset keys ************) @echo "" | rm -rf ~/.config/gno/data/keys.db @echo "" | [ -e ~/.config/gno/data/keys.db.bak ] && mv ~/.config/gno/data/keys.db.bak ~/.config/gno/data/keys.db || true - @echo + @echo \ No newline at end of file diff --git a/tests/volos/multi_ops_test.mk b/tests/volos/multi_ops_test.mk new file mode 100644 index 0000000..5c29221 --- /dev/null +++ b/tests/volos/multi_ops_test.mk @@ -0,0 +1,187 @@ +include _info.mk +include ../gnoswap-tests/_info.mk +include ../gnoswap-tests/test.mk + +# ============================================================================= +# MULTI-OPERATIONS WORKFLOW FOR GRAPH DATA GENERATION +# ============================================================================= +# +# This workflow performs multiple supply, withdraw, borrow, and repay operations +# to generate rich data points for utilization rate graphs and market analysis. +# +# PREREQUISITES: +# - Markets must be created first (run full-workflow from test.mk) +# - Sufficient token balances and allowances must be set up +# - Collateral must be supplied to enable borrowing +# +# DEPENDENCIES: +# - full-workflow (from test.mk) must be completed first +# - Note: 74% of GNS is already borrowed from full-workflow, LLTV is 75%, so only 1% headroom +# +# USAGE: +# make -f test.mk full-workflow # First create markets and basic setup +# make -f multi_ops_test.mk multi-ops-workflow # Then run this for data generation +# ============================================================================= + +# Multiple operations workflow to generate more data points for graphs +# This workflow performs multiple supply, withdraw, borrow, and repay operations +multi-ops-workflow: \ + supply-multi-1 withdraw-multi-1 borrow-multi-1 repay-multi-1 \ + supply-multi-2 withdraw-multi-2 borrow-multi-2 repay-multi-2 \ + supply-multi-3 withdraw-multi-3 borrow-multi-3 repay-multi-3 \ + supply-multi-4 withdraw-multi-4 borrow-multi-4 repay-multi-4 \ + supply-multi-5 withdraw-multi-5 borrow-multi-5 repay-multi-5 \ + check-final-positions + @echo "************ MULTI-OPS WORKFLOW FINISHED ************" + +# Ensure allowances are set for multi-operations +ensure-allowances: + $(info ************ Ensuring allowances for multi-operations ************) + # Approve GNS for Volos contract + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/gns -func Approve -args $(ADDR_VOLOS) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo + # Approve WUGNOT for Volos contract + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoland/wugnot -func Approve -args $(ADDR_VOLOS) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo + +# Multi-operation targets for generating more data points +# Round 1 operations +supply-multi-1: + $(info ************ Multi-op Round 1: Supply GNS ************) + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Supply -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 5000000000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo + +withdraw-multi-1: + $(info ************ Multi-op Round 1: Withdraw GNS ************) + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Withdraw -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 2000000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo + +borrow-multi-1: + $(info ************ Multi-op Round 1: Borrow GNS ************) + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Borrow -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 200000000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo + +repay-multi-1: + $(info ************ Multi-op Round 1: Repay GNS ************) + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Repay -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 1000000000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo + +# Round 2 operations +supply-multi-2: + $(info ************ Multi-op Round 2: Supply GNS ************) + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Supply -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 300000000000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo + +withdraw-multi-2: + $(info ************ Multi-op Round 2: Withdraw GNS ************) + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Withdraw -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 1000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo + +borrow-multi-2: + $(info ************ Multi-op Round 2: Borrow GNS ************) + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Borrow -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 50000000000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo + +repay-multi-2: + $(info ************ Multi-op Round 2: Repay GNS ************) + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Repay -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 120000000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo + +# Round 3 operations +supply-multi-3: + $(info ************ Multi-op Round 3: Supply GNS ************) + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Supply -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 400000000000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo + +withdraw-multi-3: + $(info ************ Multi-op Round 3: Withdraw GNS ************) + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Withdraw -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 150000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo + +borrow-multi-3: + $(info ************ Multi-op Round 3: Borrow GNS ************) + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Borrow -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 3000000000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo + +repay-multi-3: + $(info ************ Multi-op Round 3: Repay GNS ************) + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Repay -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 200000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo + +# Round 4 operations +supply-multi-4: + $(info ************ Multi-op Round 4: Supply GNS ************) + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Supply -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 600000000000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo + +withdraw-multi-4: + $(info ************ Multi-op Round 4: Withdraw GNS ************) + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Withdraw -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 2000000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo + +borrow-multi-4: + $(info ************ Multi-op Round 4: Borrow GNS ************) + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Borrow -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 3000000000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo + +repay-multi-4: + $(info ************ Multi-op Round 4: Repay GNS ************) + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Repay -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 1000000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo + +# Round 5 operations +supply-multi-5: + $(info ************ Multi-op Round 5: Supply GNS ************) + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Supply -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 7000000000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo + +withdraw-multi-5: + $(info ************ Multi-op Round 5: Withdraw GNS ************) + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Withdraw -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 2500 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo + +borrow-multi-5: + $(info ************ Multi-op Round 5: Borrow GNS ************) + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Borrow -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 100000000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo + +repay-multi-5: + $(info ************ Multi-op Round 5: Repay GNS ************) + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Repay -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 300000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo + +# Check final positions after all multi-operations +check-final-positions: + $(info ************ Check Final Positions After Multi-Operations ************) + # Check GNS-WUGNOT market final state + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetTotalSupplyAssets(\"gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0\")" + @echo + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetTotalBorrowAssets(\"gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0\")" + @echo + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetPositionSupplyShares(\"gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0\", \"$(ADMIN)\")" + @echo + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetPositionBorrowShares(\"gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0\", \"$(ADMIN)\")" + @echo + +# Complete workflow with prerequisites check +multi-ops-complete: ensure-allowances multi-ops-workflow + @echo "************ MULTI-OPS COMPLETE WORKFLOW FINISHED ************" + +# Quick test to verify market exists before running multi-ops +verify-market-exists: + $(info ************ Verifying market exists before multi-operations ************) + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetMarket(\"gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0\")" + @echo + +# Check current utilization rate before multi-operations +check-current-utilization: + $(info ************ Check Current Utilization Rate ************) + # Get total supply assets + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetTotalSupplyAssets(\"gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0\")" + @echo + # Get total borrow assets + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetTotalBorrowAssets(\"gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0\")" + @echo + # Get LLTV (Liquidation LTV) + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetLLTV(\"gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0\")" + @echo diff --git a/tests/volos/test.mk b/tests/volos/test.mk index 8735a86..bd28239 100644 --- a/tests/volos/test.mk +++ b/tests/volos/test.mk @@ -1,252 +1,247 @@ include _info.mk -include key_setup.mk -include ../gnoswap/_info.mk -include ../gnoswap/test.mk +include ../gnoswap-tests/_info.mk +include ../gnoswap-tests/test.mk # Complete flow that includes both GNS-WUGNOT and BAR-WUGNOT operations -full-workflow: set-keys pool-create-gns-wugnot-default mint-gns-gnot enable-irm enable-lltv market-create-gns-wugnot supply-assets-gns-wugnot supply-collateral-gns-wugnot borrow-gns \ +full-workflow: pool-create-gns-wugnot-default mint-gns-gnot enable-irm enable-lltv market-create-gns-wugnot supply-assets-gns-wugnot supply-collateral-gns-wugnot borrow-gns \ pool-create-bar-wugnot-default mint-bar-wugnot market-create-bar-wugnot supply-assets-bar-wugnot supply-collateral-bar-wugnot borrow-bar \ - check-position-gns-wugnot check-position-bar-wugnot reset-keys + check-position-gns-wugnot check-position-bar-wugnot @echo "************ WORKFLOW FINISHED ************" # Enable the linear IRM enable-irm: $(info ************ Enable linear IRM ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func EnableIRM -args "linear" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func EnableIRM -args "linear" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # Enable LLTV (75% = 75 as int64) enable-lltv: $(info ************ Enable LLTV 75% ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func EnableLLTV -args 75 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func EnableLLTV -args 75 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # Test market creation with GNS and WUGNOT market-create-gns-wugnot: $(info ************ Test creating market with GNS (supply/borrow) and WUGNOT (collateral) ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func CreateMarket -args "gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/gns:3000" -args false -args "linear" -args 75 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func CreateMarket -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000" -args false -args "linear" -args 75 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # Test market creation with GNS and WUGNOT market-create-bar-wugnot: $(info ************ Test creating market with BAR (supply/borrow) and WUGNOT (collateral) ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func CreateMarket -args "gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/test_token/bar:3000" -args false -args "linear" -args 75 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func CreateMarket -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/test_token/bar:3000" -args false -args "linear" -args 75 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # Test getting pool price for GNS-WUGNOT market market-get-price-gns-wugnot: $(info ************ Test getting pool price for GNS-WUGNOT market ************) - gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetMarketPrice(\"gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/gns:3000:0\")" + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetMarketPrice(\"gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0\")" @echo # Test getting market info for GNS-WUGNOT pair market-get-gns-wugnot: $(info ************ Test getting market info for GNS-WUGNOT pair ************) # GET TOTAL SUPPLY ASSETS - gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetTotalSupplyAssets(\"gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/gns:3000:0\")" + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetTotalSupplyAssets(\"gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0\")" @echo # GET TOTAL SUPPLY SHARES - gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetTotalSupplyShares(\"gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/gns:3000:0\")" + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetTotalSupplyShares(\"gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0\")" @echo # GET TOTAL BORROW ASSETS - gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetTotalBorrowAssets(\"gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/gns:3000:0\")" + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetTotalBorrowAssets(\"gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0\")" @echo # GET TOTAL BORROW SHARES - gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetTotalBorrowShares(\"gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/gns:3000:0\")" + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetTotalBorrowShares(\"gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0\")" @echo # GET LIQUIDATION LTV - gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetLLTV(\"gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/gns:3000:0\")" + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetLLTV(\"gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0\")" @echo # GET MARKET FEE - gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetFee(\"gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/gns:3000:0\")" + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetFee(\"gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0\")" @echo # Test supplying assets to GNS-WUGNOT market supply-assets-gns-wugnot: $(info ************ Test supplying GNS assets to GNS-WUGNOT market ************) # APPROVE FIRST - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gns -func Approve -args $(ADDR_VOLOS) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 - @echo - - # Wrap UGNOT to WUGNOT - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/wugnot -func Deposit -send "1000000000ugnot" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/gns -func Approve -args $(ADDR_VOLOS) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # THEN SUPPLY - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Supply -args "gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/gns:3000:0" -args 1000000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Supply -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 148000000000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # Test supplying shares to GNS-WUGNOT market supply-shares-gns-wugnot: $(info ************ Test supplying shares to GNS-WUGNOT market ************) # APPROVE FIRST - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gns -func Approve -args $(ADDR_VOLOS) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 - @echo - - # Wrap UGNOT to WUGNOT - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/wugnot -func Deposit -send "1000000000ugnot" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/gns -func Approve -args $(ADDR_VOLOS) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # THEN SUPPLY - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Supply -args "gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/gns:3000:0" -args 0 -args 1000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Supply -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 0 -args 1000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # Test withdrawing assets from GNS-WUGNOT market withdraw-assets-gns-wugnot: $(info ************ Test withdrawing GNS assets from GNS-WUGNOT market ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Withdraw -args "gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/gns:3000:0" -args 994940 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Withdraw -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 994940 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # Check user position in GNS-WUGNOT market check-position-gns-wugnot: $(info ************ Check user position in GNS-WUGNOT market ************) # Check supply shares - gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetPositionSupplyShares(\"gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/gns:3000:0\", \"$(ADMIN)\")" + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetPositionSupplyShares(\"gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0\", \"$(ADMIN)\")" @echo # Check borrow shares - gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetPositionBorrowShares(\"gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/gns:3000:0\", \"$(ADMIN)\")" + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetPositionBorrowShares(\"gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0\", \"$(ADMIN)\")" @echo # Check collateral - gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetPositionCollateral(\"gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/gns:3000:0\", \"$(ADMIN)\")" + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetPositionCollateral(\"gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0\", \"$(ADMIN)\")" @echo # Check GNS balance check-gns-balance: $(info ************ Check GNS balance ************) - gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/gnoswap/v1/gns.BalanceOf(\"$(ADMIN)\")" + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/gnoswap/gns.BalanceOf(\"$(ADMIN)\")" @echo # Check Volos contract GNS balance check-volos-gns-balance: $(info ************ Check Volos contract GNS balance ************) - gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/gnoswap/v1/gns.BalanceOf(\"$(ADDR_VOLOS)\")" + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/gnoswap/gns.BalanceOf(\"$(ADDR_VOLOS)\")" @echo # Check Volos contract WUGNOT balance check-volos-wugnot-balance: $(info ************ Check Volos contract WUGNOT balance ************) - gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/demo/wugnot.BalanceOf(\"$(ADDR_VOLOS)\")" + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data ".BalanceOf(\"$(ADDR_VOLOS)\")" @echo # Test accruing interest on GNS-WUGNOT market accrue-interest-gns-wugnot: $(info ************ Test accruing interest on GNS-WUGNOT market ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func AccrueInterest -args "gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/gns:3000:0" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func AccrueInterest -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # Check WUGNOT balance check-wugnot-balance: $(info ************ Check WUGNOT balance ************) - gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/demo/wugnot.BalanceOf(\"$(ADMIN)\")" + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data ".BalanceOf(\"$(ADMIN)\")" @echo # Wrap UGNOT to WUGNOT wrap-ugnot: $(info ************ Wrap UGNOT to WUGNOT ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/wugnot -func Deposit -send "1000000000ugnot" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoland/wugnot -func Deposit -send "1000000000ugnot" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # Test borrowing GNS tokens borrow-gns: $(info ************ Test borrowing GNS tokens ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Borrow -args "gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/gns:3000:0" -args 740000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Borrow -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 74000000000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # Test repaying GNS tokens repay-gns: $(info ************ Test repaying GNS tokens ************) # APPROVE FIRST - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gns -func Approve -args $(ADDR_VOLOS) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/gns -func Approve -args $(ADDR_VOLOS) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # THEN REPAY - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Repay -args "gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/gns:3000:0" -args 50 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Repay -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 37000000000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # Test liquidating GNS position liquidate-gns: $(info ************ Test liquidating GNS position ************) # APPROVE FIRST - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/gns -func Approve -args $(ADDR_VOLOS) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/gns -func Approve -args $(ADDR_VOLOS) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # THEN LIQUIDATE - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Liquidate -args "gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/gns:3000:0" -args $(ADMIN) -args 0 -args 25 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Liquidate -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args $(ADMIN) -args 0 -args 25 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # Test supplying collateral to GNS-WUGNOT market supply-collateral-gns-wugnot: $(info ************ Test supplying collateral to GNS-WUGNOT market ************) # APPROVE FIRST - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/wugnot -func Approve -args $(ADDR_VOLOS) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoland/wugnot -func Approve -args $(ADDR_VOLOS) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin + @echo + + # Wrap UGNOT to WUGNOT + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoland/wugnot -func Deposit -send "1000000000ugnot" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # THEN SUPPLY COLLATERAL - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func SupplyCollateral -args "gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/gns:3000:0" -args 1000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func SupplyCollateral -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 1000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # Test withdrawing collateral from GNS-WUGNOT market withdraw-collateral-gns-wugnot: $(info ************ Test withdrawing collateral from GNS-WUGNOT market ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func WithdrawCollateral -args "gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/gns:3000:0" -args 500 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func WithdrawCollateral -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0" -args 500 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # Test supplying assets to BAR-WUGNOT market supply-assets-bar-wugnot: $(info ************ Test supplying BAR assets to BAR-WUGNOT market ************) # APPROVE FIRST - @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/v1/test_token/bar -func Approve -args $(ADDR_VOLOS) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoswap/test_token/bar -func Approve -args $(ADDR_VOLOS) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # Wrap UGNOT to WUGNOT if needed - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/wugnot -func Deposit -send "1000000000ugnot" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoland/wugnot -func Deposit -send "1000000000ugnot" -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # THEN SUPPLY - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Supply -args "gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/test_token/bar:3000:0" -args 1000000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Supply -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/test_token/bar:3000:0" -args 1000000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # Test supplying collateral to BAR-WUGNOT market supply-collateral-bar-wugnot: $(info ************ Test supplying collateral to BAR-WUGNOT market ************) # APPROVE FIRST - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/wugnot -func Approve -args $(ADDR_VOLOS) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/gnoland/wugnot -func Approve -args $(ADDR_VOLOS) -args $(MAX_APPROVE) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # THEN SUPPLY COLLATERAL - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func SupplyCollateral -args "gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/test_token/bar:3000:0" -args 1000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func SupplyCollateral -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/test_token/bar:3000:0" -args 1000000 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # Test borrowing BAR tokens borrow-bar: $(info ************ Test borrowing BAR tokens ************) - @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Borrow -args "gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/test_token/bar:3000:0" -args 500000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" test1 + @echo "" | gnokey maketx call -pkgpath gno.land/r/volos/core -func Borrow -args "gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/test_token/bar:3000:0" -args 500000 -args 0 -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 100000000ugnot -gas-wanted 1000000000 -memo "" gnoswap_admin @echo # Check user position in BAR-WUGNOT market check-position-bar-wugnot: $(info ************ Check user position in BAR-WUGNOT market ************) # Check supply shares - gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetPositionSupplyShares(\"gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/test_token/bar:3000:0\", \"$(ADMIN)\")" + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetPositionSupplyShares(\"gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/test_token/bar:3000:0\", \"$(ADMIN)\")" @echo # Check borrow shares - gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetPositionBorrowShares(\"gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/test_token/bar:3000:0\", \"$(ADMIN)\")" + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetPositionBorrowShares(\"gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/test_token/bar:3000:0\", \"$(ADMIN)\")" @echo # Check collateral - gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetPositionCollateral(\"gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/test_token/bar:3000:0\", \"$(ADMIN)\")" + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetPositionCollateral(\"gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/test_token/bar:3000:0\", \"$(ADMIN)\")" @echo # Check health factor - gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetHealthFactor(\"gno.land/r/demo/wugnot:gno.land/r/gnoswap/v1/test_token/bar:3000:0\", \"$(ADMIN)\")" + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetHealthFactor(\"gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/test_token/bar:3000:0\", \"$(ADMIN)\")" @echo # Check volos owner @@ -258,7 +253,7 @@ check-volos-owner: # Test flash loan test-flashloan: $(info ************ Testing Flash Loan ************) - @echo "" | gnokey maketx run test1 flashloan.gno -gas-wanted 200000000 -gas-fee 1000000ugnot -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) + @echo "" | gnokey maketx run gnoswap_admin flashloan.gno -gas-wanted 200000000 -gas-fee 1000000ugnot -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) @echo # Get Volos contract address derived from path @@ -266,3 +261,9 @@ get-volos-address: $(info ************ Getting Volos Contract Address ************) gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.GetAddress()" @echo + +# Test calculate borrow APR for GNS-WUGNOT market +test-calculate-borrow-apr: + $(info ************ Testing Calculate Borrow APR ************) + gnokey query vm/qeval -remote $(GNOLAND_RPC_URL) -data "gno.land/r/volos/core.CalculateBorrowAPR(\"gno.land/r/gnoland/wugnot:gno.land/r/gnoswap/gns:3000:0\")" + @echo \ No newline at end of file