|
1 | 1 | import test from 'ava';
|
| 2 | +import type { OptionsError } from '.'; |
2 | 3 | import { erc20 } from '.';
|
3 | 4 |
|
4 | 5 | import type { ERC20Options } from './erc20';
|
@@ -98,6 +99,126 @@ testERC20('erc20 flashmint', {
|
98 | 99 | flashmint: true,
|
99 | 100 | });
|
100 | 101 |
|
| 102 | +testERC20('erc20 crossChainBridging custom', { |
| 103 | + crossChainBridging: 'custom', |
| 104 | +}); |
| 105 | + |
| 106 | +testERC20('erc20 crossChainBridging custom ownable', { |
| 107 | + crossChainBridging: 'custom', |
| 108 | + access: 'ownable', |
| 109 | +}); |
| 110 | + |
| 111 | +testERC20('erc20 crossChainBridging custom ownable mintable burnable', { |
| 112 | + crossChainBridging: 'custom', |
| 113 | + access: 'ownable', |
| 114 | + mintable: true, |
| 115 | + burnable: true, |
| 116 | +}); |
| 117 | + |
| 118 | +testERC20('erc20 crossChainBridging custom roles', { |
| 119 | + crossChainBridging: 'custom', |
| 120 | + access: 'roles', |
| 121 | +}); |
| 122 | + |
| 123 | +testERC20('erc20 crossChainBridging custom managed', { |
| 124 | + crossChainBridging: 'custom', |
| 125 | + access: 'managed', |
| 126 | +}); |
| 127 | + |
| 128 | +testERC20('erc20 crossChainBridging superchain', { |
| 129 | + crossChainBridging: 'superchain', |
| 130 | +}); |
| 131 | + |
| 132 | +testERC20('erc20 crossChainBridging superchain ownable', { |
| 133 | + crossChainBridging: 'superchain', |
| 134 | + access: 'ownable', |
| 135 | +}); |
| 136 | + |
| 137 | +testERC20('erc20 crossChainBridging superchain roles', { |
| 138 | + crossChainBridging: 'superchain', |
| 139 | + access: 'roles', |
| 140 | +}); |
| 141 | + |
| 142 | +testERC20('erc20 crossChainBridging superchain managed', { |
| 143 | + crossChainBridging: 'superchain', |
| 144 | + access: 'managed', |
| 145 | +}); |
| 146 | + |
| 147 | +test('erc20 crossChainBridging custom, upgradeable not allowed', async t => { |
| 148 | + const error = t.throws(() => |
| 149 | + buildERC20({ |
| 150 | + name: 'MyToken', |
| 151 | + symbol: 'MTK', |
| 152 | + crossChainBridging: 'custom', |
| 153 | + upgradeable: 'transparent', |
| 154 | + }), |
| 155 | + ); |
| 156 | + t.is( |
| 157 | + (error as OptionsError).messages.crossChainBridging, |
| 158 | + 'Upgradeability is not currently supported with Cross-Chain Bridging', |
| 159 | + ); |
| 160 | +}); |
| 161 | + |
| 162 | +test('erc20 crossChainBridging superchain, upgradeable not allowed', async t => { |
| 163 | + const error = t.throws(() => |
| 164 | + buildERC20({ |
| 165 | + name: 'MyToken', |
| 166 | + symbol: 'MTK', |
| 167 | + crossChainBridging: 'superchain', |
| 168 | + upgradeable: 'transparent', |
| 169 | + }), |
| 170 | + ); |
| 171 | + t.is( |
| 172 | + (error as OptionsError).messages.crossChainBridging, |
| 173 | + 'Upgradeability is not currently supported with Cross-Chain Bridging', |
| 174 | + ); |
| 175 | +}); |
| 176 | + |
| 177 | +test('erc20 crossChainBridging superchain, premintChainId required', async t => { |
| 178 | + const error = t.throws(() => |
| 179 | + buildERC20({ |
| 180 | + name: 'MyToken', |
| 181 | + symbol: 'MTK', |
| 182 | + crossChainBridging: 'superchain', |
| 183 | + premint: '2000', |
| 184 | + }), |
| 185 | + ); |
| 186 | + t.is( |
| 187 | + (error as OptionsError).messages.premintChainId, |
| 188 | + 'Chain ID is required when using Premint with Cross-Chain Bridging', |
| 189 | + ); |
| 190 | +}); |
| 191 | + |
| 192 | +testERC20('erc20 premint ignores chainId when not crossChainBridging', { |
| 193 | + premint: '2000', |
| 194 | + premintChainId: '10', |
| 195 | +}); |
| 196 | + |
| 197 | +testERC20('erc20 premint chainId crossChainBridging custom', { |
| 198 | + premint: '2000', |
| 199 | + premintChainId: '10', |
| 200 | + crossChainBridging: 'custom', |
| 201 | +}); |
| 202 | + |
| 203 | +testERC20('erc20 premint chainId crossChainBridging superchain', { |
| 204 | + premint: '2000', |
| 205 | + premintChainId: '10', |
| 206 | + crossChainBridging: 'superchain', |
| 207 | +}); |
| 208 | + |
| 209 | +testERC20('erc20 full crossChainBridging custom non-upgradeable', { |
| 210 | + premint: '2000', |
| 211 | + access: 'roles', |
| 212 | + burnable: true, |
| 213 | + mintable: true, |
| 214 | + pausable: true, |
| 215 | + permit: true, |
| 216 | + votes: true, |
| 217 | + flashmint: true, |
| 218 | + crossChainBridging: 'custom', |
| 219 | + premintChainId: '10', |
| 220 | +}); |
| 221 | + |
101 | 222 | testERC20('erc20 full upgradeable transparent', {
|
102 | 223 | premint: '2000',
|
103 | 224 | access: 'roles',
|
|
0 commit comments