RiskProtocol / core-protocol

2 stars 0 forks source link

Sample Hardhat Project

This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, and a script that deploys that contract.

Try running some of the following tasks:

npx hardhat help
npx hardhat test
REPORT_GAS=true npx hardhat test
npx hardhat node
npx hardhat run scripts/deploy.ts

Deployment

yarn hardhat deploy --network {desiredNetwork}

notes

The Erc20Upgreadable contract was updated in order to accomodate for 2 new functions, both related to the Rebalance functionalities -- TreasuryTransfer : Transfers the fee amount collected to the tokenFcatory contract so that the contract will hold it for 1 rebalance interval before crediting it to the treasury address This function allows the transfer of the fee amount without using mint -- BalanceAdjust: Adjusts the balance of a user after rebalance is applied according to the new numbers provided by Ding's formula after deducting possible mgmt fees. Again no minting/burning is required

Hence both functions help to keep the totalSupply accurate.

Vanity Deployment

-- Wrappers should be deployed at last

  1. Ensure that the wallet has 1000 wei of underlying
  2. run `yarn hardhat run --network localhost scripts/deploymentScript-wrapped.ts

-- Upgrading contracts use : yarn hardhat run --network sepolia scripts/utils/deployUpgrades.ts

Contracts deployed on Sepolia

{ "tokenFactory": { "proxyAddress": "0xd3371c8cE3Bf5efd2777226071ed4f3b0655d33f", "saltStr": "264" }, "SmartTokenX": { "proxyAddress": "0xD3CaD0B22ED0E5fdc05c5cb5f2533b113B29EDF3", "saltStr": "340" }, "SmartTokenY": { "proxyAddress": "0xd3fEa8aa1075E11947427BE0f6BED1B57992F88D", "saltStr": "368" }, "Orchestator": { "proxyAddress": "0xD34A536885c4Bf938E5cEc06d1e1F4Ab28a024c9", "saltStr": "607" } }