Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Register
Sign in
Toggle navigation
Menu
Open sidebar
Tiger Ton
osmosis
Commits
9ffdc37c
Commit
9ffdc37c
authored
2 years ago
by
Nicolas Lara
Browse files
Options
Download
Email Patches
Plain Diff
make format
parent
64320349
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
app/app.go
+4
-3
app/app.go
x/epochs/module.go
+1
-2
x/epochs/module.go
x/gamm/twap/hook_listener.go
+4
-2
x/gamm/twap/hook_listener.go
x/gamm/twap/keeper_test.go
+4
-2
x/gamm/twap/keeper_test.go
x/gamm/twap/module.go
+1
-2
x/gamm/twap/module.go
x/gamm/twap/store_test.go
+24
-12
x/gamm/twap/store_test.go
x/ibc-rate-limit/ibc_middleware.go
+4
-2
x/ibc-rate-limit/ibc_middleware.go
x/ibc-rate-limit/rate_limit.go
+2
-1
x/ibc-rate-limit/rate_limit.go
x/ibc-rate-limit/testutil/chain.go
+3
-3
x/ibc-rate-limit/testutil/chain.go
x/ibc-rate-limit/testutil/wasm.go
+2
-1
x/ibc-rate-limit/testutil/wasm.go
x/ibc-rate-limit/types/params.go
+1
-1
x/ibc-rate-limit/types/params.go
x/incentives/keeper/msg_server_test.go
+0
-1
x/incentives/keeper/msg_server_test.go
x/incentives/module.go
+1
-2
x/incentives/module.go
x/lockup/module.go
+1
-2
x/lockup/module.go
x/mint/keeper/export_test.go
+1
-3
x/mint/keeper/export_test.go
x/mint/keeper/keeper_test.go
+1
-3
x/mint/keeper/keeper_test.go
x/pool-incentives/module.go
+1
-2
x/pool-incentives/module.go
x/superfluid/keeper/stake_test.go
+0
-1
x/superfluid/keeper/stake_test.go
x/superfluid/module.go
+1
-2
x/superfluid/module.go
x/tokenfactory/module.go
+1
-2
x/tokenfactory/module.go
with
57 additions
and
49 deletions
+57
-49
app/app.go
+
4
-
3
View file @
9ffdc37c
...
...
@@ -2,15 +2,16 @@ package app
import
(
"fmt"
capabilitykeeper
"github.com/cosmos/cosmos-sdk/x/capability/keeper"
stakingkeeper
"github.com/cosmos/cosmos-sdk/x/staking/keeper"
ibckeeper
"github.com/cosmos/ibc-go/v3/modules/core/keeper"
"io"
"net/http"
"os"
"path/filepath"
"strings"
capabilitykeeper
"github.com/cosmos/cosmos-sdk/x/capability/keeper"
stakingkeeper
"github.com/cosmos/cosmos-sdk/x/staking/keeper"
ibckeeper
"github.com/cosmos/ibc-go/v3/modules/core/keeper"
"github.com/CosmWasm/wasmd/x/wasm"
"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"
...
...
This diff is collapsed.
Click to expand it.
x/epochs/module.go
+
1
-
2
View file @
9ffdc37c
...
...
@@ -44,8 +44,7 @@ var (
// ----------------------------------------------------------------------------
// AppModuleBasic implements the AppModuleBasic interface for the capability module.
type
AppModuleBasic
struct
{
}
type
AppModuleBasic
struct
{}
func
NewAppModuleBasic
()
AppModuleBasic
{
return
AppModuleBasic
{}
...
...
This diff is collapsed.
Click to expand it.
x/gamm/twap/hook_listener.go
+
4
-
2
View file @
9ffdc37c
...
...
@@ -9,8 +9,10 @@ import (
"github.com/osmosis-labs/osmosis/v10/x/gamm/types"
)
var
_
types
.
GammHooks
=
&
gammhook
{}
var
_
epochtypes
.
EpochHooks
=
&
epochhook
{}
var
(
_
types
.
GammHooks
=
&
gammhook
{}
_
epochtypes
.
EpochHooks
=
&
epochhook
{}
)
type
epochhook
struct
{
k
Keeper
...
...
This diff is collapsed.
Click to expand it.
x/gamm/twap/keeper_test.go
+
4
-
2
View file @
9ffdc37c
...
...
@@ -12,8 +12,10 @@ import (
"github.com/osmosis-labs/osmosis/v10/x/gamm/twap/types"
)
var
defaultUniV2Coins
=
sdk
.
NewCoins
(
sdk
.
NewInt64Coin
(
"token/B"
,
1
_000_000_000
),
sdk
.
NewInt64Coin
(
"token/A"
,
1
_000_000_000
))
var
baseTime
=
time
.
Unix
(
1257894000
,
0
)
.
UTC
()
var
(
defaultUniV2Coins
=
sdk
.
NewCoins
(
sdk
.
NewInt64Coin
(
"token/B"
,
1
_000_000_000
),
sdk
.
NewInt64Coin
(
"token/A"
,
1
_000_000_000
))
baseTime
=
time
.
Unix
(
1257894000
,
0
)
.
UTC
()
)
type
TestSuite
struct
{
apptesting
.
KeeperTestHelper
...
...
This diff is collapsed.
Click to expand it.
x/gamm/twap/module.go
+
1
-
2
View file @
9ffdc37c
...
...
@@ -23,8 +23,7 @@ var (
_
module
.
AppModuleBasic
=
AppModuleBasic
{}
)
type
AppModuleBasic
struct
{
}
type
AppModuleBasic
struct
{}
func
(
AppModuleBasic
)
Name
()
string
{
return
types
.
ModuleName
}
...
...
This diff is collapsed.
Click to expand it.
x/gamm/twap/store_test.go
+
24
-
12
View file @
9ffdc37c
...
...
@@ -84,12 +84,14 @@ func (s *TestSuite) TestGetAllMostRecentRecordsForPool() {
recordsToSet
:
[]
types
.
TwapRecord
{
newEmptyPriceRecord
(
1
,
baseTime
,
"tokenB"
,
"tokenA"
),
newEmptyPriceRecord
(
1
,
baseTime
,
"tokenC"
,
"tokenB"
),
newEmptyPriceRecord
(
1
,
baseTime
,
"tokenC"
,
"tokenA"
)},
newEmptyPriceRecord
(
1
,
baseTime
,
"tokenC"
,
"tokenA"
),
},
poolId
:
1
,
expectedRecords
:
[]
types
.
TwapRecord
{
newEmptyPriceRecord
(
1
,
baseTime
,
"tokenB"
,
"tokenA"
),
newEmptyPriceRecord
(
1
,
baseTime
,
"tokenC"
,
"tokenA"
),
newEmptyPriceRecord
(
1
,
baseTime
,
"tokenC"
,
"tokenB"
)},
newEmptyPriceRecord
(
1
,
baseTime
,
"tokenC"
,
"tokenB"
),
},
},
}
...
...
@@ -136,40 +138,50 @@ func (s *TestSuite) TestGetRecordAtOrBeforeTime() {
"rev at latest (exact)"
:
{[]
types
.
TwapRecord
{
baseRecord
},
defaultRevInputAt
(
baseTime
),
baseRecord
,
true
},
"get latest (exact) w/ past entries"
:
{
[]
types
.
TwapRecord
{
tMin1Record
,
baseRecord
},
defaultInputAt
(
baseTime
),
baseRecord
,
false
},
[]
types
.
TwapRecord
{
tMin1Record
,
baseRecord
},
defaultInputAt
(
baseTime
),
baseRecord
,
false
,
},
"get entry (exact) w/ a subsequent entry"
:
{
[]
types
.
TwapRecord
{
tMin1Record
,
baseRecord
},
defaultInputAt
(
tMin1
),
tMin1Record
,
false
},
[]
types
.
TwapRecord
{
tMin1Record
,
baseRecord
},
defaultInputAt
(
tMin1
),
tMin1Record
,
false
,
},
"get sandwitched entry (exact)"
:
{
[]
types
.
TwapRecord
{
tMin1Record
,
baseRecord
,
tPlus1Record
},
defaultInputAt
(
baseTime
),
baseRecord
,
false
},
[]
types
.
TwapRecord
{
tMin1Record
,
baseRecord
,
tPlus1Record
},
defaultInputAt
(
baseTime
),
baseRecord
,
false
,
},
"rev sandwitched entry (exact)"
:
{
[]
types
.
TwapRecord
{
tMin1Record
,
baseRecord
,
tPlus1Record
},
defaultRevInputAt
(
baseTime
),
baseRecord
,
true
},
[]
types
.
TwapRecord
{
tMin1Record
,
baseRecord
,
tPlus1Record
},
defaultRevInputAt
(
baseTime
),
baseRecord
,
true
,
},
"get future"
:
{[]
types
.
TwapRecord
{
baseRecord
},
defaultInputAt
(
tPlus1
),
baseRecord
,
false
},
"get future w/ past entries"
:
{[]
types
.
TwapRecord
{
tMin1Record
,
baseRecord
},
defaultInputAt
(
tPlus1
),
baseRecord
,
false
},
"get in between entries (2 entry)"
:
{
[]
types
.
TwapRecord
{
tMin1Record
,
baseRecord
},
defaultInputAt
(
baseTime
.
Add
(
-
time
.
Millisecond
)),
tMin1Record
,
false
},
defaultInputAt
(
baseTime
.
Add
(
-
time
.
Millisecond
)),
tMin1Record
,
false
,
},
"get in between entries (3 entry)"
:
{
[]
types
.
TwapRecord
{
tMin1Record
,
baseRecord
,
tPlus1Record
},
defaultInputAt
(
baseTime
.
Add
(
-
time
.
Millisecond
)),
tMin1Record
,
false
},
defaultInputAt
(
baseTime
.
Add
(
-
time
.
Millisecond
)),
tMin1Record
,
false
,
},
"get in between entries (3 entry) #2"
:
{
[]
types
.
TwapRecord
{
tMin1Record
,
baseRecord
,
tPlus1Record
},
defaultInputAt
(
baseTime
.
Add
(
time
.
Millisecond
)),
baseRecord
,
false
},
defaultInputAt
(
baseTime
.
Add
(
time
.
Millisecond
)),
baseRecord
,
false
,
},
"query too old"
:
{
[]
types
.
TwapRecord
{
tMin1Record
,
baseRecord
,
tPlus1Record
},
defaultInputAt
(
baseTime
.
Add
(
-
time
.
Second
*
2
)),
baseRecord
,
true
},
baseRecord
,
true
,
},
"non-existent pool ID"
:
{
[]
types
.
TwapRecord
{
tMin1Record
,
baseRecord
,
tPlus1Record
},
wrongPoolIdInputAt
(
baseTime
),
baseRecord
,
true
},
wrongPoolIdInputAt
(
baseTime
),
baseRecord
,
true
,
},
"pool2 record get"
:
{
recordsToSet
:
[]
types
.
TwapRecord
{
newEmptyPriceRecord
(
2
,
baseTime
,
"tokenB"
,
"tokenA"
)},
input
:
wrongPoolIdInputAt
(
baseTime
),
expectedRecord
:
newEmptyPriceRecord
(
2
,
baseTime
,
"tokenB"
,
"tokenA"
),
expErr
:
false
},
expErr
:
false
,
},
}
for
name
,
test
:=
range
tests
{
s
.
Run
(
name
,
func
()
{
...
...
This diff is collapsed.
Click to expand it.
x/ibc-rate-limit/ibc_middleware.go
+
4
-
2
View file @
9ffdc37c
...
...
@@ -16,8 +16,10 @@ import (
lockupkeeper
"github.com/osmosis-labs/osmosis/v10/x/lockup/keeper"
)
var
_
porttypes
.
Middleware
=
&
IBCModule
{}
var
_
porttypes
.
ICS4Wrapper
=
&
ICS4Middleware
{}
var
(
_
porttypes
.
Middleware
=
&
IBCModule
{}
_
porttypes
.
ICS4Wrapper
=
&
ICS4Middleware
{}
)
type
ICS4Middleware
struct
{
channel
porttypes
.
ICS4Wrapper
...
...
This diff is collapsed.
Click to expand it.
x/ibc-rate-limit/rate_limit.go
+
2
-
1
View file @
9ffdc37c
...
...
@@ -3,13 +3,14 @@ package ibc_rate_limit
import
(
"encoding/json"
"fmt"
"strings"
wasmkeeper
"github.com/CosmWasm/wasmd/x/wasm/keeper"
sdk
"github.com/cosmos/cosmos-sdk/types"
sdkerrors
"github.com/cosmos/cosmos-sdk/types/errors"
transfertypes
"github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"
"github.com/cosmos/ibc-go/v3/modules/core/exported"
"github.com/osmosis-labs/osmosis/v10/x/ibc-rate-limit/types"
"strings"
)
func
CheckRateLimits
(
ctx
sdk
.
Context
,
wasmKeeper
*
wasmkeeper
.
Keeper
,
msgType
,
contractParam
,
channelValue
,
sourceChannel
string
,
sender
sdk
.
AccAddress
,
amount
string
)
error
{
...
...
This diff is collapsed.
Click to expand it.
x/ibc-rate-limit/testutil/chain.go
+
3
-
3
View file @
9ffdc37c
package
osmosisibctesting
import
(
"time"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
cryptotypes
"github.com/cosmos/cosmos-sdk/crypto/types"
sdk
"github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/ibc-go/v3/testing"
ibctesting
"github.com/cosmos/ibc-go/v3/testing"
"github.com/cosmos/ibc-go/v3/testing/simapp/helpers"
"github.com/osmosis-labs/osmosis/v10/app"
abci
"github.com/tendermint/tendermint/abci/types"
tmproto
"github.com/tendermint/tendermint/proto/tendermint/types"
"time"
)
type
TestChain
struct
{
...
...
@@ -56,7 +57,6 @@ func SignAndDeliver(
txCfg
client
.
TxConfig
,
app
*
baseapp
.
BaseApp
,
header
tmproto
.
Header
,
msgs
[]
sdk
.
Msg
,
chainID
string
,
accNums
,
accSeqs
[]
uint64
,
priv
...
cryptotypes
.
PrivKey
,
)
(
sdk
.
GasInfo
,
*
sdk
.
Result
,
error
)
{
tx
,
_
:=
helpers
.
GenTx
(
txCfg
,
msgs
,
...
...
This diff is collapsed.
Click to expand it.
x/ibc-rate-limit/testutil/wasm.go
+
2
-
1
View file @
9ffdc37c
...
...
@@ -2,6 +2,8 @@ package osmosisibctesting
import
(
"fmt"
"io/ioutil"
wasmkeeper
"github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes
"github.com/CosmWasm/wasmd/x/wasm/types"
sdk
"github.com/cosmos/cosmos-sdk/types"
...
...
@@ -9,7 +11,6 @@ import (
transfertypes
"github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"
"github.com/osmosis-labs/osmosis/v10/x/ibc-rate-limit/types"
"github.com/stretchr/testify/suite"
"io/ioutil"
)
func
(
chain
*
TestChain
)
StoreContractCode
(
suite
*
suite
.
Suite
)
{
...
...
This diff is collapsed.
Click to expand it.
x/ibc-rate-limit/types/params.go
+
1
-
1
View file @
9ffdc37c
...
...
@@ -2,6 +2,7 @@ package types
import
(
"fmt"
sdk
"github.com/cosmos/cosmos-sdk/types"
paramtypes
"github.com/cosmos/cosmos-sdk/x/params/types"
...
...
@@ -54,7 +55,6 @@ func validateContractAddress(i interface{}) error {
bech32
,
err
:=
sdk
.
AccAddressFromBech32
(
v
)
if
err
!=
nil
{
return
err
}
err
=
sdk
.
VerifyAddressFormat
(
bech32
)
...
...
This diff is collapsed.
Click to expand it.
x/incentives/keeper/msg_server_test.go
+
0
-
1
View file @
9ffdc37c
...
...
@@ -134,7 +134,6 @@ func (suite *KeeperTestSuite) TestCreateGauge_Fee() {
}
func
(
suite
*
KeeperTestSuite
)
TestAddToGauge_Fee
()
{
tests
:=
[]
struct
{
name
string
accountBalanceToFund
sdk
.
Coins
...
...
This diff is collapsed.
Click to expand it.
x/incentives/module.go
+
1
-
2
View file @
9ffdc37c
...
...
@@ -44,8 +44,7 @@ var (
// ----------------------------------------------------------------------------
// Implements the AppModuleBasic interface for the module.
type
AppModuleBasic
struct
{
}
type
AppModuleBasic
struct
{}
// NewAppModuleBasic creates a new AppModuleBasic struct.
func
NewAppModuleBasic
()
AppModuleBasic
{
...
...
This diff is collapsed.
Click to expand it.
x/lockup/module.go
+
1
-
2
View file @
9ffdc37c
...
...
@@ -47,8 +47,7 @@ var (
// ----------------------------------------------------------------------------
// AppModuleBasic implements the AppModuleBasic interface for the capability module.
type
AppModuleBasic
struct
{
}
type
AppModuleBasic
struct
{}
func
NewAppModuleBasic
()
AppModuleBasic
{
return
AppModuleBasic
{}
...
...
This diff is collapsed.
Click to expand it.
x/mint/keeper/export_test.go
+
1
-
3
View file @
9ffdc37c
...
...
@@ -16,9 +16,7 @@ const (
DeveloperVestingAmount
=
developerVestingAmount
)
var
(
GetProportions
=
getProportions
)
var
GetProportions
=
getProportions
func
(
k
Keeper
)
DistributeToModule
(
ctx
sdk
.
Context
,
recipientModule
string
,
mintedCoin
sdk
.
Coin
,
proportion
sdk
.
Dec
)
(
sdk
.
Int
,
error
)
{
return
k
.
distributeToModule
(
ctx
,
recipientModule
,
mintedCoin
,
proportion
)
...
...
This diff is collapsed.
Click to expand it.
x/mint/keeper/keeper_test.go
+
1
-
3
View file @
9ffdc37c
...
...
@@ -158,9 +158,7 @@ func (suite *KeeperTestSuite) TestDistributeMintedCoin() {
mintAmount
=
10000
)
var
(
params
=
types
.
DefaultParams
()
)
params
:=
types
.
DefaultParams
()
tests
:=
[]
struct
{
name
string
...
...
This diff is collapsed.
Click to expand it.
x/pool-incentives/module.go
+
1
-
2
View file @
9ffdc37c
...
...
@@ -40,8 +40,7 @@ var (
_
module
.
AppModuleSimulation
=
AppModule
{}
)
type
AppModuleBasic
struct
{
}
type
AppModuleBasic
struct
{}
// Name returns the pool-incentives module's name.
func
(
AppModuleBasic
)
Name
()
string
{
return
types
.
ModuleName
}
...
...
This diff is collapsed.
Click to expand it.
x/superfluid/keeper/stake_test.go
+
0
-
1
View file @
9ffdc37c
...
...
@@ -514,7 +514,6 @@ func (suite *KeeperTestSuite) TestRefreshIntermediaryDelegationAmounts() {
refreshed
:=
suite
.
App
.
BankKeeper
.
GetBalance
(
suite
.
Ctx
,
intermediaryAcc
.
GetAccAddress
(),
sdk
.
DefaultBondDenom
)
suite
.
Require
()
.
True
(
refreshed
.
IsZero
())
}
})
}
}
...
...
This diff is collapsed.
Click to expand it.
x/superfluid/module.go
+
1
-
2
View file @
9ffdc37c
...
...
@@ -43,8 +43,7 @@ var (
// ----------------------------------------------------------------------------
// AppModuleBasic implements the AppModuleBasic interface for the capability module.
type
AppModuleBasic
struct
{
}
type
AppModuleBasic
struct
{}
func
NewAppModuleBasic
()
AppModuleBasic
{
return
AppModuleBasic
{}
...
...
This diff is collapsed.
Click to expand it.
x/tokenfactory/module.go
+
1
-
2
View file @
9ffdc37c
...
...
@@ -41,8 +41,7 @@ var (
// ----------------------------------------------------------------------------
// AppModuleBasic implements the AppModuleBasic interface for the capability module.
type
AppModuleBasic
struct
{
}
type
AppModuleBasic
struct
{}
func
NewAppModuleBasic
()
AppModuleBasic
{
return
AppModuleBasic
{}
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment