@0xcert/ethereum-gateway-contracts
Version:
Smart contracts used by the gateway on the Ethereum blockchain.
50 lines • 2.62 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const spec_1 = require("@specron/spec");
const types_1 = require("../../core/types");
const spec = new spec_1.Spec();
spec.before((ctx) => __awaiter(void 0, void 0, void 0, function* () {
const accounts = yield ctx.web3.eth.getAccounts();
ctx.set('owner', accounts[0]);
ctx.set('jane', accounts[1]);
ctx.set('sara', accounts[2]);
}));
spec.beforeEach((ctx) => __awaiter(void 0, void 0, void 0, function* () {
const accounts = yield ctx.web3.eth.getAccounts();
const tokenDeployGateway = yield ctx.deploy({
src: './build/token-deploy-gateway.json',
contract: 'TokenDeployGateway',
args: [
accounts[0],
accounts[1],
],
});
ctx.set('tokenDeployGateway', tokenDeployGateway);
}));
spec.test('Sets new deploy proxy', (ctx) => __awaiter(void 0, void 0, void 0, function* () {
const owner = ctx.get('owner');
const jane = ctx.get('jane');
const tokenDeployGateway = ctx.get('tokenDeployGateway');
yield tokenDeployGateway.instance.methods.grantAbilities(owner, types_1.XcertDeployGateway.SET_PROXY).send({ from: owner });
const logs = yield tokenDeployGateway.instance.methods.setDeployProxy(jane).send({ from: owner });
ctx.not(logs.events.ProxyChange, undefined);
const deployProxy = yield tokenDeployGateway.instance.methods.tokenDeployProxy().call();
ctx.is(deployProxy, jane);
}));
spec.test('Fails setting new deploy proxy without permission', (ctx) => __awaiter(void 0, void 0, void 0, function* () {
const owner = ctx.get('owner');
const jane = ctx.get('jane');
const tokenDeployGateway = ctx.get('tokenDeployGateway');
yield ctx.reverts(() => tokenDeployGateway.instance.methods.setDeployProxy(jane).send({ from: owner }), '017001');
}));
exports.default = spec;
//# sourceMappingURL=set-proxy-instance-method.test.js.map