-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPublicMintERC20.rb
38 lines (29 loc) · 1.01 KB
/
PublicMintERC20.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
pragma :rubidity, "1.0.0"
import 'ERC20'
contract :PublicMintERC20, is: :ERC20 do
uint256 :public, :maxSupply
uint256 :public, :perMintLimit
constructor(
name: :string,
symbol: :string,
maxSupply: :uint256,
perMintLimit: :uint256,
decimals: :uint8
) {
ERC20.constructor(name: name, symbol: symbol, decimals: decimals)
s.maxSupply = maxSupply
s.perMintLimit = perMintLimit
}
function :mint, { amount: :uint256 }, :public do
require(amount > 0, 'Amount must be positive')
require(amount <= s.perMintLimit, 'Exceeded mint limit')
require(s.totalSupply + amount <= s.maxSupply, 'Exceeded max supply')
_mint(to: msg.sender, amount: amount)
end
function :airdrop, { to: :address, amount: :uint256 }, :public do
require(amount > 0, 'Amount must be positive')
require(amount <= s.perMintLimit, 'Exceeded mint limit')
require(s.totalSupply + amount <= s.maxSupply, 'Exceeded max supply')
_mint(to: to, amount: amount)
end
end