SyntheticToken

Burnable and mintable ERC20.

The contract deployer will initially be the only minter, burner and owner capable of adding new roles.

nonReentrant() modifier

Prevents a contract from calling itself, directly or indirectly. Calling a nonReentrant function from another nonReentrant function is not supported. It is possible to prevent this from happening by making the nonReentrant function external, and make it call a private function that does the actual work.

nonReentrantView() modifier

Designed to prevent a view-only method from being re-entered during a call to a nonReentrant() state-changing method.

onlyRoleHolder(uint256 roleId) modifier

Reverts unless the caller is a member of the specified roleId.

onlyRoleManager(uint256 roleId) modifier

Reverts unless the caller is a member of the manager role for the specified roleId.

onlyExclusive(uint256 roleId) modifier

Reverts unless the roleId represents an initialized, exclusive roleId.

onlyShared(uint256 roleId) modifier

Reverts unless the roleId represents an initialized, shared roleId.

onlyValidRole(uint256 roleId) modifier

Reverts if roleId is not initialized.

onlyInvalidRole(uint256 roleId) modifier

Reverts if roleId is initialized.

constructor(string tokenName, string tokenSymbol, uint8 tokenDecimals) public

Constructs the SyntheticToken.

Parameters:

  • tokenName: The name which describes the new token.

  • tokenSymbol: The ticker abbreviation of the name. Ideally < 5 chars.

  • tokenDecimals: The number of decimals to define token precision.

addMinter(address account) external

Add Minter role to account.

The caller must have the Owner role.

Parameters:

  • account: The address to which the Minter role is added.

removeMinter(address account) external

Remove Minter role from account.

The caller must have the Owner role.

Parameters:

  • account: The address from which the Minter role is removed.

addBurner(address account) external

Add Burner role to account.

The caller must have the Owner role.

Parameters:

  • account: The address to which the Burner role is added.

removeBurner(address account) external

Removes Burner role from account.

The caller must have the Owner role.

Parameters:

  • account: The address from which the Burner role is removed.

resetOwner(address account) external

Reset Owner role to account.

The caller must have the Owner role.

Parameters:

  • account: The new holder of the Owner role.

isMinter(address account) → bool public

Checks if a given account holds the Minter role.

Parameters:

  • account: The address which is checked for the Minter role.

isBurner(address account) → bool public

Checks if a given account holds the Burner role.

Parameters:

  • account: The address which is checked for the Burner role.

_preEntranceCheck() internal

_preEntranceSet() internal

_postEntranceReset() internal

mint(address recipient, uint256 value) → bool external

Mints value tokens to recipient, returning true on success.

Parameters:

  • recipient: address to mint to.

  • value: amount of tokens to mint.

burn(uint256 value) external

Burns value tokens owned by msg.sender.

Parameters:

  • value: amount of tokens to burn.

holdsRole(uint256 roleId, address memberToCheck) → bool public

Whether memberToCheck is a member of roleId.

Reverts if roleId does not correspond to an initialized role.

Parameters:

  • roleId: the Role to check.

  • memberToCheck: the address to check.

resetMember(uint256 roleId, address newMember) public

Changes the exclusive role holder of roleId to newMember.

Reverts if the caller is not a member of the managing role for roleId or if roleId is not an initialized, ExclusiveRole.

Parameters:

  • roleId: the ExclusiveRole membership to modify.

  • newMember: the new ExclusiveRole member.

getMember(uint256 roleId) → address public

Gets the current holder of the exclusive role, roleId.

Reverts if roleId does not represent an initialized, exclusive role.

Parameters:

  • roleId: the ExclusiveRole membership to check.

addMember(uint256 roleId, address newMember) public

Adds newMember to the shared role, roleId.

Reverts if roleId does not represent an initialized, SharedRole or if the caller is not a member of the managing role for roleId.

Parameters:

  • roleId: the SharedRole membership to modify.

  • newMember: the new SharedRole member.

removeMember(uint256 roleId, address memberToRemove) public

Removes memberToRemove from the shared role, roleId.

Reverts if roleId does not represent an initialized, SharedRole or if the caller is not a member of the managing role for roleId.

Parameters:

  • roleId: the SharedRole membership to modify.

  • memberToRemove: the current SharedRole member to remove.

renounceMembership(uint256 roleId) public

Removes caller from the role, roleId.

Reverts if the caller is not a member of the role for roleId or if roleId is not an initialized, SharedRole.

Parameters:

  • roleId: the SharedRole membership to modify.

_createSharedRole(uint256 roleId, uint256 managingRoleId, address[] initialMembers) internal

Internal method to initialize a shared role, roleId, which will be managed by managingRoleId. initialMembers will be immediately added to the role.

Should be called by derived contracts, usually at construction time. Will revert if the role is already initialized.

_createExclusiveRole(uint256 roleId, uint256 managingRoleId, address initialMember) internal

Internal method to initialize an exclusive role, roleId, which will be managed by managingRoleId. initialMember will be immediately added to the role.

Should be called by derived contracts, usually at construction time. Will revert if the role is already initialized.

name() → string public

Returns the name of the token.

symbol() → string public

Returns the symbol of the token, usually a shorter version of the name.

decimals() → uint8 public

Returns the number of decimals used to get its user representation. For example, if decimals equals 2, a balance of 505 tokens should be displayed to a user as 5,05 (505 / 10 ** 2). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless {setupDecimals} is called. NOTE: This information is only used for _display purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.

totalSupply() → uint256 public

See {IERC20-totalSupply}.

balanceOf(address account) → uint256 public

See {IERC20-balanceOf}.

transfer(address recipient, uint256 amount) → bool public

See {IERC20-transfer}. Requirements: - recipient cannot be the zero address. - the caller must have a balance of at least amount.

allowance(address owner, address spender) → uint256 public

See {IERC20-allowance}.

approve(address spender, uint256 amount) → bool public

See {IERC20-approve}. Requirements: - spender cannot be the zero address.

transferFrom(address sender, address recipient, uint256 amount) → bool public

See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}; Requirements: - sender and recipient cannot be the zero address. - sender must have a balance of at least amount. - the caller must have allowance for sender's tokens of at least amount.

increaseAllowance(address spender, uint256 addedValue) → bool public

Atomically increases the allowance granted to spender by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - spender cannot be the zero address.

decreaseAllowance(address spender, uint256 subtractedValue) → bool public

Atomically decreases the allowance granted to spender by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - spender cannot be the zero address. - spender must have allowance for the caller of at least subtractedValue.

_transfer(address sender, address recipient, uint256 amount) internal

Moves tokens amount from sender to recipient. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - sender cannot be the zero address. - recipient cannot be the zero address. - sender must have a balance of at least amount.

_mint(address account, uint256 amount) internal

Creates amount tokens and assigns them to account, increasing the total supply. Emits a {Transfer} event with from set to the zero address. Requirements - to cannot be the zero address.

_burn(address account, uint256 amount) internal

Destroys amount tokens from account, reducing the total supply. Emits a {Transfer} event with to set to the zero address. Requirements - account cannot be the zero address. - account must have at least amount tokens.

_approve(address owner, address spender, uint256 amount) internal

Sets amount as the allowance of spender over the owner`s tokens. This is internal function is equivalent to `approve, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - owner cannot be the zero address. - spender cannot be the zero address.

setupDecimals(uint8 decimals) internal

Sets {decimals} to a value other than the default one of 18. WARNING: This function should only be called from the constructor. Most applications that interact with token contracts will not expect {decimals} to ever change, and may work incorrectly if it does.

_beforeTokenTransfer(address from, address to, uint256 amount) internal

Hook that is called before any transfer of tokens. This includes minting and burning. Calling conditions: - when from and to are both non-zero, amount of from's tokens will be to transferred to to. - when from is zero, amount tokens will be minted for to. - when to is zero, amount of from's tokens will be burned. - from and to are never both zero. To learn more about hooks, head to Using Hooks.

_msgSender() → address payable internal

_msgData() → bytes internal

ResetExclusiveMember(uint256 roleId, address newMember, address manager) event

AddedSharedMember(uint256 roleId, address newMember, address manager) event

RemovedSharedMember(uint256 roleId, address oldMember, address manager) event

Transfer(address from, address to, uint256 value) event

Emitted when value tokens are moved from one account (from) to another (to). Note that value may be zero.

Approval(address owner, address spender, uint256 value) event

Emitted when the allowance of a spender for an owner is set by a call to {approve}. value is the new allowance.

© UMA Project 2018-2019