MCPcopy Create free account
hub / github.com/circlefin/arc-node / buildNativeFiatTokenGenesisAllocs

Function buildNativeFiatTokenGenesisAllocs

scripts/genesis/NativeFiatToken.ts:95–193  ·  view source on GitHub ↗
(ctx: BuilderContext, config: NativeFiatTokenConfig)

Source from the content-addressed store, hash-verified

93export type NativeFiatTokenConfig = z.infer<typeof schemaNativeFiatToken>
94
95export const buildNativeFiatTokenGenesisAllocs = async (ctx: BuilderContext, config: NativeFiatTokenConfig) => {
96 const {
97 proxy,
98 implementation: impl,
99 owner,
100 pauser,
101 blacklister,
102 masterMinter,
103 rescuer,
104 minters,
105 } = schemaNativeFiatToken.parse(config)
106
107 if (proxy.address != null && proxy.address !== FIAT_TOKEN_ADDRESS) {
108 throw new Error('Proxy address must be FIAT_TOKEN_ADDRESS')
109 }
110
111 const [signatureCheckerAddress, signatureCheckerAlloc] = await buildImplContractAlloc(ctx, 'SignatureChecker')
112 const [implAddress, implAlloc] = await buildImplContractAlloc(ctx, impl?.contractName ?? DEFAULT_IMPL_CONTRACT)
113 const [proxyAddress, proxyAlloc] = await buildSystemContractAlloc({
114 ctx,
115 address: proxy.address ?? FIAT_TOKEN_ADDRESS,
116 contractName: proxy.contractName ?? DEFAULT_PROXY_CONTRACT,
117 storage: [
118 StorageSlot(FIAT_TOKEN_PROXY_ADMIN_SLOT, addressToBytes32(proxy.admin)),
119 StorageSlot(FIAT_TOKEN_PROXY_IMPL_SLOT, addressToBytes32(implAddress)),
120
121 /*
122 * `forge inspect NativeFiatTokenV2_2 storage`
123 * ╭-------------------------------------+-------------------------------------------------+------+--------+-------╮
124 * | Name | Type | Slot | Offset | Bytes |
125 * +===============================================================================================================+
126 * | _owner | address | 0 | 0 | 20 |
127 * |-------------------------------------+-------------------------------------------------+------+--------+-------|
128 * | pauser | address | 1 | 0 | 20 |
129 * |-------------------------------------+-------------------------------------------------+------+--------+-------|
130 * | paused | bool | 1 | 20 | 1 |
131 * |-------------------------------------+-------------------------------------------------+------+--------+-------|
132 * | blacklister | address | 2 | 0 | 20 |
133 * |-------------------------------------+-------------------------------------------------+------+--------+-------|
134 * | _deprecatedBlacklisted | mapping(address => bool) | 3 | 0 | 32 |
135 * |-------------------------------------+-------------------------------------------------+------+--------+-------|
136 * | name | string | 4 | 0 | 32 |
137 * |-------------------------------------+-------------------------------------------------+------+--------+-------|
138 * | symbol | string | 5 | 0 | 32 |
139 * |-------------------------------------+-------------------------------------------------+------+--------+-------|
140 * | decimals | uint8 | 6 | 0 | 1 |
141 * |-------------------------------------+-------------------------------------------------+------+--------+-------|
142 * | currency | string | 7 | 0 | 32 |
143 * |-------------------------------------+-------------------------------------------------+------+--------+-------|
144 * | masterMinter | address | 8 | 0 | 20 |
145 * |-------------------------------------+-------------------------------------------------+------+--------+-------|
146 * | initialized | bool | 8 | 20 | 1 |
147 * |-------------------------------------+-------------------------------------------------+------+--------+-------|
148 * | balanceAndBlacklistStates | mapping(address => uint256) | 9 | 0 | 32 |
149 * |-------------------------------------+-------------------------------------------------+------+--------+-------|
150 * | allowed | mapping(address => mapping(address => uint256)) | 10 | 0 | 32 |
151 * |-------------------------------------+-------------------------------------------------+------+--------+-------|
152 * | totalSupply_ | uint256 | 11 | 0 | 32 |

Callers 1

buildGenesisFunction · 0.90

Calls 7

buildImplContractAllocFunction · 0.90
buildSystemContractAllocFunction · 0.90
StorageSlotFunction · 0.90
addressToBytes32Function · 0.90
slotIndexFunction · 0.90
slotForAddressMapFunction · 0.90
parseMethod · 0.45

Tested by

no test coverage detected