GoodDocs
  • Welcome to GoodDocs!
  • GoodDollar Ecosystem Vision
  • About the Protocol
    • Usage
    • Tokenomics
    • Sybil-Resistance
    • Protocol V3 Documentation
      • Architecture & Value Flow
      • System's Elements
      • Core Contracts & API
        • GoodDollar
        • GoodCompoundStaking V2 (DAI)
        • GoodAaveStaking V2 (USDC)
        • GoodReserveCDai
        • GoodFundManager
        • GoodMarketMaker
        • ContributionCalculation
        • UBIScheme
        • Identity
        • FirstClaimPool
        • AdminWallet
        • OneTimePayments
        • DonationsStaking
        • NameService
        • GReputation
        • CompoundVotingMachine
        • StakersDistribution
        • UniswapV2SwapHelper
        • Invites
        • GovernanceStaking
        • ClaimersDistribution
        • CompoundStakingFactory
        • AaveStakingFactory
        • ExchangeHelper
        • FuseFaucet
        • GoodDollarMintBurnWrapper
      • Previous Protocol Versions
        • Protocol V1
          • Architecture & Value Flow
          • Core Contracts & API
        • Protocol V2
          • Architecture & Value Flow
          • System's Elements
            • 1. The token (G$)
            • 2. The Reserve
            • 3. The Trust
            • 4. Staking rewards (APR)
            • 5. The Fund Manager
            • 6. The Distribution Contract (DisCo)
            • 7. Governance (DAO)
          • Core Contracts & API
            • GoodDollar
            • GoodCompoundStaking V2 (DAI)
            • GoodAaveStaking V2 (USDC)
            • GoodReserveCDai
            • GoodFundManager
            • GoodMarketMaker
            • ContributionCalculation
            • UBIScheme
            • Identity
            • FirstClaimPool
            • AdminWallet
            • OneTimePayments
            • DonationsStaking
            • NameService
            • GReputation
            • CompoundVotingMachine
            • StakersDistribution
            • UniswapV2SwapHelper
            • Invites
            • GovernanceStaking
            • ClaimersDistribution
            • CompoundStakingFactory
            • AaveStakingFactory
            • ExchangeHelper
            • FuseFaucet
  • User Guides
    • Buy & Sell G$
    • Stake to create UBI
    • Claim GOOD and G$X
    • Bridge GoodDollars
    • Connect another wallet address to identity
  • Liquidity
  • Wallet and Products
    • GoodWallet
    • GoodDapp
    • New GoodWallet
    • GoodCollective
    • GoodID & GoodOffers
    • 3rd Party Partners and Integrations
  • Frequently Asked Questions
    • Web3 basic knowledge and security tips - by Consensys
    • About GoodDollar
    • GoodDollar Protocol & G$ Token
    • Using GoodDollar
    • GoodDollar Community
    • Troubleshooting
  • For Developers
    • Contributing to GoodDollar
    • GoodDapp Developer Guides
      • Deploy your own GoodDapp UI
    • APIs & SDKs
      • Claim UBI
      • React Hooks Setup
      • Login With GoodDollar
      • Sybil Resistance
        • Identity (Ethers v5 / React)
        • Identity (Viem/Wagmi)
  • Useful Links
    • GoodDollar.org
    • GoodDapp
    • GoodWallet
    • GoodDollar User Guides
    • Statistics Dashboard
    • GoodDollar Whitepaper
    • GoodDollar Litepaper
    • GoodDollar Litepaper - Español
Powered by GitBook
On this page

Was this helpful?

  1. About the Protocol
  2. Protocol V3 Documentation
  3. Core Contracts & API

GoodDollarMintBurnWrapper

PreviousFuseFaucetNextPrevious Protocol Versions

Last updated 2 years ago

Was this helpful?

Contract Specs

  • Purpose of contract is to:

    • Distribute rewards by permissioned contracts (_minters) from current balance of bridged G$ rewards or mint fresh ones on sidechains.

    • Give permissions to bridges to mint G$ on sidechains (starting with ) based on

  • should modify/add logic to MintBurnWrapper

  • prerequisites:

    • GoodDAO needs to register scheme on the sidechain (so it can call controller to mint)

  • Should implement the following methods

    • initialize(uint256 bpsPerDayMaxValue, address guardian)

    • setUpdateFrequency(uint256 timestampOrBlockNumber)

      • only avatar or guardian

    • addMinter(address minter, uint256 cap, uint256 max, uint32 bpsPerDay, bool withRewardsRole)

      • bpsPerDay is relevant for sendOrMint functionality, cap+max are limits for bridge and other minters. withRewardsRole, does this minter has permissions to call sendOrMint.

      • bpsPerDay is in basepoints ie 300 = 300/10000 = 0.03 = 3%

      • calculate nominal perDayDistributionLimit = _bpsPerDayDistributionLimit*G$Supply/10000

      • adds minter, dateUpdated(can be block), _bpsPerDayDistributionLimit and perDayDistributionLimit to the list of addresses that are allowed to mint

      • should only be updatable by Avatar or Guardian

      • should be able to call this multiple times to update _bpsPerDayDistributionLimit

      • should emit event

    • removeMinter(address _minter) // or add with 0

      • removes _minter

      • should emit event

    • balanceDebt()

      • only runs if(contractG$Balance>0 && mintingDebt>0)

      • burn: burned = min(contractG$Balance, mintingDebt)

      • mintingDebt -= burned

    • sendOrMint(uint256 _amount, address _to)

      • should verify sender is a minter

      • call balanceDebt()

      • should reset mintedToday[minter] if day passed

      • should send to _to: sentAmount = min(contractG$Balance, _amount)

      • should mint to _to mintedAmount = min(perDayDistributionLimit - distributedToday, _amount - sentAmount)

      • totalRewardsSent = sentAmount + mintedAmount

      • mintingDebt += mintedAmount

      • increase distributedToday[minter] with amount totalRewardsSent

      • if updateFrequency months passed or a updateFrequency months worth of blocks (depending if we keep blockUpdated or dateUpdated) then recalculate the perDayDistributionLimit according to current supply

      • should emit event

      • reentrancy guard + update then call pattern

      • return the totalRewardsSent

    • onTokenTransfer

      • support for a single token transfer to bridge via multichain without needing to approve token transfer first

    • burn/mint

      • support multichain router API

Multichain.org
https://github.com/anyswap/multichain-smart-contracts/blob/1459fe6281867319af8ffb1849e5c16d242d6530/contracts/wrapper/MintBurnWrapper.sol