polkamarkets-js 3.4.1 → 3.4.3
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/package.json +1 -1
- package/script/AddAdminToLand.s.sol +1 -1
- package/script/ClaimMerkleRoot.s.sol +29 -29
- package/script/CreateLand.s.sol +1 -1
- package/script/DeployMerkleRewardsDistributor.s.sol +21 -21
- package/script/MintTokens.s.sol +1 -1
- package/script/PublishMerkleRoot.s.sol +50 -50
- package/script/UpdateMarket.s.sol +55 -0
- package/script/copy-abis.js +57 -0
- package/src/Application.js +12 -1
- package/src/models/IContract.js +87 -1
- package/src/models/PolkamarketsSmartAccount.js +23 -0
- package/src/models/PredictionMarketV3Contract.js +49 -16
- package/abis/AccessControlUpgradeable.json +0 -1
- package/abis/AddAdminToLand.json +0 -1
- package/abis/AddressUpgradeable.json +0 -1
- package/abis/ClaimMerkleRoot.json +0 -1
- package/abis/CreateLand.json +0 -1
- package/abis/CreateMarkets.json +0 -1
- package/abis/DeployContracts.json +0 -1
- package/abis/DeployMerkleRewardsDistributor.json +0 -1
- package/abis/DeployToken.json +0 -1
- package/abis/DeployUSDT.json +0 -1
- package/abis/ECDSA.json +0 -1
- package/abis/ERC165Upgradeable.json +0 -1
- package/abis/ERC1967UpgradeUpgradeable.json +0 -1
- package/abis/Hashes.json +0 -1
- package/abis/IBeaconUpgradeable.json +0 -1
- package/abis/IERC1822ProxiableUpgradeable.json +0 -1
- package/abis/IERC20PermitUpgradeable.json +0 -1
- package/abis/IERC20Upgradeable.json +0 -1
- package/abis/Manager.json +0 -1
- package/abis/MerkleProof.json +0 -1
- package/abis/MerkleRewardsDistributor.json +0 -1
- package/abis/MerkleRewardsDistributorTest.json +0 -1
- package/abis/MessageHashUtils.json +0 -1
- package/abis/MintTokens.json +0 -1
- package/abis/Nonces.json +0 -1
- package/abis/Panic.json +0 -1
- package/abis/PublishMerkleRoot.json +0 -1
- package/abis/ResolveMarket.json +0 -1
- package/abis/RewardsDistributor.json +0 -1
- package/abis/RewardsDistributorTest.json +0 -1
- package/abis/SafeCast.json +0 -1
- package/abis/SafeERC20Upgradeable.json +0 -1
- package/abis/SignedMath.json +0 -1
- package/abis/StorageSlotUpgradeable.json +0 -1
- package/abis/TradeMarket.json +0 -1
- package/abis/USDT.json +0 -1
- package/abis/UpdateMarket.json +0 -1
- package/abis/UpdateTest.json +0 -1
- package/abis/WhaleTest.json +0 -1
- package/lib/openzeppelin-contracts/contracts/mocks/docs/ERC20WithAutoMinerReward.sol +0 -22
- package/lib/openzeppelin-contracts/contracts/mocks/docs/ERC4626Fees.sol +0 -109
- package/lib/openzeppelin-contracts/contracts/mocks/docs/MyNFT.sol +0 -9
- package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintBase.sol +0 -25
- package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintMissing.sol +0 -24
- package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintOnlyRole.sol +0 -23
- package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlModified.sol +0 -14
- package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessManagedERC20MintBase.sol +0 -16
- package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/MyContractOwnable.sol +0 -17
- package/lib/openzeppelin-contracts/contracts/mocks/docs/account/MyAccountERC7702.sol +0 -20
- package/lib/openzeppelin-contracts/contracts/mocks/docs/account/MyFactoryAccount.sol +0 -37
- package/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyGovernor.sol +0 -80
- package/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyToken.sol +0 -21
- package/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyTokenTimestampBased.sol +0 -32
- package/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyTokenWrapped.sol +0 -28
- package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC1155/GameItems.sol +0 -21
- package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC1155/MyERC115HolderContract.sol +0 -7
- package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC20/GLDToken.sol +0 -11
- package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC6909/ERC6909GameItems.sol +0 -26
- package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC721/GameItem.sol +0 -19
- package/lib/openzeppelin-contracts/contracts/mocks/docs/utilities/Base64NFT.sol +0 -27
- package/lib/openzeppelin-contracts/contracts/mocks/docs/utilities/Multicall.sol +0 -15
- package/lib/openzeppelin-contracts/docs/README.md +0 -16
- package/lib/openzeppelin-contracts/docs/antora.yml +0 -7
- package/lib/openzeppelin-contracts/docs/config.js +0 -21
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-control-multiple.svg +0 -97
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-manager-functions.svg +0 -47
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-manager.svg +0 -99
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-3a.png +0 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-3b.png +0 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-6.png +0 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack.png +0 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-deposit.png +0 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-mint.png +0 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-linear.png +0 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-loglog.png +0 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-loglogext.png +0 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-exec.png +0 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-vote.png +0 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/nav.adoc +0 -29
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/access-control.adoc +0 -288
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/account-abstraction.adoc +0 -100
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/accounts.adoc +0 -354
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/backwards-compatibility.adoc +0 -50
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/eoa-delegation.adoc +0 -143
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc1155.adoc +0 -118
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc20-supply.adoc +0 -71
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc20.adoc +0 -67
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc4626.adoc +0 -214
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc6909.adoc +0 -47
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc721.adoc +0 -58
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/extending-contracts.adoc +0 -51
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/faq.adoc +0 -13
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/governance.adoc +0 -239
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/index.adoc +0 -70
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/multisig.adoc +0 -306
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/tokens.adoc +0 -31
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/upgradeable.adoc +0 -77
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/utilities.adoc +0 -591
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/wizard.adoc +0 -15
- package/lib/openzeppelin-contracts/docs/templates/contract.hbs +0 -141
- package/lib/openzeppelin-contracts/docs/templates/helpers.js +0 -46
- package/lib/openzeppelin-contracts/docs/templates/page.hbs +0 -4
- package/lib/openzeppelin-contracts/docs/templates/properties.js +0 -88
- package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/ERC20WithAutoMinerRewardUpgradeable.sol +0 -28
- package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/ERC4626FeesUpgradeable.sol +0 -115
- package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/MyNFTUpgradeable.sol +0 -14
- package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessControlERC20MintBaseUpgradeable.sol +0 -31
- package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessControlERC20MintMissingUpgradeable.sol +0 -30
- package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessControlERC20MintOnlyRoleUpgradeable.sol +0 -29
- package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessControlModifiedUpgradeable.sol +0 -20
- package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessManagedERC20MintBaseUpgradeable.sol +0 -22
- package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/MyContractOwnableUpgradeable.sol +0 -22
- package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/account/MyAccountERC7702Upgradeable.sol +0 -26
- package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/account/MyFactoryAccountUpgradeable.sol +0 -42
- package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/governance/MyGovernorUpgradeable.sol +0 -92
- package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/governance/MyTokenTimestampBasedUpgradeable.sol +0 -39
- package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/governance/MyTokenUpgradeable.sol +0 -28
- package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/governance/MyTokenWrappedUpgradeable.sol +0 -39
- package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC1155/GameItemsUpgradeable.sol +0 -27
- package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC1155/MyERC115HolderContractUpgradeable.sol +0 -13
- package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC20/GLDTokenUpgradeable.sol +0 -17
- package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC6909/ERC6909GameItemsUpgradeable.sol +0 -31
- package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC721/GameItemUpgradeable.sol +0 -24
- package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/utilities/Base64NFTUpgradeable.sol +0 -32
- package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/utilities/MulticallUpgradeable.sol +0 -21
- package/lib/openzeppelin-contracts-upgradeable/docs/README.md +0 -16
- package/lib/openzeppelin-contracts-upgradeable/docs/antora.yml +0 -7
- package/lib/openzeppelin-contracts-upgradeable/docs/config.js +0 -21
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/access-control-multiple.svg +0 -97
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/access-manager-functions.svg +0 -47
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/access-manager.svg +0 -99
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-attack-3a.png +0 -0
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-attack-3b.png +0 -0
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-attack-6.png +0 -0
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-attack.png +0 -0
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-deposit.png +0 -0
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-mint.png +0 -0
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-rate-linear.png +0 -0
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-rate-loglog.png +0 -0
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-rate-loglogext.png +0 -0
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/tally-exec.png +0 -0
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/tally-vote.png +0 -0
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/nav.adoc +0 -29
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/access-control.adoc +0 -288
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/account-abstraction.adoc +0 -100
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/accounts.adoc +0 -354
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/backwards-compatibility.adoc +0 -50
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/eoa-delegation.adoc +0 -143
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc1155.adoc +0 -118
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc20-supply.adoc +0 -71
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc20.adoc +0 -67
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc4626.adoc +0 -214
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc6909.adoc +0 -47
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc721.adoc +0 -58
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/extending-contracts.adoc +0 -51
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/faq.adoc +0 -13
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/governance.adoc +0 -239
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/index.adoc +0 -70
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/multisig.adoc +0 -306
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/tokens.adoc +0 -31
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/upgradeable.adoc +0 -77
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/utilities.adoc +0 -591
- package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/wizard.adoc +0 -15
- package/lib/openzeppelin-contracts-upgradeable/docs/templates/contract.hbs +0 -141
- package/lib/openzeppelin-contracts-upgradeable/docs/templates/helpers.js +0 -46
- package/lib/openzeppelin-contracts-upgradeable/docs/templates/page.hbs +0 -4
- package/lib/openzeppelin-contracts-upgradeable/docs/templates/properties.js +0 -88
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/ERC20WithAutoMinerReward.sol +0 -22
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/ERC4626Fees.sol +0 -109
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/MyNFT.sol +0 -9
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintBase.sol +0 -25
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintMissing.sol +0 -24
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintOnlyRole.sol +0 -23
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlModified.sol +0 -14
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessManagedERC20MintBase.sol +0 -16
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/MyContractOwnable.sol +0 -17
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/account/MyAccountERC7702.sol +0 -20
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/account/MyFactoryAccount.sol +0 -37
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyGovernor.sol +0 -80
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyToken.sol +0 -21
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyTokenTimestampBased.sol +0 -32
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyTokenWrapped.sol +0 -28
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC1155/GameItems.sol +0 -21
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC1155/MyERC115HolderContract.sol +0 -7
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC20/GLDToken.sol +0 -11
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC6909/ERC6909GameItems.sol +0 -26
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC721/GameItem.sol +0 -19
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/utilities/Base64NFT.sol +0 -27
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/utilities/Multicall.sol +0 -15
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/README.md +0 -16
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/antora.yml +0 -7
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/config.js +0 -21
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-control-multiple.svg +0 -97
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-manager-functions.svg +0 -47
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-manager.svg +0 -99
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-3a.png +0 -0
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-3b.png +0 -0
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-6.png +0 -0
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack.png +0 -0
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-deposit.png +0 -0
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-mint.png +0 -0
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-linear.png +0 -0
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-loglog.png +0 -0
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-loglogext.png +0 -0
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-exec.png +0 -0
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-vote.png +0 -0
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/nav.adoc +0 -29
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/access-control.adoc +0 -288
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/account-abstraction.adoc +0 -100
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/accounts.adoc +0 -354
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/backwards-compatibility.adoc +0 -50
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/eoa-delegation.adoc +0 -143
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc1155.adoc +0 -118
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc20-supply.adoc +0 -71
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc20.adoc +0 -67
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc4626.adoc +0 -214
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc6909.adoc +0 -47
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc721.adoc +0 -58
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/extending-contracts.adoc +0 -51
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/faq.adoc +0 -13
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/governance.adoc +0 -239
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/index.adoc +0 -70
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/multisig.adoc +0 -306
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/tokens.adoc +0 -31
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/upgradeable.adoc +0 -77
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/utilities.adoc +0 -591
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/wizard.adoc +0 -15
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/templates/contract.hbs +0 -141
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/templates/helpers.js +0 -46
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/templates/page.hbs +0 -4
- package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/templates/properties.js +0 -88
- package/lib/openzeppelin-contracts-upgradeable.git/docs/antora.yml +0 -6
- package/lib/openzeppelin-contracts-upgradeable.git/docs/config.js +0 -21
- package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/images/tally-exec.png +0 -0
- package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/images/tally-vote.png +0 -0
- package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/nav.adoc +0 -23
- package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/access-control.adoc +0 -217
- package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/crosschain.adoc +0 -210
- package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/crowdsales.adoc +0 -11
- package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/drafts.adoc +0 -19
- package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc1155.adoc +0 -153
- package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc20-supply.adoc +0 -113
- package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc20.adoc +0 -85
- package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc721.adoc +0 -90
- package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc777.adoc +0 -73
- package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/extending-contracts.adoc +0 -129
- package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/governance.adoc +0 -321
- package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/index.adoc +0 -63
- package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/releases-stability.adoc +0 -85
- package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/tokens.adoc +0 -32
- package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/upgradeable.adoc +0 -73
- package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/utilities.adoc +0 -190
- package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/wizard.adoc +0 -15
- package/lib/openzeppelin-contracts-upgradeable.git/docs/templates/contract.hbs +0 -85
- package/lib/openzeppelin-contracts-upgradeable.git/docs/templates/helpers.js +0 -46
- package/lib/openzeppelin-contracts-upgradeable.git/docs/templates/page.hbs +0 -4
- package/lib/openzeppelin-contracts-upgradeable.git/docs/templates/properties.js +0 -49
- package/lib/openzeppelin-contracts.git/docs/antora.yml +0 -6
- package/lib/openzeppelin-contracts.git/docs/config.js +0 -21
- package/lib/openzeppelin-contracts.git/docs/modules/ROOT/images/tally-exec.png +0 -0
- package/lib/openzeppelin-contracts.git/docs/modules/ROOT/images/tally-vote.png +0 -0
- package/lib/openzeppelin-contracts.git/docs/modules/ROOT/nav.adoc +0 -23
- package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/access-control.adoc +0 -217
- package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/crosschain.adoc +0 -210
- package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/crowdsales.adoc +0 -11
- package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/drafts.adoc +0 -19
- package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc1155.adoc +0 -153
- package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc20-supply.adoc +0 -113
- package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc20.adoc +0 -85
- package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc721.adoc +0 -90
- package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc777.adoc +0 -73
- package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/extending-contracts.adoc +0 -129
- package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/governance.adoc +0 -321
- package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/index.adoc +0 -63
- package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/releases-stability.adoc +0 -85
- package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/tokens.adoc +0 -32
- package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/upgradeable.adoc +0 -73
- package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/utilities.adoc +0 -190
- package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/wizard.adoc +0 -15
- package/lib/openzeppelin-contracts.git/docs/templates/contract.hbs +0 -85
- package/lib/openzeppelin-contracts.git/docs/templates/helpers.js +0 -46
- package/lib/openzeppelin-contracts.git/docs/templates/page.hbs +0 -4
- package/lib/openzeppelin-contracts.git/docs/templates/properties.js +0 -49
- package/lib/reality-eth-monorepo/packages/docs/Audit_Reality_v3_202108.pdf +0 -0
- package/lib/reality-eth-monorepo/packages/docs/Makefile +0 -20
- package/lib/reality-eth-monorepo/packages/docs/arbitrators.rst +0 -85
- package/lib/reality-eth-monorepo/packages/docs/audit.rst +0 -12
- package/lib/reality-eth-monorepo/packages/docs/audit_v2.rst +0 -249
- package/lib/reality-eth-monorepo/packages/docs/audit_v2_ERC20.rst +0 -1075
- package/lib/reality-eth-monorepo/packages/docs/audit_v3.rst +0 -70
- package/lib/reality-eth-monorepo/packages/docs/conf.py +0 -155
- package/lib/reality-eth-monorepo/packages/docs/contract_explanation.rst +0 -82
- package/lib/reality-eth-monorepo/packages/docs/contracts.rst +0 -277
- package/lib/reality-eth-monorepo/packages/docs/dapp.rst +0 -126
- package/lib/reality-eth-monorepo/packages/docs/dapp_links.rst +0 -67
- package/lib/reality-eth-monorepo/packages/docs/fees.rst +0 -89
- package/lib/reality-eth-monorepo/packages/docs/index.rst +0 -26
- package/lib/reality-eth-monorepo/packages/docs/javascript.rst +0 -142
- package/lib/reality-eth-monorepo/packages/docs/make.bat +0 -36
- package/lib/reality-eth-monorepo/packages/docs/question_box.png +0 -0
- package/lib/reality-eth-monorepo/packages/docs/requirements.txt +0 -24
- package/lib/reality-eth-monorepo/packages/docs/whitepaper.rst +0 -165
- package/test/UpdateTest.t.sol +0 -55
- package/test/WhaleTest.t.sol +0 -188
- package/tooling/docs/jsdoc.json +0 -6
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
= Utilities
|
|
2
|
-
|
|
3
|
-
The OpenZeppelin Contracts provide a ton of useful utilities that you can use in your project. Here are some of the more popular ones.
|
|
4
|
-
|
|
5
|
-
[[cryptography]]
|
|
6
|
-
== Cryptography
|
|
7
|
-
|
|
8
|
-
=== Checking Signatures On-Chain
|
|
9
|
-
|
|
10
|
-
xref:api:utils.adoc#ECDSA[`ECDSA`] provides functions for recovering and managing Ethereum account ECDSA signatures. These are often generated via https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#sign[`web3.eth.sign`], and are a 65 byte array (of type `bytes` in Solidity) arranged the following way: `[[v (1)], [r (32)], [s (32)]]`.
|
|
11
|
-
|
|
12
|
-
The data signer can be recovered with xref:api:utils.adoc#ECDSA-recover-bytes32-bytes-[`ECDSA.recover`], and its address compared to verify the signature. Most wallets will hash the data to sign and add the prefix '\x19Ethereum Signed Message:\n', so when attempting to recover the signer of an Ethereum signed message hash, you'll want to use xref:api:utils.adoc#ECDSA-toEthSignedMessageHash-bytes32-[`toEthSignedMessageHash`].
|
|
13
|
-
|
|
14
|
-
[source,solidity]
|
|
15
|
-
----
|
|
16
|
-
using ECDSA for bytes32;
|
|
17
|
-
|
|
18
|
-
function _verify(bytes32 data, bytes memory signature, address account) internal pure returns (bool) {
|
|
19
|
-
return data
|
|
20
|
-
.toEthSignedMessageHash()
|
|
21
|
-
.recover(signature) == account;
|
|
22
|
-
}
|
|
23
|
-
----
|
|
24
|
-
|
|
25
|
-
WARNING: Getting signature verification right is not trivial: make sure you fully read and understand xref:api:utils.adoc#ECDSA[`ECDSA`]'s documentation.
|
|
26
|
-
|
|
27
|
-
=== Verifying Merkle Proofs
|
|
28
|
-
|
|
29
|
-
xref:api:utils.adoc#MerkleProof[`MerkleProof`] provides:
|
|
30
|
-
|
|
31
|
-
* xref:api:utils.adoc#MerkleProof-verify-bytes32---bytes32-bytes32-[`verify`] - can prove that some value is part of a https://en.wikipedia.org/wiki/Merkle_tree[Merkle tree].
|
|
32
|
-
|
|
33
|
-
* xref:api:utils.adoc#MerkleProof-multiProofVerify-bytes32-bytes32---bytes32---bool---[`multiProofVerify`] - can prove multiple values are part of a Merkle tree.
|
|
34
|
-
|
|
35
|
-
[[introspection]]
|
|
36
|
-
== Introspection
|
|
37
|
-
|
|
38
|
-
In Solidity, it's frequently helpful to know whether or not a contract supports an interface you'd like to use. ERC165 is a standard that helps do runtime interface detection. Contracts provide helpers both for implementing ERC165 in your contracts and querying other contracts:
|
|
39
|
-
|
|
40
|
-
* xref:api:utils.adoc#IERC165[`IERC165`] — this is the ERC165 interface that defines xref:api:utils.adoc#IERC165-supportsInterface-bytes4-[`supportsInterface`]. When implementing ERC165, you'll conform to this interface.
|
|
41
|
-
* xref:api:utils.adoc#ERC165[`ERC165`] — inherit this contract if you'd like to support interface detection using a lookup table in contract storage. You can register interfaces using xref:api:utils.adoc#ERC165-_registerInterface-bytes4-[`_registerInterface(bytes4)`]: check out example usage as part of the ERC721 implementation.
|
|
42
|
-
* xref:api:utils.adoc#ERC165Checker[`ERC165Checker`] — ERC165Checker simplifies the process of checking whether or not a contract supports an interface you care about.
|
|
43
|
-
* include with `using ERC165Checker for address;`
|
|
44
|
-
* xref:api:utils.adoc#ERC165Checker-_supportsInterface-address-bytes4-[`myAddress._supportsInterface(bytes4)`]
|
|
45
|
-
* xref:api:utils.adoc#ERC165Checker-_supportsAllInterfaces-address-bytes4---[`myAddress._supportsAllInterfaces(bytes4[\])`]
|
|
46
|
-
|
|
47
|
-
[source,solidity]
|
|
48
|
-
----
|
|
49
|
-
contract MyContract {
|
|
50
|
-
using ERC165Checker for address;
|
|
51
|
-
|
|
52
|
-
bytes4 private InterfaceId_ERC721 = 0x80ac58cd;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* @dev transfer an ERC721 token from this contract to someone else
|
|
56
|
-
*/
|
|
57
|
-
function transferERC721(
|
|
58
|
-
address token,
|
|
59
|
-
address to,
|
|
60
|
-
uint256 tokenId
|
|
61
|
-
)
|
|
62
|
-
public
|
|
63
|
-
{
|
|
64
|
-
require(token.supportsInterface(InterfaceId_ERC721), "IS_NOT_721_TOKEN");
|
|
65
|
-
IERC721(token).transferFrom(address(this), to, tokenId);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
----
|
|
69
|
-
|
|
70
|
-
[[math]]
|
|
71
|
-
== Math
|
|
72
|
-
|
|
73
|
-
The most popular math related library OpenZeppelin Contracts provides is xref:api:utils.adoc#SafeMath[`SafeMath`], which provides mathematical functions that protect your contract from overflows and underflows.
|
|
74
|
-
|
|
75
|
-
Include the contract with `using SafeMath for uint256;` and then call the functions:
|
|
76
|
-
|
|
77
|
-
* `myNumber.add(otherNumber)`
|
|
78
|
-
* `myNumber.sub(otherNumber)`
|
|
79
|
-
* `myNumber.div(otherNumber)`
|
|
80
|
-
* `myNumber.mul(otherNumber)`
|
|
81
|
-
* `myNumber.mod(otherNumber)`
|
|
82
|
-
|
|
83
|
-
Easy!
|
|
84
|
-
|
|
85
|
-
[[payment]]
|
|
86
|
-
== Payment
|
|
87
|
-
|
|
88
|
-
Want to split some payments between multiple people? Maybe you have an app that sends 30% of art purchases to the original creator and 70% of the profits to the current owner; you can build that with xref:api:finance.adoc#PaymentSplitter[`PaymentSplitter`]!
|
|
89
|
-
|
|
90
|
-
In Solidity, there are some security concerns with blindly sending money to accounts, since it allows them to execute arbitrary code. You can read up on these security concerns in the https://consensys.github.io/smart-contract-best-practices/[Ethereum Smart Contract Best Practices] website. One of the ways to fix reentrancy and stalling problems is, instead of immediately sending Ether to accounts that need it, you can use xref:api:security.adoc#PullPayment[`PullPayment`], which offers an xref:api:security.adoc#PullPayment-_asyncTransfer-address-uint256-[`_asyncTransfer`] function for sending money to something and requesting that they xref:api:security.adoc#PullPayment-withdrawPayments-address-payable-[`withdrawPayments()`] it later.
|
|
91
|
-
|
|
92
|
-
If you want to Escrow some funds, check out xref:api:utils.adoc#Escrow[`Escrow`] and xref:api:utils.adoc#ConditionalEscrow[`ConditionalEscrow`] for governing the release of some escrowed Ether.
|
|
93
|
-
|
|
94
|
-
[[collections]]
|
|
95
|
-
== Collections
|
|
96
|
-
|
|
97
|
-
If you need support for more powerful collections than Solidity's native arrays and mappings, take a look at xref:api:utils.adoc#EnumerableSet[`EnumerableSet`] and xref:api:utils.adoc#EnumerableMap[`EnumerableMap`]. They are similar to mappings in that they store and remove elements in constant time and don't allow for repeated entries, but they also support _enumeration_, which means you can easily query all stored entries both on and off-chain.
|
|
98
|
-
|
|
99
|
-
[[misc]]
|
|
100
|
-
== Misc
|
|
101
|
-
|
|
102
|
-
Want to check if an address is a contract? Use xref:api:utils.adoc#Address[`Address`] and xref:api:utils.adoc#Address-isContract-address-[`Address.isContract()`].
|
|
103
|
-
|
|
104
|
-
Want to keep track of some numbers that increment by 1 every time you want another one? Check out xref:api:utils.adoc#Counters[`Counters`]. This is useful for lots of things, like creating incremental identifiers, as shown on the xref:erc721.adoc[ERC721 guide].
|
|
105
|
-
|
|
106
|
-
=== Base64
|
|
107
|
-
|
|
108
|
-
xref:api:utils.adoc#Base64[`Base64`] util allows you to transform `bytes32` data into its Base64 `string` representation.
|
|
109
|
-
|
|
110
|
-
This is specially useful to build URL-safe tokenURIs for both xref:api:token/ERC721.adoc#IERC721Metadata-tokenURI-uint256-[`ERC721`] or xref:api:token/ERC1155.adoc#IERC1155MetadataURI-uri-uint256-[`ERC1155`]. This library provides a clever way to serve URL-safe https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs/[Data URI] compliant strings to serve on-chain data structures.
|
|
111
|
-
|
|
112
|
-
Consider this is an example to send JSON Metadata through a Base64 Data URI using an ERC721:
|
|
113
|
-
|
|
114
|
-
[source, solidity]
|
|
115
|
-
----
|
|
116
|
-
// contracts/My721Token.sol
|
|
117
|
-
// SPDX-License-Identifier: MIT
|
|
118
|
-
|
|
119
|
-
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
|
|
120
|
-
import "@openzeppelin/contracts/utils/Strings.sol";
|
|
121
|
-
import "@openzeppelin/contracts/utils/Base64.sol";
|
|
122
|
-
|
|
123
|
-
contract My721Token is ERC721 {
|
|
124
|
-
using Strings for uint256;
|
|
125
|
-
|
|
126
|
-
constructor() ERC721("My721Token", "MTK") {}
|
|
127
|
-
|
|
128
|
-
...
|
|
129
|
-
|
|
130
|
-
function tokenURI(uint256 tokenId)
|
|
131
|
-
public
|
|
132
|
-
pure
|
|
133
|
-
override
|
|
134
|
-
returns (string memory)
|
|
135
|
-
{
|
|
136
|
-
bytes memory dataURI = abi.encodePacked(
|
|
137
|
-
'{',
|
|
138
|
-
'"name": "My721Token #', tokenId.toString(), '"',
|
|
139
|
-
// Replace with extra ERC721 Metadata properties
|
|
140
|
-
'}'
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
return string(
|
|
144
|
-
abi.encodePacked(
|
|
145
|
-
"data:application/json;base64,",
|
|
146
|
-
Base64.encode(dataURI)
|
|
147
|
-
)
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
----
|
|
152
|
-
|
|
153
|
-
=== Multicall
|
|
154
|
-
|
|
155
|
-
The `Multicall` abstract contract comes with a `multicall` function that bundles together multiple calls in a single external call. With it, external accounts may perform atomic operations comprising several function calls. This is not only useful for EOAs to make multiple calls in a single transaction, it's also a way to revert a previous call if a later one fails.
|
|
156
|
-
|
|
157
|
-
Consider this dummy contract:
|
|
158
|
-
|
|
159
|
-
[source,solidity]
|
|
160
|
-
----
|
|
161
|
-
// contracts/Box.sol
|
|
162
|
-
// SPDX-License-Identifier: MIT
|
|
163
|
-
pragma solidity ^0.8.0;
|
|
164
|
-
|
|
165
|
-
import "@openzeppelin/contracts/utils/Multicall.sol";
|
|
166
|
-
|
|
167
|
-
contract Box is Multicall {
|
|
168
|
-
function foo() public {
|
|
169
|
-
...
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
function bar() public {
|
|
173
|
-
...
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
----
|
|
177
|
-
|
|
178
|
-
This is how to call the `multicall` function using Truffle, allowing `foo` and `bar` to be called in a single transaction:
|
|
179
|
-
[source,javascript]
|
|
180
|
-
----
|
|
181
|
-
// scripts/foobar.js
|
|
182
|
-
|
|
183
|
-
const Box = artifacts.require('Box');
|
|
184
|
-
const instance = await Box.new();
|
|
185
|
-
|
|
186
|
-
await instance.multicall([
|
|
187
|
-
instance.contract.methods.foo().encodeABI(),
|
|
188
|
-
instance.contract.methods.bar().encodeABI()
|
|
189
|
-
]);
|
|
190
|
-
----
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
= Contracts Wizard
|
|
2
|
-
:page-notoc:
|
|
3
|
-
|
|
4
|
-
Not sure where to start? Use the interactive generator below to bootstrap your
|
|
5
|
-
contract and learn about the components offered in OpenZeppelin Contracts.
|
|
6
|
-
|
|
7
|
-
TIP: Place the resulting contract in your `contracts` directory in order to compile it with a tool like Hardhat or Truffle. Consider reading our guide on xref:learn::developing-smart-contracts.adoc[Developing Smart Contracts] for more guidance!
|
|
8
|
-
|
|
9
|
-
++++
|
|
10
|
-
<script async src="https://wizard.openzeppelin.com/build/embed.js"></script>
|
|
11
|
-
|
|
12
|
-
<oz-wizard style="display: block; min-height: 40rem;"></oz-wizard>
|
|
13
|
-
++++
|
|
14
|
-
|
|
15
|
-
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
{{#each items}}
|
|
2
|
-
:{{name}}: pass:normal[xref:#{{anchor}}[`++{{name}}++`]]
|
|
3
|
-
{{/each}}
|
|
4
|
-
|
|
5
|
-
[.contract]
|
|
6
|
-
[[{{anchor}}]]
|
|
7
|
-
=== `++{{name}}++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v{{oz-version}}/{{__item_context.file.absolutePath}}[{github-icon},role=heading-link]
|
|
8
|
-
|
|
9
|
-
[.hljs-theme-light.nopadding]
|
|
10
|
-
```solidity
|
|
11
|
-
import "@openzeppelin/{{__item_context.file.absolutePath}}";
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
{{{natspec.dev}}}
|
|
15
|
-
|
|
16
|
-
{{#if modifiers}}
|
|
17
|
-
[.contract-index]
|
|
18
|
-
.Modifiers
|
|
19
|
-
--
|
|
20
|
-
{{#each modifiers}}
|
|
21
|
-
* {xref-{{anchor~}} }[`++{{name}}({{names params}})++`]
|
|
22
|
-
{{/each}}
|
|
23
|
-
--
|
|
24
|
-
{{/if}}
|
|
25
|
-
|
|
26
|
-
{{#if has-functions}}
|
|
27
|
-
[.contract-index]
|
|
28
|
-
.Functions
|
|
29
|
-
--
|
|
30
|
-
{{#each inherited-functions}}
|
|
31
|
-
{{#unless @first}}
|
|
32
|
-
[.contract-subindex-inherited]
|
|
33
|
-
.{{contract.name}}
|
|
34
|
-
{{/unless}}
|
|
35
|
-
{{#each functions}}
|
|
36
|
-
* {xref-{{anchor~}} }[`++{{name}}({{names params}})++`]
|
|
37
|
-
{{/each}}
|
|
38
|
-
|
|
39
|
-
{{/each}}
|
|
40
|
-
--
|
|
41
|
-
{{/if}}
|
|
42
|
-
|
|
43
|
-
{{#if has-events}}
|
|
44
|
-
[.contract-index]
|
|
45
|
-
.Events
|
|
46
|
-
--
|
|
47
|
-
{{#each inheritance}}
|
|
48
|
-
{{#unless @first}}
|
|
49
|
-
[.contract-subindex-inherited]
|
|
50
|
-
.{{name}}
|
|
51
|
-
{{/unless}}
|
|
52
|
-
{{#each events}}
|
|
53
|
-
* {xref-{{anchor~}} }[`++{{name}}({{names params}})++`]
|
|
54
|
-
{{/each}}
|
|
55
|
-
|
|
56
|
-
{{/each}}
|
|
57
|
-
--
|
|
58
|
-
{{/if}}
|
|
59
|
-
|
|
60
|
-
{{#each modifiers}}
|
|
61
|
-
[.contract-item]
|
|
62
|
-
[[{{anchor}}]]
|
|
63
|
-
==== `[.contract-item-name]#++{{name}}++#++({{typed-params params}})++` [.item-kind]#modifier#
|
|
64
|
-
|
|
65
|
-
{{{natspec.dev}}}
|
|
66
|
-
|
|
67
|
-
{{/each}}
|
|
68
|
-
|
|
69
|
-
{{#each functions}}
|
|
70
|
-
[.contract-item]
|
|
71
|
-
[[{{anchor}}]]
|
|
72
|
-
==== `[.contract-item-name]#++{{name}}++#++({{typed-params params}}){{#if returns}} → {{typed-params returns}}{{/if}}++` [.item-kind]#{{visibility}}#
|
|
73
|
-
|
|
74
|
-
{{{natspec.dev}}}
|
|
75
|
-
|
|
76
|
-
{{/each}}
|
|
77
|
-
|
|
78
|
-
{{#each events}}
|
|
79
|
-
[.contract-item]
|
|
80
|
-
[[{{anchor}}]]
|
|
81
|
-
==== `[.contract-item-name]#++{{name}}++#++({{typed-params params}})++` [.item-kind]#event#
|
|
82
|
-
|
|
83
|
-
{{{natspec.dev}}}
|
|
84
|
-
|
|
85
|
-
{{/each}}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
const { version } = require('../../package.json');
|
|
2
|
-
|
|
3
|
-
module.exports['oz-version'] = () => version;
|
|
4
|
-
|
|
5
|
-
module.exports['readme-path'] = (opts) => {
|
|
6
|
-
return 'contracts/' + opts.data.root.id.replace(/\.adoc$/, '') + '/README.adoc';
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
module.exports.names = (params) => params.map(p => p.name).join(', ');
|
|
10
|
-
|
|
11
|
-
module.exports['typed-params'] = (params) => {
|
|
12
|
-
return params?.map(p => `${p.type}${p.indexed ? ' indexed' : ''}${p.name ? ' ' + p.name : ''}`).join(', ');
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const slug = module.exports.slug = (str) => {
|
|
16
|
-
if (str === undefined) {
|
|
17
|
-
throw new Error('Missing argument');
|
|
18
|
-
}
|
|
19
|
-
return str.replace(/\W/g, '-');
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const linksCache = new WeakMap();
|
|
23
|
-
|
|
24
|
-
function getAllLinks (items) {
|
|
25
|
-
if (linksCache.has(items)) {
|
|
26
|
-
return linksCache.get(items);
|
|
27
|
-
}
|
|
28
|
-
const res = {};
|
|
29
|
-
linksCache.set(items, res);
|
|
30
|
-
for (const item of items) {
|
|
31
|
-
res[`xref-${item.anchor}`] = `xref:${item.__item_context.page}#${item.anchor}`;
|
|
32
|
-
res[slug(item.fullName)] = `pass:normal[xref:${item.__item_context.page}#${item.anchor}[\`${item.fullName}\`]]`;
|
|
33
|
-
}
|
|
34
|
-
return res;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
module.exports['with-prelude'] = (opts) => {
|
|
38
|
-
const links = getAllLinks(opts.data.site.items);
|
|
39
|
-
const contents = opts.fn();
|
|
40
|
-
const neededLinks = contents
|
|
41
|
-
.match(/\{[-._a-z0-9]+\}/ig)
|
|
42
|
-
.map(m => m.replace(/^\{(.+)\}$/, '$1'))
|
|
43
|
-
.filter(k => k in links);
|
|
44
|
-
const prelude = neededLinks.map(k => `:${k}: ${links[k]}`).join('\n');
|
|
45
|
-
return prelude + '\n' + contents;
|
|
46
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
const { isNodeType } = require('solidity-ast/utils');
|
|
2
|
-
const { slug } = require('./helpers');
|
|
3
|
-
|
|
4
|
-
module.exports.anchor = function anchor ({ item, contract }) {
|
|
5
|
-
let res = '';
|
|
6
|
-
if (contract) {
|
|
7
|
-
res += contract.name + '-';
|
|
8
|
-
}
|
|
9
|
-
res += item.name;
|
|
10
|
-
if ('parameters' in item) {
|
|
11
|
-
const signature = item.parameters.parameters.map(v => v.typeName.typeDescriptions.typeString).join(',');
|
|
12
|
-
res += slug('(' + signature + ')');
|
|
13
|
-
}
|
|
14
|
-
if (isNodeType('VariableDeclaration', item)) {
|
|
15
|
-
res += '-' + slug(item.typeName.typeDescriptions.typeString);
|
|
16
|
-
}
|
|
17
|
-
return res;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
module.exports.inheritance = function ({ item, build }) {
|
|
21
|
-
if (!isNodeType('ContractDefinition', item)) {
|
|
22
|
-
throw new Error('used inherited-items on non-contract');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return item.linearizedBaseContracts
|
|
26
|
-
.map(id => build.deref('ContractDefinition', id))
|
|
27
|
-
.filter((c, i) => c.name !== 'Context' || i === 0);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
module.exports['has-functions'] = function ({ item }) {
|
|
31
|
-
return item.inheritance.some(c => c.functions.length > 0);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
module.exports['has-events'] = function ({ item }) {
|
|
35
|
-
return item.inheritance.some(c => c.events.length > 0);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
module.exports['inherited-functions'] = function ({ item }) {
|
|
39
|
-
const { inheritance } = item;
|
|
40
|
-
const baseFunctions = new Set(
|
|
41
|
-
inheritance.flatMap(c => c.functions.flatMap(f => f.baseFunctions ?? [])),
|
|
42
|
-
);
|
|
43
|
-
return inheritance.map((contract, i) => ({
|
|
44
|
-
contract,
|
|
45
|
-
functions: contract.functions.filter(f =>
|
|
46
|
-
!baseFunctions.has(f.id) && (f.name !== 'constructor' || i === 0),
|
|
47
|
-
),
|
|
48
|
-
}));
|
|
49
|
-
};
|
|
Binary file
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# Minimal makefile for Sphinx documentation
|
|
2
|
-
#
|
|
3
|
-
|
|
4
|
-
# You can set these variables from the command line.
|
|
5
|
-
SPHINXOPTS =
|
|
6
|
-
SPHINXBUILD = python -msphinx
|
|
7
|
-
SPHINXPROJ = RealityCheck
|
|
8
|
-
SOURCEDIR = .
|
|
9
|
-
BUILDDIR = .
|
|
10
|
-
|
|
11
|
-
# Put it first so that "make" without argument is like "make help".
|
|
12
|
-
help:
|
|
13
|
-
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
14
|
-
|
|
15
|
-
.PHONY: help Makefile
|
|
16
|
-
|
|
17
|
-
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
18
|
-
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
19
|
-
%: Makefile
|
|
20
|
-
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
Arbitrators
|
|
2
|
-
=============
|
|
3
|
-
|
|
4
|
-
.. toctree::
|
|
5
|
-
:maxdepth: 2
|
|
6
|
-
:caption: Contents:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
An arbitrator is responsible for providing a final answer to a question when there is a dispute, in exchange for a fee. If the arbitrator is untrustworthy, the system cannot be relied on to provide accurate answers.
|
|
10
|
-
|
|
11
|
-
Any contract address can be set as the arbitrator. Our dapp currently lists only the Reality Keys trusted arbitrator contract, but others can be entered manually. We can add other contract addresses on request.
|
|
12
|
-
|
|
13
|
-
Since arbitration is expensive, it will usually only be requested after parties have posted bonds, and the bonds have escalated to a level where the bond you stand to gain by paying for arbitration is higher than the fee. Accordingly, arbitrators should feel free to set fairly high fees that will adequately cover the cost of a thorough arbitration process.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Arbitration Models
|
|
17
|
-
------------------
|
|
18
|
-
|
|
19
|
-
Trusted third-parties
|
|
20
|
-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
21
|
-
|
|
22
|
-
The Reality.eth team have been providing a centralized arbitration service since 2013 beginning with the Reality Keys service. Use of this service is currently discouraged as decentralized alternatives are available.
|
|
23
|
-
|
|
24
|
-
Kleros
|
|
25
|
-
^^^^^^
|
|
26
|
-
|
|
27
|
-
Kleros provide a decentralized court system that is integrated with reality.eth and has been used successfully for high-stakes settlement.
|
|
28
|
-
|
|
29
|
-
Stakeholder voting
|
|
30
|
-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
31
|
-
|
|
32
|
-
Where a consumer contract has their own token, they may choose to provide their own arbitrator contract allowing their own stakeholders to vote. Alternatively, it is possible to deploy a reality.eth contract using the token in question for bonds, then create questions without a registered arbitrator. That way the side able to martial the greatest amount of the token will prevail.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
Subjectivocracy
|
|
36
|
-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
37
|
-
|
|
38
|
-
We are developing a system along the lines described in `Get the facts, hard-fork all the things`_. The `current design`_ envisages using a forkable Layer 2 ledger.
|
|
39
|
-
|
|
40
|
-
.. _`Get the facts, hard-fork all the things`: https://decentralize.today/get-the-facts-hard-fork-all-the-things-3ea2233da0fd
|
|
41
|
-
.. _`current design`: https://github.com/RealityETH/subjectivocracy
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
Creating and using an arbitration contract
|
|
47
|
-
------------------------------------------
|
|
48
|
-
|
|
49
|
-
Arbitrator contracts should expose the following functions to users:
|
|
50
|
-
|
|
51
|
-
* ``function getDisputeFee(bytes32 question_id) constant returns (uint256)``
|
|
52
|
-
* ``function requestArbitration(bytes32 question_id)``
|
|
53
|
-
|
|
54
|
-
When ``requestArbitration()`` is called with a sufficient fee, they should call the following against the Reality.eth contract:
|
|
55
|
-
|
|
56
|
-
* ``notifyOfArbitrationRequest(bytes32 question_id, address requester)``
|
|
57
|
-
|
|
58
|
-
When they produce an answer, they should settle the contract with:
|
|
59
|
-
|
|
60
|
-
* ``submitAnswerByArbitrator(bytes32 question_id, bytes32 answer, address answerer)``
|
|
61
|
-
|
|
62
|
-
If the result of arbitration is to affirm the answer given by the final answerer, the person who gave that answer should be supplied as ``answerer``. If the result of arbitration is to change the final answer, the ``answerer`` supplied should be the user who paid for arbitration. Since version 2.1, this behaviour can be enforced by a contract by instead using
|
|
63
|
-
|
|
64
|
-
``assignWinnerAndSubmitAnswerByArbitrator(bytes32 question_id, bytes32 answer, address payee_if_wrong, bytes32 last_history_hash, bytes32 last_answer_or_commitment_id, address last_answerer)``
|
|
65
|
-
|
|
66
|
-
The last 3 arguments can be extracted from event logs and supplied by the user sending the transaction, and are verified by the contract.
|
|
67
|
-
|
|
68
|
-
.. note::
|
|
69
|
-
Sometimes the answer the arbitrator finalizes on will already have been given earlier, but with a lower bond. It may appear fairer to some for the arbitrator to set the ``answerer`` as the person who previously gave that answer, not the person who paid. However, for all we know the person who gave the correct answer could be a sock puppet belonging to the person who gave the final, wrong answer. Rewarding them would remove the disincentive to lie. For the system the incentive system to work correctly, it is essential that the arbitrator choose the person who paid them as the ``answerer``, unless the pre-existing final answer was correct.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
Getting information about the arbitrator
|
|
73
|
-
----------------------------------------
|
|
74
|
-
|
|
75
|
-
* ``function realitio()`` should provide the address of the Reality.eth contract to which the arbitrator responds.
|
|
76
|
-
* ``function metadata()`` should provide a string of json-encoded metadata. It may contain the following properties
|
|
77
|
-
|
|
78
|
-
* ``tos``: A URI representing the location of a terms-of-service document for the arbitrator. Should be a URI, either a standard https:// URL or ipfs://
|
|
79
|
-
* ``foreignProxy: true``: This signals that the contract requires users to request arbitration on another chain, as with the Kleros cross-chain proxy. The contract will call additional methods against the contract to get the details of the foreign proxy.
|
|
80
|
-
* ``template_hashes``: [Not yet implemented] An array of hashes of templates supported by the arbitrator, if you want to limit usage of the arbitrator to specified templates. If you have a numerical ID for a template registered with Reality.eth, you can look up this hash by calling the Reality.eth ``template_hashes()`` function.
|
|
81
|
-
|
|
82
|
-
See an `Arbitrator contract example`_ to show you how to set the metadata.
|
|
83
|
-
|
|
84
|
-
.. _`Arbitrator contract example`: https://rinkeby.etherscan.io/address/0xF8175715a762514351dfe1aaaB83aF5F9DBcB5F5#readContract
|
|
85
|
-
|