TransparentUpgradeableProxy.test.js 887 B

123456789101112131415161718
  1. const shouldBehaveLikeProxy = require('../Proxy.behaviour');
  2. const shouldBehaveLikeTransparentUpgradeableProxy = require('./TransparentUpgradeableProxy.behaviour');
  3. const TransparentUpgradeableProxy = artifacts.require('TransparentUpgradeableProxy');
  4. const ITransparentUpgradeableProxy = artifacts.require('ITransparentUpgradeableProxy');
  5. contract('TransparentUpgradeableProxy', function (accounts) {
  6. const [owner, ...otherAccounts] = accounts;
  7. const createProxy = async function (logic, initData, opts = {}) {
  8. const { address, transactionHash } = await TransparentUpgradeableProxy.new(logic, owner, initData, opts);
  9. const instance = await ITransparentUpgradeableProxy.at(address);
  10. return { ...instance, transactionHash };
  11. };
  12. shouldBehaveLikeProxy(createProxy, otherAccounts);
  13. shouldBehaveLikeTransparentUpgradeableProxy(createProxy, owner, otherAccounts);
  14. });