-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Gas token self deploys (#6956)
Handles genesis by having gas token deploy itself by minting tokens to itself in an entrypoint method.
- Loading branch information
1 parent
e671935
commit ecd7614
Showing
16 changed files
with
153 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
yarn-project/protocol-contracts/src/class-registerer/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import { computeContractAddressFromInstance, getContractClassFromArtifact } from '@aztec/circuits.js'; | ||
|
||
import { getCanonicalClassRegisterer, getCanonicalClassRegistererAddress } from './index.js'; | ||
import { ClassRegistererAddress, getCanonicalClassRegisterer } from './index.js'; | ||
|
||
describe('ClassRegisterer', () => { | ||
it('returns canonical protocol contract', () => { | ||
const contract = getCanonicalClassRegisterer(); | ||
expect(computeContractAddressFromInstance(contract.instance)).toEqual(contract.address); | ||
expect(getContractClassFromArtifact(contract.artifact).id).toEqual(contract.contractClass.id); | ||
expect(contract.address.toString()).toEqual(getCanonicalClassRegistererAddress().toString()); | ||
expect(contract.address.toString()).toEqual(ClassRegistererAddress.toString()); | ||
}); | ||
}); |
20 changes: 9 additions & 11 deletions
20
yarn-project/protocol-contracts/src/class-registerer/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
import { type AztecAddress } from '@aztec/circuits.js'; | ||
import { AztecAddress, REGISTERER_CONTRACT_ADDRESS } from '@aztec/circuits.js'; | ||
|
||
import { type ProtocolContract, getCanonicalProtocolContract } from '../protocol_contract.js'; | ||
import { ContractClassRegistererArtifact } from './artifact.js'; | ||
|
||
/** Returns the canonical deployment of the class registerer contract. */ | ||
export function getCanonicalClassRegisterer(): ProtocolContract { | ||
return getCanonicalProtocolContract(ContractClassRegistererArtifact, 1); | ||
} | ||
|
||
let address: AztecAddress | undefined = undefined; | ||
|
||
/** Returns the address for the canonical deployment of the class registerer */ | ||
export function getCanonicalClassRegistererAddress() { | ||
if (!address) { | ||
address = getCanonicalClassRegisterer().address; | ||
const contract = getCanonicalProtocolContract(ContractClassRegistererArtifact, 1); | ||
if (!contract.address.equals(ClassRegistererAddress)) { | ||
throw new Error( | ||
`Incorrect address for class registerer (got ${contract.address.toString()} but expected ${ClassRegistererAddress.toString()}).`, | ||
); | ||
} | ||
return address; | ||
return contract; | ||
} | ||
|
||
export const ClassRegistererAddress = AztecAddress.fromBigInt(REGISTERER_CONTRACT_ADDRESS); |
Oops, something went wrong.