TransparentUpgradeableProxy.test.js 831 B

1234567891011121314151617
  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 [proxyAdminAddress, proxyAdminOwner] = accounts;
  7. const createProxy = async function (logic, admin, initData, opts) {
  8. const { address } = await TransparentUpgradeableProxy.new(logic, admin, initData, opts);
  9. return ITransparentUpgradeableProxy.at(address);
  10. };
  11. shouldBehaveLikeProxy(createProxy, proxyAdminAddress, proxyAdminOwner);
  12. shouldBehaveLikeTransparentUpgradeableProxy(createProxy, accounts);
  13. });