Skip to content

Hardhat Environment for Frigg Smart Contracts

Notifications You must be signed in to change notification settings

omahs/frigg-smartcontracts

Repository files navigation

Smart Contracts

This documentation is meant to be private

Audits

Audited by AxLabs GmbH & Axelra AG. Report available under /audit


Router Contract (primaryRouter.sol)

  • For primary market buy/sell between Issuers and Investors

Router Gater Contract (routerGater.sol)

  • "Guard" the Router contract to check if the users is eligible to buy/sell at primary market

Token Contract (e.g ATT.sol)

  • Frigg deploys a new ERC20 token for each new issuance

Contract Addresses

Contract Mainnet Testnet (Goerli)
routerGater.sol 0xBCc3dB2316d8793f84c822953B622Bd292424C68 0x64a75f145e859Af7399f188Cf674afd7416D2b46
primaryRouter.sol 0x96418DF8B474e90E49183CC23fa41e4aD8B0ddbE 0x549eC5e96B71cBE1a837D0F1289462757e1d83E9
ATT.sol 0x90D53b872ce6421122B41a290aCdD22a5eD931bd 0x25a1dAd9d882c335D100f8E0cb20701376Eeb658

Governance

Logic is available on Microsoft Whiteboard here (https://friggeco-my.sharepoint.com/:wb:/g/personal/jack_chong_frigg_eco/EXK9aFawTcVDmgGW3uFAJwUBGNE7OXfZDIkfbzSOFHMgAg?e=g8p9UL)

image


Development

Deployment Sequence:

  1. routerGater.sol

  1. primaryRouter.sol
  • address _multisig = Gnosis Safe Frigg.eco is granted DEFAULT_ADMIN_ROLE (This account can change contract's state!)
  • address _routerGater = Contract Address of routerGater.sol

  1. ATT.sol (or any other Issuance token contract)
  • address _multisig = Gnosis Safe Agatobwe.eco will be granted DEFAULT_ADMIN_ROLE (This account can change contract's state!)
  • address _router = Router Contract Address will be granted ROUTER_ROLE (Only the router is allowed to mint / burn tokens!)

How to deploy the contracts?

  • Deploy new contracts: npx hardhat run scripts/deploy.ts --network <network>

    • All contracts (routerGater, primaryRouter & ATT) get compiled
    • All contracts (routerGater, primaryRouter & ATT) get deployed to goerli
    • (In the current deploy.ts, the token automatically gets added via add() to the router)
  • Verify deployed Contract: e.g: npx hardhat (hh) verify --contract "contracts/contract.sol:contract" --network <network> <address> <...args>

  • Add new token to primaryRouter

    • Call function add() of router contract with params:
      outputTokenAddress: Contract Address of Token (e.g. ATT)
      uIdContract: UID Contract Address (Choose correct contract on testnet & mainnet!)
      issuer: Account of Issues (Gnosis Safe)
      issuancePrice: Initial Price 1000000000000 (price = (1 * 10^18) / (USD * 10^6) e.g., 100USD = 10^18/10^8)
      expiryPrice: Expiry Price 666666666666 (price = (1/(expirydigit) * 10^18) / (USD * 10^6) e.g., 200USD = 10^18/20^8)
      issuanceTokenAddress: USDC Contract Address (Choose correct contract on testnet & mainnet!)

New Contracts launched! 🚀


If you want to use the contracts on the microsite, follow these steps:

  • Update Frigg's Uniswap Widget: https://github.com/FriggGroup/uniswap-widgets

    • package.json: Increment Version Number
    • src/constants/addresses.ts: Replace old router addresses
    • src/cosmos/Swap.fixture.tsx Line 38 & 80: Replace old token address
    • {abi}.json: Check all abi files if they're up-to-date
    • Run yarn build
    • Run yarn release
  • Update Microsite: https://github.com/FriggGroup/friggdemo

    • Delete node_modules
    • package.json: @friggeco/uniswap-widgets: Add new version & yarn install
    • packages/shared/constants/addresses.ts: Replace old router & token addresses
    • {abi}.json: Check all abi files if they're up-to-date
    • Test the microsite yarn dev:microsite

New Contracts launched on Microsite! 🚀


Tests

  1. run hardhat tests with command npx hardhat test
  2. documentation for tests are available in /test/README.md

About

Hardhat Environment for Frigg Smart Contracts

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •