@flarenetwork/flare-periphery-contract-artifacts 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/coston/artifacts/contracts/ftso/implementation/FtsoManager.sol/FtsoManager.json +2 -2
- package/coston/artifacts/contracts/governance/implementation/PollingFtso.sol/PollingFtso.json +2 -2
- package/coston/artifacts/contracts/inflation/interface/IIInflationReceiverV1.sol/IIInflationReceiverV1.json +57 -0
- package/coston/artifacts/contracts/tokenPools/implementation/FtsoRewardManager.sol/FtsoRewardManager.json +6 -19
- package/coston/artifacts/contracts/tokenPools/interface/IIFtsoRewardManager.sol/IIFtsoRewardManager.json +0 -13
- package/coston/artifacts/contracts/utils/implementation/FtsoV2Upgrader.sol/FtsoV2Upgrader.json +2 -2
- package/coston2/artifacts/contracts/claiming/implementation/ClaimSetupManager.sol/ClaimSetupManager.json +2 -2
- package/coston2/artifacts/contracts/claiming/implementation/DelegationAccount.sol/DelegationAccount.json +2 -2
- package/coston2/artifacts/contracts/ftso/implementation/Ftso.sol/Ftso.json +2 -2
- package/coston2/artifacts/contracts/ftso/implementation/FtsoManager.sol/FtsoManager.json +2 -2
- package/coston2/artifacts/contracts/ftso/lib/FtsoEpoch.sol/FtsoEpoch.json +2 -2
- package/coston2/artifacts/contracts/ftso/lib/FtsoManagement.sol/FtsoManagement.json +2 -2
- package/coston2/artifacts/contracts/ftso/lib/FtsoManagerSettings.sol/FtsoManagerSettings.json +2 -2
- package/coston2/artifacts/contracts/ftso/priceProviderMockContracts/PriceProviderMockContracts.sol/MockFtsoRegistry.json +2 -2
- package/coston2/artifacts/contracts/ftso/priceProviderMockContracts/PriceProviderMockContracts.sol/MockPriceSubmitter.json +2 -2
- package/coston2/artifacts/contracts/ftso/priceProviderMockContracts/PriceProviderMockContracts.sol/MockVoterWhitelister.json +2 -2
- package/coston2/artifacts/contracts/ftso/priceProviderMockContracts/priceProviderMockFtso.sol/MockNpmFtso.json +2 -2
- package/coston2/artifacts/contracts/governance/implementation/PollingFoundation.sol/PollingFoundation.json +2 -2
- package/coston2/artifacts/contracts/governance/implementation/PollingFtso.sol/PollingFtso.json +2 -2
- package/coston2/artifacts/contracts/staking/implementation/AddressBinder.sol/AddressBinder.json +121 -0
- package/coston2/artifacts/contracts/staking/implementation/PChainStake.sol/PChainStake.json +512 -0
- package/coston2/artifacts/contracts/staking/implementation/PChainStakeMirror.sol/PChainStakeMirror.json +1299 -0
- package/coston2/artifacts/contracts/staking/implementation/PChainStakeMirrorMultiSigVoting.sol/PChainStakeMirrorMultiSigVoting.json +579 -0
- package/coston2/artifacts/contracts/staking/implementation/PChainStakeMirrorVerifier.sol/PChainStakeMirrorVerifier.json +168 -0
- package/coston2/artifacts/contracts/staking/interface/IIPChainStakeMirrorVerifier.sol/IIPChainStakeMirrorVerifier.json +72 -0
- package/coston2/artifacts/contracts/staking/lib/PChainStakeHistory.sol/PChainStakeHistory.json +24 -0
- package/coston2/artifacts/contracts/token/implementation/CombinedNat.sol/CombinedNat.json +128 -0
- package/coston2/artifacts/contracts/token/implementation/GovernanceVotePower.sol/GovernanceVotePower.json +20 -2
- package/coston2/artifacts/contracts/token/implementation/VPContract.sol/VPContract.json +2 -2
- package/coston2/artifacts/contracts/token/implementation/VPToken.sol/VPToken.json +2 -2
- package/coston2/artifacts/contracts/token/implementation/WNat.sol/WNat.json +2 -2
- package/coston2/artifacts/contracts/token/{lib → interface}/IICombinedNatBalance.sol/IICombinedNatBalance.json +33 -1
- package/coston2/artifacts/contracts/token/interface/IIGovernanceVotePower.sol/IIGovernanceVotePower.json +14 -1
- package/coston2/artifacts/contracts/tokenPools/implementation/AttestationProviderRewardManager.sol/AttestationProviderRewardManager.json +2 -2
- package/coston2/artifacts/contracts/tokenPools/implementation/DistributionToDelegators.sol/DistributionToDelegators.json +2 -2
- package/coston2/artifacts/contracts/tokenPools/implementation/Escrow.sol/Escrow.json +2 -2
- package/coston2/artifacts/contracts/tokenPools/implementation/FtsoRewardManager.sol/FtsoRewardManager.json +2 -2
- package/coston2/artifacts/contracts/tokenPools/implementation/ValidatorRewardManager.sol/ValidatorRewardManager.json +2 -2
- package/coston2/artifacts/contracts/userInterfaces/IAddressBinder.sol/IAddressBinder.json +121 -0
- package/coston2/artifacts/contracts/userInterfaces/IGovernanceVotePower.sol/IGovernanceVotePower.json +1 -1
- package/coston2/artifacts/contracts/userInterfaces/IPChainStakeMirror.sol/IPChainStakeMirror.json +575 -0
- package/coston2/artifacts/contracts/userInterfaces/IPChainStakeMirrorMultiSigVoting.sol/IPChainStakeMirrorMultiSigVoting.json +311 -0
- package/coston2/artifacts/contracts/userInterfaces/IPChainStakeMirrorVerifier.sol/IPChainStakeMirrorVerifier.json +10 -0
- package/coston2/artifacts/contracts/userInterfaces/IPChainVotePower.sol/IPChainVotePower.json +309 -0
- package/coston2/artifacts/contracts/utils/implementation/BytesLib.sol/BytesLib.json +10 -0
- package/coston2/artifacts/contracts/utils/implementation/FtsoRegistry.sol/FtsoRegistry.json +2 -2
- package/coston2/artifacts/contracts/utils/implementation/FtsoV2Upgrader.sol/FtsoV2Upgrader.json +2 -2
- package/coston2/artifacts/contracts/utils/implementation/VoterWhitelister.sol/VoterWhitelister.json +2 -2
- package/coston2/deploys/contracts.json +23 -3
- package/dist/coston/StateConnector/libs/ts/AttestationDefinitionStore.d.ts +68 -0
- package/dist/coston/StateConnector/libs/ts/AttestationDefinitionStore.d.ts.map +1 -0
- package/dist/coston/StateConnector/libs/ts/AttestationDefinitionStore.js +164 -0
- package/dist/coston/StateConnector/libs/ts/AttestationDefinitionStore.js.map +1 -0
- package/dist/coston/StateConnector/libs/ts/AttestationResponse.d.ts +33 -0
- package/dist/coston/StateConnector/libs/ts/AttestationResponse.d.ts.map +1 -0
- package/dist/coston/StateConnector/libs/ts/AttestationResponse.js +30 -0
- package/dist/coston/StateConnector/libs/ts/AttestationResponse.js.map +1 -0
- package/dist/coston/StateConnector/libs/ts/MerkleTree.d.ts +103 -0
- package/dist/coston/StateConnector/libs/ts/MerkleTree.d.ts.map +1 -0
- package/dist/coston/StateConnector/libs/ts/MerkleTree.js +212 -0
- package/dist/coston/StateConnector/libs/ts/MerkleTree.js.map +1 -0
- package/dist/coston/StateConnector/libs/ts/config-types.d.ts +143 -0
- package/dist/coston/StateConnector/libs/ts/config-types.d.ts.map +1 -0
- package/dist/coston/StateConnector/libs/ts/config-types.js +3 -0
- package/dist/coston/StateConnector/libs/ts/config-types.js.map +1 -0
- package/dist/coston/StateConnector/libs/ts/interfaces.d.ts +32 -0
- package/dist/coston/StateConnector/libs/ts/interfaces.d.ts.map +1 -0
- package/dist/coston/StateConnector/libs/ts/interfaces.js +3 -0
- package/dist/coston/StateConnector/libs/ts/interfaces.js.map +1 -0
- package/dist/coston/StateConnector/libs/ts/random.d.ts +9 -0
- package/dist/coston/StateConnector/libs/ts/random.d.ts.map +1 -0
- package/dist/coston/StateConnector/libs/ts/random.js +70 -0
- package/dist/coston/StateConnector/libs/ts/random.js.map +1 -0
- package/dist/coston/StateConnector/libs/ts/utils.d.ts +73 -0
- package/dist/coston/StateConnector/libs/ts/utils.d.ts.map +1 -0
- package/dist/coston/StateConnector/libs/ts/utils.js +282 -0
- package/dist/coston/StateConnector/libs/ts/utils.js.map +1 -0
- package/dist/coston/StateConnector/typescript/AddressValidity.d.ts +91 -0
- package/dist/coston/StateConnector/typescript/AddressValidity.d.ts.map +1 -0
- package/dist/coston/StateConnector/typescript/AddressValidity.js +9 -0
- package/dist/coston/StateConnector/typescript/AddressValidity.js.map +1 -0
- package/dist/coston/StateConnector/typescript/BalanceDecreasingTransaction.d.ts +107 -0
- package/dist/coston/StateConnector/typescript/BalanceDecreasingTransaction.d.ts.map +1 -0
- package/dist/coston/StateConnector/typescript/BalanceDecreasingTransaction.js +9 -0
- package/dist/coston/StateConnector/typescript/BalanceDecreasingTransaction.js.map +1 -0
- package/dist/coston/StateConnector/typescript/ConfirmedBlockHeightExists.d.ts +103 -0
- package/dist/coston/StateConnector/typescript/ConfirmedBlockHeightExists.d.ts.map +1 -0
- package/dist/coston/StateConnector/typescript/ConfirmedBlockHeightExists.js +9 -0
- package/dist/coston/StateConnector/typescript/ConfirmedBlockHeightExists.js.map +1 -0
- package/dist/coston/StateConnector/typescript/EVMTransaction.d.ts +160 -0
- package/dist/coston/StateConnector/typescript/EVMTransaction.d.ts.map +1 -0
- package/dist/coston/StateConnector/typescript/EVMTransaction.js +9 -0
- package/dist/coston/StateConnector/typescript/EVMTransaction.js.map +1 -0
- package/dist/coston/StateConnector/typescript/Payment.d.ts +139 -0
- package/dist/coston/StateConnector/typescript/Payment.d.ts.map +1 -0
- package/dist/coston/StateConnector/typescript/Payment.js +9 -0
- package/dist/coston/StateConnector/typescript/Payment.js.map +1 -0
- package/dist/coston/StateConnector/typescript/ReferencedPaymentNonexistence.d.ts +115 -0
- package/dist/coston/StateConnector/typescript/ReferencedPaymentNonexistence.d.ts.map +1 -0
- package/dist/coston/StateConnector/typescript/ReferencedPaymentNonexistence.js +9 -0
- package/dist/coston/StateConnector/typescript/ReferencedPaymentNonexistence.js.map +1 -0
- package/dist/coston/StateConnector/typescript/TypeTemplate.d.ts +146 -0
- package/dist/coston/StateConnector/typescript/TypeTemplate.d.ts.map +1 -0
- package/dist/coston/StateConnector/typescript/TypeTemplate.js +9 -0
- package/dist/coston/StateConnector/typescript/TypeTemplate.js.map +1 -0
- package/dist/coston/StateConnector/typescript/data-sources/data-sources.d.ts +29 -0
- package/dist/coston/StateConnector/typescript/data-sources/data-sources.d.ts.map +1 -0
- package/dist/coston/StateConnector/typescript/data-sources/data-sources.js +33 -0
- package/dist/coston/StateConnector/typescript/data-sources/data-sources.js.map +1 -0
- package/dist/coston/StateConnector/typescript/index.d.ts +9 -0
- package/dist/coston/StateConnector/typescript/index.d.ts.map +1 -0
- package/dist/coston/StateConnector/typescript/index.js +25 -0
- package/dist/coston/StateConnector/typescript/index.js.map +1 -0
- package/dist/coston/abis.d.ts.map +1 -1
- package/dist/coston/abis.js +2 -0
- package/dist/coston/abis.js.map +1 -1
- package/dist/coston/artifacts/contracts/ftso/implementation/FtsoManager.sol/FtsoManager.json +2 -2
- package/dist/coston/artifacts/contracts/governance/implementation/PollingFtso.sol/PollingFtso.json +2 -2
- package/dist/coston/artifacts/contracts/inflation/interface/IIInflationReceiverV1.sol/IIInflationReceiverV1.json +57 -0
- package/dist/coston/artifacts/contracts/tokenPools/implementation/FtsoRewardManager.sol/FtsoRewardManager.json +6 -19
- package/dist/coston/artifacts/contracts/tokenPools/interface/IIFtsoRewardManager.sol/IIFtsoRewardManager.json +0 -13
- package/dist/coston/artifacts/contracts/utils/implementation/FtsoV2Upgrader.sol/FtsoV2Upgrader.json +2 -2
- package/dist/coston/deploys/mapper.js.map +1 -1
- package/dist/coston2/abis.d.ts.map +1 -1
- package/dist/coston2/abis.js +20 -2
- package/dist/coston2/abis.js.map +1 -1
- package/dist/coston2/artifacts/contracts/claiming/implementation/ClaimSetupManager.sol/ClaimSetupManager.json +2 -2
- package/dist/coston2/artifacts/contracts/claiming/implementation/DelegationAccount.sol/DelegationAccount.json +2 -2
- package/dist/coston2/artifacts/contracts/ftso/implementation/Ftso.sol/Ftso.json +2 -2
- package/dist/coston2/artifacts/contracts/ftso/implementation/FtsoManager.sol/FtsoManager.json +2 -2
- package/dist/coston2/artifacts/contracts/ftso/lib/FtsoEpoch.sol/FtsoEpoch.json +2 -2
- package/dist/coston2/artifacts/contracts/ftso/lib/FtsoManagement.sol/FtsoManagement.json +2 -2
- package/dist/coston2/artifacts/contracts/ftso/lib/FtsoManagerSettings.sol/FtsoManagerSettings.json +2 -2
- package/dist/coston2/artifacts/contracts/ftso/priceProviderMockContracts/PriceProviderMockContracts.sol/MockFtsoRegistry.json +2 -2
- package/dist/coston2/artifacts/contracts/ftso/priceProviderMockContracts/PriceProviderMockContracts.sol/MockPriceSubmitter.json +2 -2
- package/dist/coston2/artifacts/contracts/ftso/priceProviderMockContracts/PriceProviderMockContracts.sol/MockVoterWhitelister.json +2 -2
- package/dist/coston2/artifacts/contracts/ftso/priceProviderMockContracts/priceProviderMockFtso.sol/MockNpmFtso.json +2 -2
- package/dist/coston2/artifacts/contracts/governance/implementation/PollingFoundation.sol/PollingFoundation.json +2 -2
- package/dist/coston2/artifacts/contracts/governance/implementation/PollingFtso.sol/PollingFtso.json +2 -2
- package/dist/coston2/artifacts/contracts/staking/implementation/AddressBinder.sol/AddressBinder.json +121 -0
- package/dist/coston2/artifacts/contracts/staking/implementation/PChainStake.sol/PChainStake.json +512 -0
- package/dist/coston2/artifacts/contracts/staking/implementation/PChainStakeMirror.sol/PChainStakeMirror.json +1299 -0
- package/dist/coston2/artifacts/contracts/staking/implementation/PChainStakeMirrorMultiSigVoting.sol/PChainStakeMirrorMultiSigVoting.json +579 -0
- package/dist/coston2/artifacts/contracts/staking/implementation/PChainStakeMirrorVerifier.sol/PChainStakeMirrorVerifier.json +168 -0
- package/dist/coston2/artifacts/contracts/staking/interface/IIPChainStakeMirrorVerifier.sol/IIPChainStakeMirrorVerifier.json +72 -0
- package/dist/coston2/artifacts/contracts/staking/lib/PChainStakeHistory.sol/PChainStakeHistory.json +24 -0
- package/dist/coston2/artifacts/contracts/token/implementation/CombinedNat.sol/CombinedNat.json +128 -0
- package/dist/coston2/artifacts/contracts/token/implementation/GovernanceVotePower.sol/GovernanceVotePower.json +20 -2
- package/dist/coston2/artifacts/contracts/token/implementation/VPContract.sol/VPContract.json +2 -2
- package/dist/coston2/artifacts/contracts/token/implementation/VPToken.sol/VPToken.json +2 -2
- package/dist/coston2/artifacts/contracts/token/implementation/WNat.sol/WNat.json +2 -2
- package/dist/coston2/artifacts/contracts/token/{lib → interface}/IICombinedNatBalance.sol/IICombinedNatBalance.json +33 -1
- package/dist/coston2/artifacts/contracts/token/interface/IIGovernanceVotePower.sol/IIGovernanceVotePower.json +14 -1
- package/dist/coston2/artifacts/contracts/tokenPools/implementation/AttestationProviderRewardManager.sol/AttestationProviderRewardManager.json +2 -2
- package/dist/coston2/artifacts/contracts/tokenPools/implementation/DistributionToDelegators.sol/DistributionToDelegators.json +2 -2
- package/dist/coston2/artifacts/contracts/tokenPools/implementation/Escrow.sol/Escrow.json +2 -2
- package/dist/coston2/artifacts/contracts/tokenPools/implementation/FtsoRewardManager.sol/FtsoRewardManager.json +2 -2
- package/dist/coston2/artifacts/contracts/tokenPools/implementation/ValidatorRewardManager.sol/ValidatorRewardManager.json +2 -2
- package/dist/coston2/artifacts/contracts/utils/implementation/BytesLib.sol/BytesLib.json +10 -0
- package/dist/coston2/artifacts/contracts/utils/implementation/FtsoRegistry.sol/FtsoRegistry.json +2 -2
- package/dist/coston2/artifacts/contracts/utils/implementation/FtsoV2Upgrader.sol/FtsoV2Upgrader.json +2 -2
- package/dist/coston2/artifacts/contracts/utils/implementation/VoterWhitelister.sol/VoterWhitelister.json +2 -2
- package/dist/coston2/deploys/addresses.d.ts +4 -0
- package/dist/coston2/deploys/addresses.d.ts.map +1 -1
- package/dist/coston2/deploys/addresses.js +6 -2
- package/dist/coston2/deploys/addresses.js.map +1 -1
- package/dist/coston2/deploys/contracts.json +23 -3
- package/dist/coston2/deploys/mapper.js.map +1 -1
- package/dist/flare/abis.d.ts.map +1 -1
- package/dist/flare/abis.js +20 -2
- package/dist/flare/abis.js.map +1 -1
- package/dist/flare/artifacts/contracts/claiming/implementation/ClaimSetupManager.sol/ClaimSetupManager.json +2 -2
- package/dist/flare/artifacts/contracts/claiming/implementation/DelegationAccount.sol/DelegationAccount.json +2 -2
- package/dist/flare/artifacts/contracts/ftso/implementation/Ftso.sol/Ftso.json +2 -2
- package/dist/flare/artifacts/contracts/ftso/implementation/FtsoManager.sol/FtsoManager.json +2 -2
- package/dist/flare/artifacts/contracts/ftso/lib/FtsoEpoch.sol/FtsoEpoch.json +2 -2
- package/dist/flare/artifacts/contracts/ftso/lib/FtsoManagement.sol/FtsoManagement.json +2 -2
- package/dist/flare/artifacts/contracts/ftso/lib/FtsoManagerSettings.sol/FtsoManagerSettings.json +2 -2
- package/dist/flare/artifacts/contracts/ftso/priceProviderMockContracts/PriceProviderMockContracts.sol/MockFtsoRegistry.json +2 -2
- package/dist/flare/artifacts/contracts/ftso/priceProviderMockContracts/PriceProviderMockContracts.sol/MockPriceSubmitter.json +2 -2
- package/dist/flare/artifacts/contracts/ftso/priceProviderMockContracts/PriceProviderMockContracts.sol/MockVoterWhitelister.json +2 -2
- package/dist/flare/artifacts/contracts/ftso/priceProviderMockContracts/priceProviderMockFtso.sol/MockNpmFtso.json +2 -2
- package/dist/flare/artifacts/contracts/governance/implementation/PollingFoundation.sol/PollingFoundation.json +2 -2
- package/dist/flare/artifacts/contracts/governance/implementation/PollingFtso.sol/PollingFtso.json +2 -2
- package/dist/flare/artifacts/contracts/staking/implementation/AddressBinder.sol/AddressBinder.json +121 -0
- package/dist/flare/artifacts/contracts/staking/implementation/PChainStake.sol/PChainStake.json +512 -0
- package/dist/flare/artifacts/contracts/staking/implementation/PChainStakeMirror.sol/PChainStakeMirror.json +1299 -0
- package/dist/flare/artifacts/contracts/staking/implementation/PChainStakeMirrorMultiSigVoting.sol/PChainStakeMirrorMultiSigVoting.json +579 -0
- package/dist/flare/artifacts/contracts/staking/implementation/PChainStakeMirrorVerifier.sol/PChainStakeMirrorVerifier.json +168 -0
- package/dist/flare/artifacts/contracts/staking/interface/IIPChainStakeMirrorVerifier.sol/IIPChainStakeMirrorVerifier.json +72 -0
- package/dist/flare/artifacts/contracts/staking/lib/PChainStakeHistory.sol/PChainStakeHistory.json +24 -0
- package/dist/flare/artifacts/contracts/token/implementation/CombinedNat.sol/CombinedNat.json +128 -0
- package/dist/flare/artifacts/contracts/token/implementation/GovernanceVotePower.sol/GovernanceVotePower.json +20 -2
- package/dist/flare/artifacts/contracts/token/implementation/VPContract.sol/VPContract.json +2 -2
- package/dist/flare/artifacts/contracts/token/implementation/VPToken.sol/VPToken.json +2 -2
- package/dist/flare/artifacts/contracts/token/implementation/WNat.sol/WNat.json +2 -2
- package/dist/flare/artifacts/contracts/token/{lib → interface}/IICombinedNatBalance.sol/IICombinedNatBalance.json +33 -1
- package/dist/flare/artifacts/contracts/token/interface/IIGovernanceVotePower.sol/IIGovernanceVotePower.json +14 -1
- package/dist/flare/artifacts/contracts/tokenPools/implementation/AttestationProviderRewardManager.sol/AttestationProviderRewardManager.json +2 -2
- package/dist/flare/artifacts/contracts/tokenPools/implementation/DistributionToDelegators.sol/DistributionToDelegators.json +2 -2
- package/dist/flare/artifacts/contracts/tokenPools/implementation/Escrow.sol/Escrow.json +2 -2
- package/dist/flare/artifacts/contracts/tokenPools/implementation/FtsoRewardManager.sol/FtsoRewardManager.json +2 -2
- package/dist/flare/artifacts/contracts/tokenPools/implementation/ValidatorRewardManager.sol/ValidatorRewardManager.json +2 -2
- package/dist/flare/artifacts/contracts/utils/implementation/BytesLib.sol/BytesLib.json +10 -0
- package/dist/flare/artifacts/contracts/utils/implementation/FtsoRegistry.sol/FtsoRegistry.json +2 -2
- package/dist/flare/artifacts/contracts/utils/implementation/FtsoV2Upgrader.sol/FtsoV2Upgrader.json +2 -2
- package/dist/flare/artifacts/contracts/utils/implementation/VoterWhitelister.sol/VoterWhitelister.json +2 -2
- package/dist/flare/deploys/addresses.d.ts +4 -0
- package/dist/flare/deploys/addresses.d.ts.map +1 -1
- package/dist/flare/deploys/addresses.js +6 -2
- package/dist/flare/deploys/addresses.js.map +1 -1
- package/dist/flare/deploys/contracts.json +23 -3
- package/dist/flare/deploys/mapper.js.map +1 -1
- package/dist/songbird/abis.d.ts.map +1 -1
- package/dist/songbird/abis.js +20 -14
- package/dist/songbird/abis.js.map +1 -1
- package/dist/songbird/artifacts/contracts/claiming/implementation/ClaimSetupManager.sol/ClaimSetupManager.json +2 -2
- package/dist/songbird/artifacts/contracts/ftso/implementation/FtsoManager.sol/FtsoManager.json +2 -2
- package/dist/songbird/artifacts/contracts/governance/implementation/PollingFoundation.sol/PollingFoundation.json +2 -2
- package/dist/songbird/artifacts/contracts/governance/implementation/PollingFtso.sol/PollingFtso.json +2 -2
- package/dist/songbird/artifacts/contracts/inflation/implementation/Inflation.sol/Inflation.json +273 -298
- package/dist/songbird/artifacts/contracts/inflation/implementation/InflationAllocation.sol/InflationAllocation.json +463 -0
- package/dist/songbird/artifacts/contracts/inflation/implementation/SelfDestructBurner.sol/SelfDestructBurner.json +73 -0
- package/dist/songbird/artifacts/contracts/inflation/implementation/Supply.sol/Supply.json +290 -51
- package/dist/songbird/artifacts/contracts/inflation/interface/{IIInflationSharingPercentageProvider.sol/IIInflationSharingPercentageProvider.json → IIInflationAllocation.sol/IIInflationAllocation.json} +15 -2
- package/dist/songbird/artifacts/contracts/inflation/interface/IIInflationReceiver.sol/IIInflationReceiver.json +26 -0
- package/dist/songbird/artifacts/contracts/inflation/interface/IIInflationReceiverV1.sol/IIInflationReceiverV1.json +57 -0
- package/dist/songbird/artifacts/contracts/inflation/interface/IIInflationV1.sol/IIInflationV1.json +142 -0
- package/dist/songbird/artifacts/contracts/inflation/interface/IIPreInflationCalculation.sol/IIPreInflationCalculation.json +18 -0
- package/dist/songbird/artifacts/contracts/inflation/interface/IISupply.sol/IISupply.json +6 -12
- package/dist/songbird/artifacts/contracts/inflation/lib/{RewardServices.sol/RewardServices.json → InflationRewardServices.sol/InflationRewardServices.json} +25 -6
- package/dist/songbird/artifacts/contracts/inflation/lib/InflationTimeSlots.sol/InflationTimeSlots.json +10 -0
- package/dist/songbird/artifacts/contracts/tokenPools/implementation/FtsoRewardManager.sol/FtsoRewardManager.json +2 -2
- package/dist/songbird/artifacts/contracts/tokenPools/implementation/InflationReceiver.sol/InflationReceiver.json +127 -0
- package/dist/songbird/artifacts/contracts/tokenPools/implementation/TokenPoolBase.sol/TokenPoolBase.json +10 -0
- package/dist/songbird/artifacts/contracts/tokenPools/interface/IIFtsoRewardManager.sol/IIFtsoRewardManager.json +13 -0
- package/dist/songbird/artifacts/contracts/utils/implementation/FtsoV2Upgrader.sol/FtsoV2Upgrader.json +2 -2
- package/dist/songbird/deploys/addresses.js +3 -3
- package/dist/songbird/deploys/contracts.json +3 -3
- package/dist/songbird/deploys/mapper.js.map +1 -1
- package/flare/artifacts/contracts/claiming/implementation/ClaimSetupManager.sol/ClaimSetupManager.json +2 -2
- package/flare/artifacts/contracts/claiming/implementation/DelegationAccount.sol/DelegationAccount.json +2 -2
- package/flare/artifacts/contracts/ftso/implementation/Ftso.sol/Ftso.json +2 -2
- package/flare/artifacts/contracts/ftso/implementation/FtsoManager.sol/FtsoManager.json +2 -2
- package/flare/artifacts/contracts/ftso/lib/FtsoEpoch.sol/FtsoEpoch.json +2 -2
- package/flare/artifacts/contracts/ftso/lib/FtsoManagement.sol/FtsoManagement.json +2 -2
- package/flare/artifacts/contracts/ftso/lib/FtsoManagerSettings.sol/FtsoManagerSettings.json +2 -2
- package/flare/artifacts/contracts/ftso/priceProviderMockContracts/PriceProviderMockContracts.sol/MockFtsoRegistry.json +2 -2
- package/flare/artifacts/contracts/ftso/priceProviderMockContracts/PriceProviderMockContracts.sol/MockPriceSubmitter.json +2 -2
- package/flare/artifacts/contracts/ftso/priceProviderMockContracts/PriceProviderMockContracts.sol/MockVoterWhitelister.json +2 -2
- package/flare/artifacts/contracts/ftso/priceProviderMockContracts/priceProviderMockFtso.sol/MockNpmFtso.json +2 -2
- package/flare/artifacts/contracts/governance/implementation/PollingFoundation.sol/PollingFoundation.json +2 -2
- package/flare/artifacts/contracts/governance/implementation/PollingFtso.sol/PollingFtso.json +2 -2
- package/flare/artifacts/contracts/staking/implementation/AddressBinder.sol/AddressBinder.json +121 -0
- package/flare/artifacts/contracts/staking/implementation/PChainStake.sol/PChainStake.json +512 -0
- package/flare/artifacts/contracts/staking/implementation/PChainStakeMirror.sol/PChainStakeMirror.json +1299 -0
- package/flare/artifacts/contracts/staking/implementation/PChainStakeMirrorMultiSigVoting.sol/PChainStakeMirrorMultiSigVoting.json +579 -0
- package/flare/artifacts/contracts/staking/implementation/PChainStakeMirrorVerifier.sol/PChainStakeMirrorVerifier.json +168 -0
- package/flare/artifacts/contracts/staking/interface/IIPChainStakeMirrorVerifier.sol/IIPChainStakeMirrorVerifier.json +72 -0
- package/flare/artifacts/contracts/staking/lib/PChainStakeHistory.sol/PChainStakeHistory.json +24 -0
- package/flare/artifacts/contracts/token/implementation/CombinedNat.sol/CombinedNat.json +128 -0
- package/flare/artifacts/contracts/token/implementation/GovernanceVotePower.sol/GovernanceVotePower.json +20 -2
- package/flare/artifacts/contracts/token/implementation/VPContract.sol/VPContract.json +2 -2
- package/flare/artifacts/contracts/token/implementation/VPToken.sol/VPToken.json +2 -2
- package/flare/artifacts/contracts/token/implementation/WNat.sol/WNat.json +2 -2
- package/flare/artifacts/contracts/token/{lib → interface}/IICombinedNatBalance.sol/IICombinedNatBalance.json +33 -1
- package/flare/artifacts/contracts/token/interface/IIGovernanceVotePower.sol/IIGovernanceVotePower.json +14 -1
- package/flare/artifacts/contracts/tokenPools/implementation/AttestationProviderRewardManager.sol/AttestationProviderRewardManager.json +2 -2
- package/flare/artifacts/contracts/tokenPools/implementation/DistributionToDelegators.sol/DistributionToDelegators.json +2 -2
- package/flare/artifacts/contracts/tokenPools/implementation/Escrow.sol/Escrow.json +2 -2
- package/flare/artifacts/contracts/tokenPools/implementation/FtsoRewardManager.sol/FtsoRewardManager.json +2 -2
- package/flare/artifacts/contracts/tokenPools/implementation/ValidatorRewardManager.sol/ValidatorRewardManager.json +2 -2
- package/flare/artifacts/contracts/userInterfaces/IAddressBinder.sol/IAddressBinder.json +121 -0
- package/flare/artifacts/contracts/userInterfaces/IGovernanceVotePower.sol/IGovernanceVotePower.json +1 -1
- package/flare/artifacts/contracts/userInterfaces/IPChainStakeMirror.sol/IPChainStakeMirror.json +575 -0
- package/flare/artifacts/contracts/userInterfaces/IPChainStakeMirrorMultiSigVoting.sol/IPChainStakeMirrorMultiSigVoting.json +311 -0
- package/flare/artifacts/contracts/userInterfaces/IPChainStakeMirrorVerifier.sol/IPChainStakeMirrorVerifier.json +10 -0
- package/flare/artifacts/contracts/userInterfaces/IPChainVotePower.sol/IPChainVotePower.json +309 -0
- package/flare/artifacts/contracts/utils/implementation/BytesLib.sol/BytesLib.json +10 -0
- package/flare/artifacts/contracts/utils/implementation/FtsoRegistry.sol/FtsoRegistry.json +2 -2
- package/flare/artifacts/contracts/utils/implementation/FtsoV2Upgrader.sol/FtsoV2Upgrader.json +2 -2
- package/flare/artifacts/contracts/utils/implementation/VoterWhitelister.sol/VoterWhitelister.json +2 -2
- package/flare/deploys/contracts.json +23 -3
- package/package.json +3 -2
- package/songbird/artifacts/contracts/claiming/implementation/ClaimSetupManager.sol/ClaimSetupManager.json +2 -2
- package/songbird/artifacts/contracts/ftso/implementation/FtsoManager.sol/FtsoManager.json +2 -2
- package/songbird/artifacts/contracts/governance/implementation/PollingFoundation.sol/PollingFoundation.json +2 -2
- package/songbird/artifacts/contracts/governance/implementation/PollingFtso.sol/PollingFtso.json +2 -2
- package/songbird/artifacts/contracts/inflation/implementation/Inflation.sol/Inflation.json +273 -298
- package/songbird/artifacts/contracts/inflation/implementation/InflationAllocation.sol/InflationAllocation.json +463 -0
- package/songbird/artifacts/contracts/inflation/implementation/SelfDestructBurner.sol/SelfDestructBurner.json +73 -0
- package/songbird/artifacts/contracts/inflation/implementation/Supply.sol/Supply.json +290 -51
- package/songbird/artifacts/contracts/inflation/interface/{IIInflationSharingPercentageProvider.sol/IIInflationSharingPercentageProvider.json → IIInflationAllocation.sol/IIInflationAllocation.json} +15 -2
- package/songbird/artifacts/contracts/inflation/interface/IIInflationReceiver.sol/IIInflationReceiver.json +26 -0
- package/songbird/artifacts/contracts/inflation/interface/IIInflationReceiverV1.sol/IIInflationReceiverV1.json +57 -0
- package/songbird/artifacts/contracts/inflation/interface/IIInflationV1.sol/IIInflationV1.json +142 -0
- package/songbird/artifacts/contracts/inflation/interface/IIPreInflationCalculation.sol/IIPreInflationCalculation.json +18 -0
- package/songbird/artifacts/contracts/inflation/interface/IISupply.sol/IISupply.json +6 -12
- package/songbird/artifacts/contracts/inflation/lib/{RewardServices.sol/RewardServices.json → InflationRewardServices.sol/InflationRewardServices.json} +25 -6
- package/songbird/artifacts/contracts/inflation/lib/InflationTimeSlots.sol/InflationTimeSlots.json +10 -0
- package/songbird/artifacts/contracts/tokenPools/implementation/FtsoRewardManager.sol/FtsoRewardManager.json +2 -2
- package/songbird/artifacts/contracts/tokenPools/implementation/InflationReceiver.sol/InflationReceiver.json +127 -0
- package/songbird/artifacts/contracts/tokenPools/implementation/TokenPoolBase.sol/TokenPoolBase.json +10 -0
- package/songbird/artifacts/contracts/tokenPools/interface/IIFtsoRewardManager.sol/IIFtsoRewardManager.json +13 -0
- package/songbird/artifacts/contracts/userInterfaces/IGenericRewardManager.sol/IGenericRewardManager.json +248 -0
- package/songbird/artifacts/contracts/utils/implementation/FtsoV2Upgrader.sol/FtsoV2Upgrader.json +2 -2
- package/songbird/deploys/contracts.json +3 -3
- package/dist/songbird/artifacts/contracts/governance/implementation/InflationAllocation.sol/InflationAllocation.json +0 -351
- package/dist/songbird/artifacts/contracts/inflation/interface/IIInflationPercentageProvider.sol/IIInflationPercentageProvider.json +0 -24
- package/dist/songbird/artifacts/contracts/inflation/lib/InflationAnnum.sol/InflationAnnum.json +0 -10
- package/dist/songbird/artifacts/contracts/inflation/lib/InflationAnnums.sol/InflationAnnums.json +0 -10
- package/dist/songbird/artifacts/contracts/inflation/lib/RewardService.sol/RewardService.json +0 -30
- package/songbird/artifacts/contracts/governance/implementation/InflationAllocation.sol/InflationAllocation.json +0 -351
- package/songbird/artifacts/contracts/inflation/interface/IIInflationPercentageProvider.sol/IIInflationPercentageProvider.json +0 -24
- package/songbird/artifacts/contracts/inflation/lib/InflationAnnum.sol/InflationAnnum.json +0 -10
- package/songbird/artifacts/contracts/inflation/lib/InflationAnnums.sol/InflationAnnums.json +0 -10
- package/songbird/artifacts/contracts/inflation/lib/RewardService.sol/RewardService.json +0 -30
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttestationResponse.d.ts","sourceRoot":"","sources":["../../../../../coston/StateConnector/libs/ts/AttestationResponse.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,yBAAyB;IACjC;;OAEG;IACH,KAAK,UAAU;IACf;;OAEG;IACH,OAAO,YAAY;IACnB;;OAEG;IACH,aAAa,kBAAkB;CAClC;AACD;;;;GAIG;AAEH,qBAAa,mBAAmB,CAAC,GAAG;IAChC;;OAEG;IACH,MAAM,EAAG,yBAAyB,CAAC;IACnC;;OAEG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC;CAClB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AttestationResponse = exports.AttestationResponseStatus = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Attestation status
|
|
6
|
+
*/
|
|
7
|
+
var AttestationResponseStatus;
|
|
8
|
+
(function (AttestationResponseStatus) {
|
|
9
|
+
/**
|
|
10
|
+
* Attestation request is valid.
|
|
11
|
+
*/
|
|
12
|
+
AttestationResponseStatus["VALID"] = "VALID";
|
|
13
|
+
/**
|
|
14
|
+
* Attestation request is invalid.
|
|
15
|
+
*/
|
|
16
|
+
AttestationResponseStatus["INVALID"] = "INVALID";
|
|
17
|
+
/**
|
|
18
|
+
* Attestation request cannot be confirmed neither rejected by the verifier at the moment.
|
|
19
|
+
*/
|
|
20
|
+
AttestationResponseStatus["INDETERMINATE"] = "INDETERMINATE";
|
|
21
|
+
})(AttestationResponseStatus || (exports.AttestationResponseStatus = AttestationResponseStatus = {}));
|
|
22
|
+
/**
|
|
23
|
+
* Object returned as a result of attestation.
|
|
24
|
+
* If status is 'VALID' then parameters @param response contains attestation response.
|
|
25
|
+
* Otherwise, @param response is undefined.
|
|
26
|
+
*/
|
|
27
|
+
class AttestationResponse {
|
|
28
|
+
}
|
|
29
|
+
exports.AttestationResponse = AttestationResponse;
|
|
30
|
+
//# sourceMappingURL=AttestationResponse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttestationResponse.js","sourceRoot":"","sources":["../../../../../coston/StateConnector/libs/ts/AttestationResponse.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,yBAaX;AAbD,WAAY,yBAAyB;IACjC;;OAEG;IACH,4CAAe,CAAA;IACf;;OAEG;IACH,gDAAmB,CAAA;IACnB;;OAEG;IACH,4DAA+B,CAAA;AACnC,CAAC,EAbW,yBAAyB,yCAAzB,yBAAyB,QAapC;AACD;;;;GAIG;AAEH,MAAa,mBAAmB;CAS/B;AATD,kDASC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* There are several variants for hashing sequences in Merkle trees in cases when there is odd number of hashes on some level.
|
|
3
|
+
* - Bitcoin hashes remaining hash with itself
|
|
4
|
+
* - Ethereum community was considering this:
|
|
5
|
+
* https://github.com/proofchains/python-proofmarshal/blob/efe9b58921b9a306f2b3552c30b84e1043ab866f/proofmarshal/mmr.py#L96
|
|
6
|
+
* - This review shows various options and in particular it describes the "Monero way", which gives balanced trees but they
|
|
7
|
+
* had some issues with bugs
|
|
8
|
+
* https://medium.com/coinmonks/merkle-trees-concepts-and-use-cases-5da873702318
|
|
9
|
+
*
|
|
10
|
+
* The current implementation is a derivation and simplification of "Monero" way. It uses ideas
|
|
11
|
+
* from binary heaps represented in array. This significantly simplifies the construction both of a Merkle tree and a proof.
|
|
12
|
+
*
|
|
13
|
+
* Important formulas for a left-aligned full tree represented in an array for n hashes as leafs
|
|
14
|
+
* - array has exactly 2*n - 1 nodes (n leafs other internal)
|
|
15
|
+
* - array[0] is merkle root, array[n-1, ..., 2*n - 2] contains leaf hashes in order
|
|
16
|
+
* - given tree array of length l = 2*n - 1, then n = floor((l + 1)/2) --- be careful with 1 element
|
|
17
|
+
* - parent(i) = Math.floor((i - 1) / 2);
|
|
18
|
+
* - left(i) = 2*i + 1
|
|
19
|
+
* - right(i) = 2*i + 2
|
|
20
|
+
*
|
|
21
|
+
* Importants: all input strings should represent bytes32, hence should be 32-byte padded hex strings.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Single value hash function. Uses keccak function compatible with the one used in Solidity
|
|
25
|
+
* It is supposed to be used with `0x`-prefixed 32-byte strings as hex values
|
|
26
|
+
* @param val input hash in form of the string `0x` prefixed.
|
|
27
|
+
* @returns hash of the input value
|
|
28
|
+
*/
|
|
29
|
+
export declare function singleHash(val: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Helper function for constructing the commit hash used with StateConnector.sol contract
|
|
32
|
+
* @param merkleRoot merkle root (`0x`-prefixed 32-byte hex string)
|
|
33
|
+
* @param randomNumber secure random number (`0x`-prefixed 32-byte hex string)
|
|
34
|
+
* @param address addres (`0x`-prefixed 20-byte hex string)
|
|
35
|
+
* @returns `0x`-prefixed 32-byte hex string (hash)
|
|
36
|
+
*/
|
|
37
|
+
export declare function commitHash(merkleRoot: string, randomNumber: string, address: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* A sorted hash of two 32-byte strings
|
|
40
|
+
* @param x first `0x`-prefixed 32-byte hex string
|
|
41
|
+
* @param y second `0x`-prefixed 32-byte hex string
|
|
42
|
+
* @returns the sorted hash
|
|
43
|
+
*/
|
|
44
|
+
export declare function sortedHashPair(x: string, y: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Merkle tree implementation with all the helper function for constructing the tree and extracting the root and proofs for every leaf.
|
|
47
|
+
*/
|
|
48
|
+
export declare class MerkleTree {
|
|
49
|
+
_tree: string[];
|
|
50
|
+
constructor(values: string[]);
|
|
51
|
+
/**
|
|
52
|
+
* Merkle root
|
|
53
|
+
*/
|
|
54
|
+
get root(): string | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* The array representing full tree (length is `2*hashCount - 1`)
|
|
57
|
+
*/
|
|
58
|
+
get tree(): string[];
|
|
59
|
+
/**
|
|
60
|
+
* Number of leaves in the Merkle tree
|
|
61
|
+
*/
|
|
62
|
+
get hashCount(): number;
|
|
63
|
+
/**
|
|
64
|
+
* Returns leaves in array of the length `hashCount` sorted as `0x`-prefixed 32-byte hex strings.
|
|
65
|
+
*/
|
|
66
|
+
get sortedHashes(): string[];
|
|
67
|
+
/**
|
|
68
|
+
* Parent index of the node at index `i` in array
|
|
69
|
+
* @param i index of a node in the Merkle tree
|
|
70
|
+
* @returns parent index
|
|
71
|
+
*/
|
|
72
|
+
parent(i: number): number;
|
|
73
|
+
/**
|
|
74
|
+
* Given an array of leave hashes (`0x`-prefixed 32-byte hex strings) it builds the Merkle tree.
|
|
75
|
+
* @param values
|
|
76
|
+
*/
|
|
77
|
+
private build;
|
|
78
|
+
/**
|
|
79
|
+
* Returns the hash of the `i`-th leaf (index determined by sorting and positioning in the build)
|
|
80
|
+
* @param i
|
|
81
|
+
* @returns
|
|
82
|
+
*/
|
|
83
|
+
getHash(i: number): string | undefined;
|
|
84
|
+
/** Binary search
|
|
85
|
+
* Famously prone to subtle bugs, so over-documented with proof
|
|
86
|
+
*/
|
|
87
|
+
private binarySearch;
|
|
88
|
+
/**
|
|
89
|
+
* Extracts the Merkle proof for the given hash, if it is in the tree
|
|
90
|
+
* @param hashOrIndex the hash whose proof to return
|
|
91
|
+
* @returns the Merkle proof - a list of `0x`-prefixed 32-byte hex strings
|
|
92
|
+
*/
|
|
93
|
+
getProof(hashOrIndex: string | number): string[] | undefined;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Verifies a Merkle proof for a given leaf
|
|
97
|
+
* @param leaf leaf as (`0x`-prefixed 32-byte hex string)
|
|
98
|
+
* @param proof Merkle proof (a list of `0x`-prefixed 32-byte hex strings)
|
|
99
|
+
* @param root Merkle root (`0x`-prefixed 32-byte hex string)
|
|
100
|
+
* @returns `true` if the proof is valid, `false` otherwise
|
|
101
|
+
*/
|
|
102
|
+
export declare function verifyWithMerkleProof(leaf: string, proof: string[], root: string): boolean;
|
|
103
|
+
//# sourceMappingURL=MerkleTree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MerkleTree.d.ts","sourceRoot":"","sources":["../../../../../coston/StateConnector/libs/ts/MerkleTree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAMH;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,UAErC;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE5F;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAKlD;AAED;;GAEG;AACH,qBAAa,UAAU;IACnB,KAAK,EAAE,MAAM,EAAE,CAAM;gBAET,MAAM,EAAE,MAAM,EAAE;IAI5B;;OAEG;IACH,IAAW,IAAI,uBAEd;IAED;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,EAAE,CAE1B;IAED;;OAEG;IACH,IAAW,SAAS,WAEnB;IAED;;OAEG;IACH,IAAW,YAAY,aAEtB;IAED;;;;OAIG;IACI,MAAM,CAAC,CAAC,EAAE,MAAM;IAIvB;;;OAGG;IACH,OAAO,CAAC,KAAK;IAsBb;;;;OAIG;IACI,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAQ7C;;OAEG;IACH,OAAO,CAAC,YAAY;IAepB;;;;OAIG;IACI,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS;CA8BtE;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,WAOhF"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* There are several variants for hashing sequences in Merkle trees in cases when there is odd number of hashes on some level.
|
|
4
|
+
* - Bitcoin hashes remaining hash with itself
|
|
5
|
+
* - Ethereum community was considering this:
|
|
6
|
+
* https://github.com/proofchains/python-proofmarshal/blob/efe9b58921b9a306f2b3552c30b84e1043ab866f/proofmarshal/mmr.py#L96
|
|
7
|
+
* - This review shows various options and in particular it describes the "Monero way", which gives balanced trees but they
|
|
8
|
+
* had some issues with bugs
|
|
9
|
+
* https://medium.com/coinmonks/merkle-trees-concepts-and-use-cases-5da873702318
|
|
10
|
+
*
|
|
11
|
+
* The current implementation is a derivation and simplification of "Monero" way. It uses ideas
|
|
12
|
+
* from binary heaps represented in array. This significantly simplifies the construction both of a Merkle tree and a proof.
|
|
13
|
+
*
|
|
14
|
+
* Important formulas for a left-aligned full tree represented in an array for n hashes as leafs
|
|
15
|
+
* - array has exactly 2*n - 1 nodes (n leafs other internal)
|
|
16
|
+
* - array[0] is merkle root, array[n-1, ..., 2*n - 2] contains leaf hashes in order
|
|
17
|
+
* - given tree array of length l = 2*n - 1, then n = floor((l + 1)/2) --- be careful with 1 element
|
|
18
|
+
* - parent(i) = Math.floor((i - 1) / 2);
|
|
19
|
+
* - left(i) = 2*i + 1
|
|
20
|
+
* - right(i) = 2*i + 2
|
|
21
|
+
*
|
|
22
|
+
* Importants: all input strings should represent bytes32, hence should be 32-byte padded hex strings.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.verifyWithMerkleProof = exports.MerkleTree = exports.sortedHashPair = exports.commitHash = exports.singleHash = void 0;
|
|
26
|
+
const ethers_1 = require("ethers");
|
|
27
|
+
const coder = ethers_1.ethers.AbiCoder.defaultAbiCoder();
|
|
28
|
+
/**
|
|
29
|
+
* Single value hash function. Uses keccak function compatible with the one used in Solidity
|
|
30
|
+
* It is supposed to be used with `0x`-prefixed 32-byte strings as hex values
|
|
31
|
+
* @param val input hash in form of the string `0x` prefixed.
|
|
32
|
+
* @returns hash of the input value
|
|
33
|
+
*/
|
|
34
|
+
function singleHash(val) {
|
|
35
|
+
return ethers_1.ethers.keccak256(val);
|
|
36
|
+
}
|
|
37
|
+
exports.singleHash = singleHash;
|
|
38
|
+
/**
|
|
39
|
+
* Helper function for constructing the commit hash used with StateConnector.sol contract
|
|
40
|
+
* @param merkleRoot merkle root (`0x`-prefixed 32-byte hex string)
|
|
41
|
+
* @param randomNumber secure random number (`0x`-prefixed 32-byte hex string)
|
|
42
|
+
* @param address addres (`0x`-prefixed 20-byte hex string)
|
|
43
|
+
* @returns `0x`-prefixed 32-byte hex string (hash)
|
|
44
|
+
*/
|
|
45
|
+
function commitHash(merkleRoot, randomNumber, address) {
|
|
46
|
+
return ethers_1.ethers.keccak256(coder.encode(["bytes32", "bytes32", "address"], [merkleRoot, randomNumber, address]));
|
|
47
|
+
}
|
|
48
|
+
exports.commitHash = commitHash;
|
|
49
|
+
/**
|
|
50
|
+
* A sorted hash of two 32-byte strings
|
|
51
|
+
* @param x first `0x`-prefixed 32-byte hex string
|
|
52
|
+
* @param y second `0x`-prefixed 32-byte hex string
|
|
53
|
+
* @returns the sorted hash
|
|
54
|
+
*/
|
|
55
|
+
function sortedHashPair(x, y) {
|
|
56
|
+
if (x <= y) {
|
|
57
|
+
return ethers_1.ethers.keccak256(coder.encode(["bytes32", "bytes32"], [x, y]));
|
|
58
|
+
}
|
|
59
|
+
return ethers_1.ethers.keccak256(coder.encode(["bytes32", "bytes32"], [y, x]));
|
|
60
|
+
}
|
|
61
|
+
exports.sortedHashPair = sortedHashPair;
|
|
62
|
+
/**
|
|
63
|
+
* Merkle tree implementation with all the helper function for constructing the tree and extracting the root and proofs for every leaf.
|
|
64
|
+
*/
|
|
65
|
+
class MerkleTree {
|
|
66
|
+
constructor(values) {
|
|
67
|
+
this._tree = [];
|
|
68
|
+
this.build(values);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Merkle root
|
|
72
|
+
*/
|
|
73
|
+
get root() {
|
|
74
|
+
return this._tree.length === 0 ? undefined : this._tree[0];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The array representing full tree (length is `2*hashCount - 1`)
|
|
78
|
+
*/
|
|
79
|
+
get tree() {
|
|
80
|
+
return [...this._tree];
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Number of leaves in the Merkle tree
|
|
84
|
+
*/
|
|
85
|
+
get hashCount() {
|
|
86
|
+
return this._tree.length ? (this._tree.length + 1) / 2 : 0;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Returns leaves in array of the length `hashCount` sorted as `0x`-prefixed 32-byte hex strings.
|
|
90
|
+
*/
|
|
91
|
+
get sortedHashes() {
|
|
92
|
+
return this._tree.slice(this.hashCount - 1);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Parent index of the node at index `i` in array
|
|
96
|
+
* @param i index of a node in the Merkle tree
|
|
97
|
+
* @returns parent index
|
|
98
|
+
*/
|
|
99
|
+
parent(i) {
|
|
100
|
+
return Math.floor((i - 1) / 2);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Given an array of leave hashes (`0x`-prefixed 32-byte hex strings) it builds the Merkle tree.
|
|
104
|
+
* @param values
|
|
105
|
+
*/
|
|
106
|
+
build(values) {
|
|
107
|
+
values.forEach((x) => {
|
|
108
|
+
if (!/^0x[0-9a-f]{64}$/i.test(x)) {
|
|
109
|
+
throw new Error(`Invalid hash '${x}'`);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
const sorted = values.map((x) => x);
|
|
113
|
+
sorted.sort();
|
|
114
|
+
const hashes = [];
|
|
115
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
116
|
+
if (i == 0 || sorted[i] !== sorted[i - 1]) {
|
|
117
|
+
hashes.push(sorted[i]);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
const n = hashes.length;
|
|
121
|
+
this._tree = [...new Array(Math.max(n - 1, 0)).fill(0), ...hashes];
|
|
122
|
+
for (let i = n - 2; i >= 0; i--) {
|
|
123
|
+
this._tree[i] = sortedHashPair(this._tree[2 * i + 1], this._tree[2 * i + 2]);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Returns the hash of the `i`-th leaf (index determined by sorting and positioning in the build)
|
|
128
|
+
* @param i
|
|
129
|
+
* @returns
|
|
130
|
+
*/
|
|
131
|
+
getHash(i) {
|
|
132
|
+
if (this.hashCount === 0 || i < 0 || i >= this.hashCount) {
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
const pos = this._tree.length - this.hashCount + i;
|
|
136
|
+
return this._tree[pos];
|
|
137
|
+
}
|
|
138
|
+
/** Binary search
|
|
139
|
+
* Famously prone to subtle bugs, so over-documented with proof
|
|
140
|
+
*/
|
|
141
|
+
binarySearch(hash) {
|
|
142
|
+
let [low, high] = [0, this.hashCount];
|
|
143
|
+
let count = high;
|
|
144
|
+
if (count == 0)
|
|
145
|
+
return undefined;
|
|
146
|
+
while (count > 1) {
|
|
147
|
+
// Invariants: low < high, 2 <= count == high - low == [low .. high].length
|
|
148
|
+
const mid = low + Math.floor(count / 2); // low < mid < high _strictly_
|
|
149
|
+
hash < this.sortedHashes[mid] ? (high = mid) : (low = mid); // low < high still
|
|
150
|
+
count = high - low; // preserves invariant
|
|
151
|
+
}
|
|
152
|
+
const i = low; // Only element left: count == 1, since 0 != count <= 1
|
|
153
|
+
if (hash != this.sortedHashes[i])
|
|
154
|
+
return undefined;
|
|
155
|
+
return i;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Extracts the Merkle proof for the given hash, if it is in the tree
|
|
159
|
+
* @param hashOrIndex the hash whose proof to return
|
|
160
|
+
* @returns the Merkle proof - a list of `0x`-prefixed 32-byte hex strings
|
|
161
|
+
*/
|
|
162
|
+
getProof(hashOrIndex) {
|
|
163
|
+
if (this.hashCount === 0) {
|
|
164
|
+
return undefined;
|
|
165
|
+
}
|
|
166
|
+
if (hashOrIndex === undefined)
|
|
167
|
+
return undefined;
|
|
168
|
+
let i;
|
|
169
|
+
if (typeof hashOrIndex === "number") {
|
|
170
|
+
i = hashOrIndex;
|
|
171
|
+
}
|
|
172
|
+
else if (typeof hashOrIndex === "string") {
|
|
173
|
+
if (/^0x[0-9a-f]{64}$/i.test(hashOrIndex)) {
|
|
174
|
+
i = this.binarySearch(hashOrIndex);
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
return undefined;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (i === undefined)
|
|
181
|
+
return undefined;
|
|
182
|
+
if (i < 0 || i >= this.hashCount) {
|
|
183
|
+
return undefined;
|
|
184
|
+
}
|
|
185
|
+
const proof = [];
|
|
186
|
+
let pos = this._tree.length - this.hashCount + i;
|
|
187
|
+
while (pos > 0) {
|
|
188
|
+
proof.push(this._tree[pos + 2 * (pos % 2) - 1]);
|
|
189
|
+
pos = this.parent(pos);
|
|
190
|
+
}
|
|
191
|
+
return proof;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
exports.MerkleTree = MerkleTree;
|
|
195
|
+
/**
|
|
196
|
+
* Verifies a Merkle proof for a given leaf
|
|
197
|
+
* @param leaf leaf as (`0x`-prefixed 32-byte hex string)
|
|
198
|
+
* @param proof Merkle proof (a list of `0x`-prefixed 32-byte hex strings)
|
|
199
|
+
* @param root Merkle root (`0x`-prefixed 32-byte hex string)
|
|
200
|
+
* @returns `true` if the proof is valid, `false` otherwise
|
|
201
|
+
*/
|
|
202
|
+
function verifyWithMerkleProof(leaf, proof, root) {
|
|
203
|
+
if (!leaf || !proof || !root)
|
|
204
|
+
return false;
|
|
205
|
+
let hash = leaf;
|
|
206
|
+
for (const pair of proof) {
|
|
207
|
+
hash = sortedHashPair(pair, hash);
|
|
208
|
+
}
|
|
209
|
+
return hash == root;
|
|
210
|
+
}
|
|
211
|
+
exports.verifyWithMerkleProof = verifyWithMerkleProof;
|
|
212
|
+
//# sourceMapping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,CAAC;YACrB,CAAC;QACL,CAAC;QACD,IAAI,CAAC,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QACtC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YAC/B,OAAO,SAAS,CAAC;QACrB,CAAC;QAED,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACjD,OAAO,GAAG,GAAG,CAAC,EAAE,CAAC;YACb,KAAK,CAAC,IAAI,CACN,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CACtC,CAAC;YACF,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AAxID,gCAwIC;AAED;;;;;;GAMG;AACH,SAAgB,qBAAqB,CAAC,IAAY,EAAE,KAAe,EAAE,IAAY;IAC7E,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IAC3C,IAAI,IAAI,GAAG,IAAI,CAAC;IAChB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,IAAI,GAAG,cAAc,CAAC,IAAI,EAAE,IAAI,CAAE,CAAC;IACvC,CAAC;IACD,OAAO,IAAI,IAAI,IAAI,CAAC;AACxB,CAAC;AAPD,sDAOC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ABI definition fields for request, response and proof of an attestation type.
|
|
3
|
+
*/
|
|
4
|
+
export interface ABIDefinitions {
|
|
5
|
+
/**
|
|
6
|
+
* JSON ABI definition for attestation type request
|
|
7
|
+
*/
|
|
8
|
+
requestAbi: any;
|
|
9
|
+
/**
|
|
10
|
+
* JSON ABI definition for attestation type response
|
|
11
|
+
*/
|
|
12
|
+
responseAbi: any;
|
|
13
|
+
/**
|
|
14
|
+
* JSON ABI definition for attestation type proof
|
|
15
|
+
*/
|
|
16
|
+
proofAbi: any;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Metadata for basic and ABI configs for an attestation type.
|
|
20
|
+
*/
|
|
21
|
+
export interface TypeRecord extends ABIDefinitions {
|
|
22
|
+
/**
|
|
23
|
+
* Attestation type name. Must be unique and in PascalCase (also known as UpperCamelCase, hence CamelCase with the first letter capitalized).
|
|
24
|
+
*/
|
|
25
|
+
name: string;
|
|
26
|
+
/**
|
|
27
|
+
* Full comment for the attestation type as provided in the Solidity definition.
|
|
28
|
+
*/
|
|
29
|
+
fullComment: string;
|
|
30
|
+
/**
|
|
31
|
+
* Description of the attestation type. Used also in the generated documentation.
|
|
32
|
+
*/
|
|
33
|
+
description: string;
|
|
34
|
+
/**
|
|
35
|
+
* Comma separated list of supported sources for the attestation type. The strings defining types are community defined.
|
|
36
|
+
* Currently, the following are supported: BTC, DOGE, XRP, ETH
|
|
37
|
+
*/
|
|
38
|
+
supported: string[];
|
|
39
|
+
/**
|
|
40
|
+
* Text describing the attestation type verification rules. In Markdown format.
|
|
41
|
+
*/
|
|
42
|
+
verification: string;
|
|
43
|
+
/**
|
|
44
|
+
* The description of how lowest used timestamp is obtained from the attestation response.
|
|
45
|
+
* Usually a field name.
|
|
46
|
+
*/
|
|
47
|
+
lut: string;
|
|
48
|
+
/**
|
|
49
|
+
* Metadata about the struct describing attestation request.
|
|
50
|
+
*/
|
|
51
|
+
request: StructRecord;
|
|
52
|
+
/**
|
|
53
|
+
* Metadata about the struct describing attestation response.
|
|
54
|
+
*/
|
|
55
|
+
response: StructRecord;
|
|
56
|
+
/**
|
|
57
|
+
* Metadata about the struct describing attestation proof.
|
|
58
|
+
*/
|
|
59
|
+
proof: StructRecord;
|
|
60
|
+
/**
|
|
61
|
+
* Metadata about the struct describing attestation request body.
|
|
62
|
+
*/
|
|
63
|
+
requestBody: StructRecord;
|
|
64
|
+
/**
|
|
65
|
+
* Metadata about the struct describing attestation response body.
|
|
66
|
+
*/
|
|
67
|
+
responseBody: StructRecord;
|
|
68
|
+
/**
|
|
69
|
+
* List of metadata objects describing structs used in attestation request.
|
|
70
|
+
*/
|
|
71
|
+
requestStructs: StructRecord[];
|
|
72
|
+
/**
|
|
73
|
+
* List of metadata objects describing structs used in attestation response.
|
|
74
|
+
*/
|
|
75
|
+
responseStructs: StructRecord[];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Metadata for a struct parameter from a Solidity definition of attestation types.
|
|
79
|
+
*/
|
|
80
|
+
export interface ParamRecord {
|
|
81
|
+
/**
|
|
82
|
+
* Field name.
|
|
83
|
+
*/
|
|
84
|
+
name: string;
|
|
85
|
+
/**
|
|
86
|
+
* Field type as defined in Solidity.
|
|
87
|
+
*/
|
|
88
|
+
type: string;
|
|
89
|
+
/**
|
|
90
|
+
* Short field type (omitting position prefixes for structs)
|
|
91
|
+
*/
|
|
92
|
+
typeSimple?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Field description. Possibly multiline.
|
|
95
|
+
*/
|
|
96
|
+
comment: string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Metadata for a struct from a Solidity definition of attestation types.
|
|
100
|
+
*/
|
|
101
|
+
export interface StructRecord {
|
|
102
|
+
/**
|
|
103
|
+
* Struct name.
|
|
104
|
+
*/
|
|
105
|
+
name: string;
|
|
106
|
+
/**
|
|
107
|
+
* Full comment for the struct as provided in the Solidity definition.
|
|
108
|
+
*/
|
|
109
|
+
fullComment: string;
|
|
110
|
+
/**
|
|
111
|
+
* Struct description. Possibly multiline, can use Markdown.
|
|
112
|
+
*/
|
|
113
|
+
description: string;
|
|
114
|
+
/**
|
|
115
|
+
* Additional markdown text to be used above the struct fields description in documentation.
|
|
116
|
+
*/
|
|
117
|
+
above?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Additional markdown text to be used below the struct fields description in documentation.
|
|
120
|
+
*/
|
|
121
|
+
below?: string;
|
|
122
|
+
/**
|
|
123
|
+
* List of metadata objects describing struct fields.
|
|
124
|
+
*/
|
|
125
|
+
params: ParamRecord[];
|
|
126
|
+
}
|
|
127
|
+
export interface DataSource {
|
|
128
|
+
name: string;
|
|
129
|
+
description: string;
|
|
130
|
+
}
|
|
131
|
+
export interface Protocol {
|
|
132
|
+
name: string;
|
|
133
|
+
description: string;
|
|
134
|
+
}
|
|
135
|
+
export interface AttestationTypeProtocolSupport {
|
|
136
|
+
attestationType: string;
|
|
137
|
+
supportedDataSources: string[];
|
|
138
|
+
}
|
|
139
|
+
export interface ProtocolSupport {
|
|
140
|
+
protocol: string;
|
|
141
|
+
supported: AttestationTypeProtocolSupport[];
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=config-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-types.d.ts","sourceRoot":"","sources":["../../../../../coston/StateConnector/libs/ts/config-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B;;OAEG;IACH,UAAU,EAAE,GAAG,CAAC;IAChB;;OAEG;IACH,WAAW,EAAE,GAAG,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,GAAG,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,cAAc;IAC9C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,OAAO,EAAE,YAAY,CAAC;IACtB;;OAEG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sources":["../../../../../coston/StateConnector/libs/ts/config-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic interface for the request of an attestation request.
|
|
3
|
+
*/
|
|
4
|
+
export interface ARBase {
|
|
5
|
+
attestationType: string;
|
|
6
|
+
sourceId: string;
|
|
7
|
+
messageIntegrityCode?: string;
|
|
8
|
+
requestBody: any;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Generic interface for the response of an attestation request.
|
|
12
|
+
*/
|
|
13
|
+
export interface ARESBase {
|
|
14
|
+
attestationType: string;
|
|
15
|
+
sourceId: string;
|
|
16
|
+
votingRound: string;
|
|
17
|
+
lowestUsedTimestamp: string;
|
|
18
|
+
requestBody: any;
|
|
19
|
+
responseBody: any;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Generic interface for example data usually randomly generated for testing purposes and examples.
|
|
23
|
+
*/
|
|
24
|
+
export interface ExampleData<RNM, REQ, RES> {
|
|
25
|
+
requestNoMic: RNM;
|
|
26
|
+
request: REQ;
|
|
27
|
+
response: RES;
|
|
28
|
+
messageIntegrityCode: string;
|
|
29
|
+
encodedRequestZeroMic: string;
|
|
30
|
+
encodedRequest: string;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../../coston/StateConnector/libs/ts/interfaces.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,MAAM;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,WAAW,EAAE,GAAG,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,WAAW,EAAE,GAAG,CAAC;IACjB,YAAY,EAAE,GAAG,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG;IACtC,YAAY,EAAE,GAAG,CAAC;IAClB,OAAO,EAAE,GAAG,CAAC;IACb,QAAQ,EAAE,GAAG,CAAC;IACd,oBAAoB,EAAE,MAAM,CAAC;IAC7B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,cAAc,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../coston/StateConnector/libs/ts/interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function seededRandHex(n: number, seed?: string): string;
|
|
2
|
+
/**
|
|
3
|
+
* Helper random value generator for Solidity type values used in in randomized attestation requests or responses.
|
|
4
|
+
* Primarily used for testing
|
|
5
|
+
* @param typeName solidity type (e.g. uint256)
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export declare function randSol(typeName: string, seed?: string): string | boolean;
|
|
9
|
+
//# sourceMappingURL=random.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../../../../../coston/StateConnector/libs/ts/random.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,SAAM,UAElD;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,SAAM,GAAG,MAAM,GAAG,OAAO,CAyDtE"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.randSol = exports.seededRandHex = void 0;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
function seededRandHex(n, seed = "0") {
|
|
6
|
+
return ethers_1.ethers.keccak256(ethers_1.ethers.toUtf8Bytes(seed)).slice(0, 2 + 2 * n);
|
|
7
|
+
}
|
|
8
|
+
exports.seededRandHex = seededRandHex;
|
|
9
|
+
/**
|
|
10
|
+
* Helper random value generator for Solidity type values used in in randomized attestation requests or responses.
|
|
11
|
+
* Primarily used for testing
|
|
12
|
+
* @param typeName solidity type (e.g. uint256)
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
function randSol(typeName, seed = "0") {
|
|
16
|
+
let match = typeName.match(/^.+(\[(\d*)\])$/);
|
|
17
|
+
if (match) {
|
|
18
|
+
const brackets = match[1];
|
|
19
|
+
const value = parseInt(match[2]);
|
|
20
|
+
const typeOfArray = typeName.slice(0, -brackets.length);
|
|
21
|
+
if (!isNaN(value) || value === 0) {
|
|
22
|
+
return ("[" +
|
|
23
|
+
Array(value)
|
|
24
|
+
.fill(0)
|
|
25
|
+
.map(() => randSol(typeOfArray, seed))
|
|
26
|
+
.join(", ") +
|
|
27
|
+
"]");
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
const length = 3; // fixed length
|
|
31
|
+
return ("[" +
|
|
32
|
+
Array(length)
|
|
33
|
+
.fill(0)
|
|
34
|
+
.map(() => randSol(typeOfArray, seed))
|
|
35
|
+
.join(", ") +
|
|
36
|
+
"]");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
match = typeName.match(/^uint(\d+)$/);
|
|
40
|
+
if (match) {
|
|
41
|
+
return BigInt(seededRandHex(parseInt(match[1]) / 8, seed)).toString();
|
|
42
|
+
}
|
|
43
|
+
match = typeName.match(/^int(\d+)$/);
|
|
44
|
+
if (match) {
|
|
45
|
+
const val = seededRandHex(parseInt(match[1]) / 8, seed);
|
|
46
|
+
return BigInt("0x0" + val.slice(3)).toString();
|
|
47
|
+
}
|
|
48
|
+
if (typeName.match(/^bool$/)) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
match = typeName.match(/^bytes(\d+)$/);
|
|
52
|
+
if (match) {
|
|
53
|
+
return seededRandHex(parseInt(match[1]), seed);
|
|
54
|
+
}
|
|
55
|
+
if (typeName.match(/^address$/)) {
|
|
56
|
+
return seededRandHex(20, seed);
|
|
57
|
+
}
|
|
58
|
+
if (typeName.match(/^string$/)) {
|
|
59
|
+
return "Random string";
|
|
60
|
+
}
|
|
61
|
+
if (typeName.match(/^byte$/)) {
|
|
62
|
+
return seededRandHex(1, seed);
|
|
63
|
+
}
|
|
64
|
+
if (typeName.match(/^bytes$/)) {
|
|
65
|
+
return seededRandHex(30, seed);
|
|
66
|
+
}
|
|
67
|
+
throw new Error(`Unsupported type ${typeName}`);
|
|
68
|
+
}
|
|
69
|
+
exports.randSol = randSol;
|
|
70
|
+
//# sourceMappingURL=random.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"random.js","sourceRoot":"","sources":["../../../../../coston/StateConnector/libs/ts/random.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAEhC,SAAgB,aAAa,CAAC,CAAS,EAAE,IAAI,GAAG,GAAG;IAC/C,OAAO,eAAM,CAAC,SAAS,CAAC,eAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1E,CAAC;AAFD,sCAEC;AAED;;;;;GAKG;AACH,SAAgB,OAAO,CAAC,QAAgB,EAAE,IAAI,GAAG,GAAG;IAChD,IAAI,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC9C,IAAI,KAAK,EAAE,CAAC;QACR,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAC1B,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,C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