Skip to content

Commit

Permalink
fix: don't disable token in addAllowedToken
Browse files Browse the repository at this point in the history
  • Loading branch information
harsh-98 committed Feb 26, 2024
1 parent 3cca0f2 commit 8a94129
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions debts/token_threshold.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
)

// token threshold
// before blockNum let the latest LT of all cm/token pair
func (eng *DebtEngine) loadAllowedTokenThreshold(lastDebtSync int64) {
defer utils.Elapsed("Debt(loadAllowedTokenThreshold)")()
data := []*schemas.AllowedToken{}
Expand Down
16 changes: 8 additions & 8 deletions jsonnet/dao_operations_v2/disabled_tokens.jsonnet
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
data: [
{
BlockNumber: 3,
CreditManager: '#CreditManager_1',
DisableBlock: 4,
LiquidityThreshold: '7500',
Token: '#Token_1',
Configurator: '#CreditConfigurator_1',
},
// {
// BlockNumber: 3,
// CreditManager: '#CreditManager_1',
// DisableBlock: 4,
// LiquidityThreshold: '7500',
// Token: '#Token_1',
// Configurator: '#CreditConfigurator_1',
// },
{
BlockNumber: 4,
CreditManager: '#CreditManager_1',
Expand Down
3 changes: 2 additions & 1 deletion repository/handlers/allowed_tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type AllowedTokenRepo struct {

func NewAllowedTokenRepo(blocks *BlocksRepo, tokens *TokensRepo) *AllowedTokenRepo {
return &AllowedTokenRepo{
// cm -> token -> allowed token
allowedTokens: make(map[string]map[string]*schemas.AllowedToken),
mu: &sync.Mutex{},
blocks: blocks,
Expand Down Expand Up @@ -175,7 +176,7 @@ func (repo *AllowedTokenRepo) AddAllowedTokenV2(logID uint, txHash, creditFilter
prevToken := repo.allowedTokens[atoken.CreditManager][atoken.Token]
prevToken.DisableBlock = atoken.BlockNumber
repo.blocks.SetBlock(atoken.BlockNumber)
repo.disabledTokens = append(repo.disabledTokens, prevToken)
// repo.disabledTokens = append(repo.disabledTokens, prevToken)
}
repo.addAllowedTokenState(atoken, true)
var daoEventType uint
Expand Down

0 comments on commit 8a94129

Please sign in to comment.