LogoLogo
  • Swarm Network
  • Swarm Network
    • Network Governance
      • Getting started
      • Voting App
      • The Swarm Network
        • Powers
        • Governance
        • Members
        • Swarm Council
        • Treasury
      • Initiating Governance Actions
        • Introduction
        • Proposals
        • Ballot Types
        • Submitting a GAP
      • Governance Action Voting Process
        • Ballots
        • Retrieving the text of previous ballots
        • Voting
    • SWM Token
    • SWM Staking
  • Swarm Protocol
    • SRC20
      • SRC20 Token Contract
      • Transfer Rules Contract
      • Featured Contract
      • Roles Contract
      • SRC20 Registry Contract
      • Asset Registry Contract
      • Minter Contract
      • SRC20Factory Contract
    • Swarm Powered Fundraise
      • Uniswap Proxy Contract
      • Currency Registry Contract
      • Affiliate Manager Contract
      • Swarm Powered Fundraise Contract
      • Contributor Restrictions Contract
    • mySwarm.app
    • kovan.mySwarm.app (test version, please use this)
    • Mumbai Testnet
  • Open tools
    • Legacy Masternode Reward Collection
    • VerifiedExistence
    • Market Access Protocol
  • Keep up
    • Blog
    • Twitter
    • Discourse
    • Telegram
    • Voting App
    • FAQ
Powered by GitBook
On this page
  • Feature Description
  • Read Functions
  • Write Functions

Was this helpful?

  1. Swarm Protocol
  2. Swarm Powered Fundraise

Currency Registry Contract

- BETA -

PreviousUniswap Proxy ContractNextAffiliate Manager Contract

Last updated 4 years ago

Was this helpful?

  • Smart Contract: specific to a Swarm Powered Fundraise for a specific SRC20

  • Created: review the ; then referenced in the Swarm Powered Fundraise contract

  • Purpose: Registers all currencies that will be accepted in a specific Swarm Powered Fundraise

  • Example: TBD

Feature Description

Read Functions

Function

Description

currenciesList[address] returns (struct)

An array of CurrencyStats Objects. These objects have the following structure: struct CurrencyStats {address erc20address; address exchangeProxy; uint256 finalExchangeRate; uint256 totalBufferedAmount; uint256 totalQualifiedAmount;}

getAcceptedCurrencies() returns (address[])

Returns an array of the accepted currencies in a Swarm Powered Fundraise

currencyIndex[address] returns (uint256)

A mapping of accepted currency addresses to integers; To obtain the index of DAI in the contract use currencyIndex(“0x6B175474E89094C44Da98b954EedeAC495271d0F”)

lockedExchangeRate(address) returns (uint256)

Returns the value of the locked exchange rate of the currency in the first parameter

isAccepted(address) returns (bool)

Returns if a specific currency is accepted in a Swarm Powered Fundraise; To check if the fundraise accepts DAI use isAccepted(“0x6B175474E89094C44Da98b954EedeAC495271d0F”)

getBaseCurrency() returns (address)

Returns the base currency in which a Swarm Powered Fundraise is denominated

toUSD(uint256, address) returns (uint256)

Converts the amount given as the first parameter into USD. The second parameter is the address of the currency to be converted to USD.

toBCY(uint256, address) returns (uint256)

Converts the amount given as the first parameter into the Base Currency. The second parameter is the address of the currency to be converted to Base Currency

getRate(address, address, uint256, uint256) returns (uint256, uint256)

Returns the exchange rate between the first and the second address. The first parameter is the token address of the currency to be exchanged from, the second parameter is the address of the currency to be exchanged to, the third parameter is the value in Wei to be exchanged and the fourth parameter is the decimal places. E.g. to get the rate of 1 ETH in DAI use getRate(“0x0000000000000000000000000000000000000000”,"0x2a1530C4C41db0B0b2bB646CB5Eb1A67b7158667”,1000000000000000000,0)

isOwner() returns (bool)

Returns true if the calling address is the contract owner

owner() returns (address)

Returns the address of the contract owner

Write Functions

Function

Description

addCurrency(address, address) returns (bool)

Adds a currency to the list of currencies accepted in a Swarm Powered Fundraise. The first parameter is the token address and the second parameter is the address of the exchange proxy contract

lockExchangeRates()

Locks the exchange rates of currencies accepted in a Swarm Powered Fundraise to the Base Currency

setBaseCurrency(address)

Sets a base currency from the list of currencies accepted in a Swarm Powered Fundraise; the parameter is the address of the base currency to be set

setUSDERC20(address) returns (bool)

Sets the currency address that will be used as the default USD dollar oracle address for a Swarm Powered Fundraise. Usually set to USDC; e.g. to set to USDC use setUSDERC20(“0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48”)

renounceOwnership()

Contract owner can renounce ownership of this Currency Registry contract

transferOwnership()

Transfers ownership of this Currency Registry contract to another address

SPF Deployment Sequence