Last active
June 10, 2018 18:54
-
-
Save RobertoC27/63cbdf3ac598d84da9bcbb8d80f09629 to your computer and use it in GitHub Desktop.
Resources to reproduce darq-truffle sender not updating
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ArgsTest = artifacts.require('ArgumentsTest'); | |
contract('Arguments test', function(accounts) { | |
let instance; | |
let sender; | |
before(async () => { | |
instance = await ArgsTest.new(); | |
sender = accounts[2]; | |
console.log('Default sender account: ', accounts[0]) | |
console.log('Updated sender account: ', sender); | |
}); | |
it('Records default sender', async () => { | |
const recordedSender = await instance.noArgs(); | |
assert.equal(recordedSender, accounts[0], 'Sender is not changed'); | |
}); | |
it('updates message sender no arguments', async () => { | |
const recordedSender = await instance.noArgs({from: sender}); | |
assert.equal(recordedSender, sender, 'Sender is not changed'); | |
}); | |
it('updates message sender with single arguments', async () => { | |
const recordedSender = await instance.singleArg(5, {from: sender}); | |
assert.equal(recordedSender, sender, 'Sender is not changed'); | |
}); | |
it('updates message sender with multiple arguments', async () => { | |
const recordedSender = await instance.multipleArgs(5, true, {from: sender}); | |
assert.equal(recordedSender, sender, 'Sender is not changed'); | |
}); | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.23; | |
contract ArgumentsTest { | |
function noArgs () view public returns (address) { | |
return msg.sender; | |
} | |
function singleArg(uint16 foo) view public returns (address) { | |
return msg.sender; | |
} | |
function multipleArgs(uint16 foo, bool bar) view public returns (address) { | |
return msg.sender; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment