Class: PublicMintERC20

Inherits:
ERC20
  • Object
show all
Defined in:
lib/rubysol/contracts/public_mint_erc20.rb

Instance Method Summary collapse

Methods inherited from ERC20

#_burn, #_mint, #approve, #transfer, #transferFrom

Instance Method Details

#airdrop(to:, amount:) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/rubysol/contracts/public_mint_erc20.rb', line 30

def airdrop( to:, amount: )
  assert amount > 0, 'Amount must be positive'
  assert amount <= @perMintLimit, 'Exceeded mint limit'
  assert @totalSupply + amount <= @maxSupply, 'Exceeded max supply'
  
  _mint( to: to, amount: amount )
end

#constructor(name:, symbol:, maxSupply:, perMintLimit:, decimals:) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/rubysol/contracts/public_mint_erc20.rb', line 8

def constructor(
  name:,
  symbol:,
  maxSupply:,
  perMintLimit:,
  decimals: 
  )
  super( name: name, symbol: symbol, decimals: decimals )
  @maxSupply    = maxSupply
  @perMintLimit = perMintLimit
end

#mint(amount:) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/rubysol/contracts/public_mint_erc20.rb', line 21

def mint( amount: )
  assert amount > 0, 'Amount must be positive'
  assert amount <= @perMintLimit, 'Exceeded mint limit'    
  assert @totalSupply + amount <= @maxSupply, 'Exceeded max supply'
  
  _mint( to: msg.sender, amount: amount )
end