Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SensePT as collateral #107

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

SensePT as collateral #107

wants to merge 4 commits into from

Conversation

iamsahu
Copy link
Contributor

@iamsahu iamsahu commented Feb 20, 2023

Proposal

Enable SensePT as a collateral.

Background

This would allow user to borrow DAI against SensePT as collateral.

Details

Following steps would be taken to get SensePT as a collateral:

  1. Deploy IdentityOracle (no need for governance approval)
  2. Deploy joins for the SensePT assets (no need for governance approval)
  3. Governance Proposal
    1. Orchestrate the new join
    2. Add SensePT tokens as Assets
    3. Make SensePT token as ilk
    4. Add SensePT tokens as ilks in series

Here is the configuration

export const contractDeployments: ContractDeployment[] = [
  {
    addressFile: 'protocol.json',
    name: IDENTITY_ORACLE,
    contract: 'IdentityOracle',
    args: [],
  },
  {
    addressFile: 'joins.json',
    name: SPCDAI2307,
    contract: 'Join',
    args: [() => assets.getOrThrow(SPCDAI2307)!],
  },
]

export const ilkToDAI: Ilk = {
  baseId: DAI,
  ilkId: spcdai2307.assetId,
  asset: spcdai2307,
  collateralization: {
    baseId: DAI,
    ilkId: spcdai2307.assetId,
    oracle: protocol().getOrThrow(IDENTITY_ORACLE)!,
    ratio: 1100000,
  },
  debtLimits: {
    baseId: DAI,
    ilkId: spcdai2307.assetId,
    line: 250000,
    dust: 1000,
    dec: 18,
  },
}

export const ilks: Ilk[] = [ilkToDAI]

export const daiSeries: Series[] = [
  {
    seriesId: FYDAI2306,
    fyToken: { assetId: FYDAI2306, address: fyTokens.getOrThrow(FYDAI2306)! },
    chiOracle: '',
    pool: nullAsset,
    ilks: [ilkToDAI],
  },
]

export const newSeries: Series[] = [...daiSeries]

Testing

The change has been deployed on a mainnet fork with the following output.

+ npx hardhat run --network tenderly ./scripts/governance/add/addCollateral/addSensePTCollateral/../../../../../shared/deploy.ts
Deploying identityOracle IdentityOracle with
  Contract at 0x6d49270f46af10dacc678f815959182442c6c8e8 verified.
identityOracle IdentityOracle deployed at 0x6d49270f46aF10dACC678F815959182442C6C8E8
identityOracle at 0x6d49270f46aF10dACC678F815959182442C6C8E8 verified on tenderly
  Contract at 0xe27a58494bd2953f8cdd28216a7dcea9faa90518 verified.
Deploying SPCDAI2307 Join with 0x9C5eDebb6fE50C9447828A30a2414c061C74Cd77
  Contract at 0x9c6ab6915a94e33d1b1ec9d631246c479b8188bc verified.
SPCDAI2307 Join deployed at 0x9c6AB6915A94E33D1B1ec9d631246c479B8188bC
SPCDAI2307 at 0x9c6AB6915A94E33D1B1ec9d631246c479B8188bC verified on tenderly
SPCDAI2307.grantRoles(ROOT, timelock)
+ npx hardhat run --network tenderly ./scripts/governance/add/addCollateral/addSensePTCollateral/addSensePT.ts
Impersonated 0xC7aE076086623ecEA2450e364C838916a043F9a8

ORCHESTRATE_JOIN

        REVOKE_ROOT
        0x9c6AB6915A94E33D1B1ec9d631246c479B8188bC revokeRole(ROOT 0x05e2071814991c65647850EEa8c4bf23D35f9189)

        ADD_AS_HOST_TO_CLOAK

GRANT_ROOT
0x9c6AB6915A94E33D1B1ec9d631246c479B8188bC grantRole(ROOT 0x82375994C79e902286D347C9eDE644eA12659FCC)
join.grantRoles(gov, timelock)

ADD_ASSET
Using asset at 0x9C5eDebb6fE50C9447828A30a2414c061C74Cd77
Using join at 0x9c6AB6915A94E33D1B1ec9d631246c479B8188bC

        MAKE_ASSET
        Make asset: SPCDAI2307: 0x9C5eDebb6fE50C9447828A30a2414c061C74Cd77,

        ADD_JOIN_TO_LADLE
        cloak.add(ladle join and exit SPCDAI2307)
        Adding SPCDAI2307 join to Ladle using 0x9c6AB6915A94E33D1B1ec9d631246c479B8188bC

MAKE_ILK

        UPDATE_COLLATERALIZATION
        Spot oracle for 0x303100000000/0x40311700028C set to 0x6d49270f46aF10dACC678F815959182442C6C8E8 with ratio 1100000
  UPDATE_DEBT_LIMITS
  ┌─────────┬──────────────────┐
  │ (index) │      Values      │
  ├─────────┼──────────────────┤
  │  base   │      'DAI'       │
  │   ilk   │   'SPCDAI2307'   │
  │ baseId  │ '0x303100000000' │
  │  ilkId  │ '0x40311700028C' │
  │  line   │      250000      │
  │  dust   │       1000       │
  │   dec   │        18        │
  └─────────┴──────────────────┘

ADD_ILK_TO_SERIES
addIlks FYDAI2306: SPCDAI2307
Impersonated 0xC7aE076086623ecEA2450e364C838916a043F9a8
Proposal: 0x13f45f903c435e20c2f16b36b8da79062efcb20b5e34e33c1e396a16a6c5f9b2
Proposing
Developer: 0xC7aE076086623ecEA2450e364C838916a043F9a8

Calldata:
0xca02753a00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000005c000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000840000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000a800000000000000000000000000000000000000000000000000000000000000b800000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000d600000000000000000000000000000000000000000000000000000000000000ec00000000000000000000000000000000000000000000000000000000000000f80000000000000000000000000000000000000000000000000000000000000108000000000000000000000000000000000000000000000000000000000000011a000000000000000000000000000000000000000000000000000000000000012a000000000000000000000000000000000000000000000000000000000000013c000000000000000000000000000000000000000000000000000000000000014c0000000000000000000000000e27a58494bd2953f8cdd28216a7dcea9faa905180000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004444faded0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005e2071814991c65647850eea8c4bf23d35f918900000000000000000000000000000000000000000000000000000000000000000000000000000000e27a58494bd2953f8cdd28216a7dcea9faa9051800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000044de02cde7000000000000000000000000000000000000000000000000000000000000000000000000000000000000000082375994c79e902286d347c9ede644ea12659fcc00000000000000000000000000000000000000000000000000000000000000000000000000000000e27a58494bd2953f8cdd28216a7dcea9faa9051800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000084effae35300000000000000000000000000000000000000000000000000000000000000400000000000000000000000003b870db67a45611cf4723d44487eaf398fac51e30000000000000000000000000000000000000000000000000000000000000001f06c2dfc0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c88191f8cb8e6d4a668b047c1c8503432c3ca86700000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000044e665f9e44030170002890000000000000000000000000000000000000000000000000000000000000000000000000000161406b993c4200f8089918840d9055368e0c67500000000000000000000000000000000000000000000000000000000000000000000000000000000e27a58494bd2953f8cdd28216a7dcea9faa90518000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a4effae35300000000000000000000000000000000000000000000000000000000000000400000000000000000000000006cb18ff2a33e981d1e38a663ca056c0a5265066a0000000000000000000000000000000000000000000000000000000000000002ceae3abd0000000000000000000000000000000000000000000000000000000012e5ff77000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000082375994c79e902286d347c9ede644ea12659fcc000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000e4f92bcb0d0000000000000000000000006cb18ff2a33e981d1e38a663ca056c0a5265066a00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000e27a58494bd2953f8cdd28216a7dcea9faa90518ceae3abd00000000000000000000000000000000000000000000000000000000000000000000000000000000e27a58494bd2953f8cdd28216a7dcea9faa9051812e5ff7700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006cb18ff2a33e981d1e38a663ca056c0a5265066a0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004449c29d2b4030170002890000000000000000000000000000000000000000000000000000000000000000000000000000e27a58494bd2953f8cdd28216a7dcea9faa90518000000000000000000000000000000000000000000000000000000000000000000000000000000009c6ab6915a94e33d1b1ec9d631246c479b8188bc0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004444faded0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005e2071814991c65647850eea8c4bf23d35f9189000000000000000000000000000000000000000000000000000000000000000000000000000000009c6ab6915a94e33d1b1ec9d631246c479b8188bc00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000044de02cde7000000000000000000000000000000000000000000000000000000000000000000000000000000000000000082375994c79e902286d347c9ede644ea12659fcc000000000000000000000000000000000000000000000000000000000000000000000000000000009c6ab6915a94e33d1b1ec9d631246c479b8188bc00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000084effae35300000000000000000000000000000000000000000000000000000000000000400000000000000000000000003b870db67a45611cf4723d44487eaf398fac51e30000000000000000000000000000000000000000000000000000000000000001f06c2dfc0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c88191f8cb8e6d4a668b047c1c8503432c3ca86700000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000044e665f9e440311700028c00000000000000000000000000000000000000000000000000000000000000000000000000009c5edebb6fe50c9447828a30a2414c061c74cd77000000000000000000000000000000000000000000000000000000000000000000000000000000009c6ab6915a94e33d1b1ec9d631246c479b8188bc000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a4effae35300000000000000000000000000000000000000000000000000000000000000400000000000000000000000006cb18ff2a33e981d1e38a663ca056c0a5265066a0000000000000000000000000000000000000000000000000000000000000002ceae3abd0000000000000000000000000000000000000000000000000000000012e5ff77000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000082375994c79e902286d347c9ede644ea12659fcc000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000e4f92bcb0d0000000000000000000000006cb18ff2a33e981d1e38a663ca056c0a5265066a000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000009c6ab6915a94e33d1b1ec9d631246c479b8188bcceae3abd000000000000000000000000000000000000000000000000000000000000000000000000000000009c6ab6915a94e33d1b1ec9d631246c479b8188bc12e5ff7700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006cb18ff2a33e981d1e38a663ca056c0a5265066a0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004449c29d2b40311700028c00000000000000000000000000000000000000000000000000000000000000000000000000009c6ab6915a94e33d1b1ec9d631246c479b8188bc00000000000000000000000000000000000000000000000000000000000000000000000000000000c88191f8cb8e6d4a668b047c1c8503432c3ca867000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000848ef6bdfa303000000000000000000000000000000000000000000000000000000000000040301700028900000000000000000000000000000000000000000000000000000000000000000000000000006d49270f46af10dacc678f815959182442c6c8e8000000000000000000000000000000000000000000000000000000000010c8e000000000000000000000000000000000000000000000000000000000000000000000000000000000c88191f8cb8e6d4a668b047c1c8503432c3ca867000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a4d3fc152b3030000000000000000000000000000000000000000000000000000000000000403017000289000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000960000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000000000000000000000c88191f8cb8e6d4a668b047c1c8503432c3ca867000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000848ef6bdfa303100000000000000000000000000000000000000000000000000000000000040311700028c00000000000000000000000000000000000000000000000000000000000000000000000000006d49270f46af10dacc678f815959182442c6c8e8000000000000000000000000000000000000000000000000000000000010c8e000000000000000000000000000000000000000000000000000000000000000000000000000000000c88191f8cb8e6d4a668b047c1c8503432c3ca867000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a4d3fc152b303100000000000000000000000000000000000000000000000000000000000040311700028c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003d09000000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000000000000000000000c88191f8cb8e6d4a668b047c1c8503432c3ca8670000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008453eecb77303030390000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001403017000289000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c88191f8cb8e6d4a668b047c1c8503432c3ca8670000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008453eecb770031ff00028b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000140311700028c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Proposed 0x13f45f903c435e20c2f16b36b8da79062efcb20b5e34e33c1e396a16a6c5f9b2
+ npx hardhat run --network tenderly ./scripts/governance/add/addCollateral/addSensePTCollateral/../../../../../shared/approve.ts
Impersonated 0xd659565b84bcfcb23b02ee13e46cb51429f4558a
Proposal: 0x13f45f903c435e20c2f16b36b8da79062efcb20b5e34e33c1e396a16a6c5f9b2
Approving
Approved: 0x13f45f903c435e20c2f16b36b8da79062efcb20b5e34e33c1e396a16a6c5f9b2
advancing time by 172800 seconds (2 days) to 1677217301
+ npx hardhat run --network tenderly ./scripts/governance/add/addCollateral/addSensePTCollateral/../../../../../shared/execute.ts
Impersonated 0xC7aE076086623ecEA2450e364C838916a043F9a8
Proposal: 0x13f45f903c435e20c2f16b36b8da79062efcb20b5e34e33c1e396a16a6c5f9b2
Executing
Estimated gas: 919904 - ETH Balance: 1.0
Executed 0x13f45f903c435e20c2f16b36b8da79062efcb20b5e34e33c1e396a16a6c5f9b2
TxHash: 0x64174b9ffd0a8291c4db09a66d95ac9c420edf21de667488233e05b2ff4ef453

@iamsahu iamsahu marked this pull request as ready for review February 20, 2023 05:45
@iamsahu iamsahu requested a review from alcueca February 24, 2023 09:37
@alcueca
Copy link
Contributor

alcueca commented Feb 24, 2023

Proposed: 0xe2307f4a89df407c614420550c4bf9b2c249496f234fa5ae0288bb41a59a8772

@iamsahu
Copy link
Contributor Author

iamsahu commented Mar 8, 2023

Proposed again: 0x04081bd9328a03c82d840525f0a5afe431ef7804a826b6af461abc63b2273bbc

There was an issue with the IdentityOracle which had to be redeployed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants