Skip to content

Commit

Permalink
Assets adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
pgbrandao committed Dec 13, 2023
1 parent 7a007a3 commit 8a49ecc
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 10 deletions.
3 changes: 1 addition & 2 deletions core/src/simulation/find-slots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
getAddressOrProxy,
getAllowIndex,
getBalanceIndex,
isVyper,
} from "core/src/simulation/generate-token-approval-state-diff";
import { Asset } from "../transaction/types";

Expand Down Expand Up @@ -128,7 +127,7 @@ async function simulateSlot(

return findSlot(asset, provider, data, method.index, {
...params,
isVyper: isVyper(asset),
isVyper: asset.isVyper === true,
});
}

Expand Down
10 changes: 3 additions & 7 deletions core/src/simulation/generate-token-approval-state-diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ export function generateFHexString(size: number, stringLen: number = 64) {
return "0x" + repeatString("f", size).padStart(stringLen, "0");
}

export function isVyper(asset: Asset) {
const vyperTypes = ["IGauge", "ICurveLiquidity"];
return vyperTypes.includes(asset.type);
}

export function generateTokenApprovalStateDiff(
asset: Asset,
from: string,
Expand All @@ -70,15 +65,16 @@ export function generateTokenApprovalStateDiff(
`Asset allowSlot or balanceSlot are undefined: ${asset.name} ${asset.type} ${asset.address}`
);
}

const allowIndex = getAllowIndex(asset.allowSlot, {
from,
to,
isVyper: isVyper(asset),
isVyper: asset.isVyper === true,
});

const balanceIndex = getBalanceIndex(asset.balanceSlot, {
from,
isVyper: isVyper(asset),
isVyper: asset.isVyper === true,
});

const address = getAddressOrProxy(asset);
Expand Down
1 change: 1 addition & 0 deletions core/src/transaction/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface Asset {
balanceSlot?: number;
callParams?: any;
price?: number;
isVyper?: boolean;
// rawLogoUri?: string;
// logos?: {
// logoUri: string;
Expand Down
15 changes: 15 additions & 0 deletions data/assets/1/token.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,20 @@
"allowSlot": 3,
"balanceSlot": 2,
"maxSize": 64
},
{
"id": "e9ac450f-efa3-4af1-929d-476c078e9ac6",
"name": "Wrapped Ether",
"chainId": 1,
"active": true,
"address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"color": "#737475",
"decimals": 18,
"symbol": "WETH",
"type": "token",
"visible": true,
"allowSlot": 4,
"balanceSlot": 3,
"maxSize": 64
}
]
21 changes: 21 additions & 0 deletions data/assets/1/yearnDeposit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[
{
"id": "e6062600-14a4-46e1-b3a3-62bbf90df7a8",
"name": "WETH yVault",
"chainId": 1,
"active": true,
"address": "0xa258C4606Ca8206D8aA700cE2143D7db854D168c",
"color": "#737475",
"decimals": 18,
"symbol": "yvWETH",
"type": "yearnDeposit",
"visible": true,
"isVyper": true,
"linkedAssets": [
{
"assetId": "e9ac450f-efa3-4af1-929d-476c078e9ac6",
"fraction": 1
}
]
}
]
2 changes: 1 addition & 1 deletion data/assets/137/uniswapV2Liquidity.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"visible": false,
"allowSlot": 2,
"balanceSlot": 1,
"maxSize": 40,
"maxSize": 64,
"linkedAssets": [
{
"assetId": "af62d010-5df9-4eae-919c-8d6dd63fe45e",
Expand Down

0 comments on commit 8a49ecc

Please sign in to comment.